5 Replies Latest reply on Oct 12, 2012 8:43 AM by sinious

    Scene issue


      Iv been using flash cs4 AS3 for the past few weeks now slowly picking it up as I go along.
      I have a animation that is over 16,000 frame the max aloud, so I split the animation into 4 seperate scenes each labeled from "part1" to "part 4". The animation uses images and audio, the images fade in and out of each other presented with different audio every time. This seems like a very simple problem but i have done lots of research to see if anyone had a similar issue but iv been unable to find any.


      When the end of the first scene is reached and it should move to the next scene, the first image of the second slide is shown but the images stop changing while the audio on the timeline continues to play.
      The audio is set to sream so the timeline hasnt stopped but it wont continue to swap to the next image.

      Iv added:
      gotoAndPlay(1,"part 2");
      To the end of the first scene and it does navigate correctly but the images wont change!


      Even for good measure i added:


      To the start of the second scene but still nothing.


      Can anyone help?
      Or even surgest another way that I can create a 30+ minute film in flash that will change images seemlessly?


      Thank you in advance

        • 1. Re: Scene issue
          sinious Most Valuable Participant

          Are you showing a slideshow? Basically showing an image for a certain duration, then fading to the next image, rinse repeat?


          I would do this in all code but you're new to flash so let's deal with it your way, timeline. Also 3rd party plugins are available rampantly around the net for showing slideshows. At that point you'd just need to play your audio.


          Otherwise you can use a simple script to stop the playhead for a duration of time rather than extending the frames of each image. That should cut your frames down to a fraction of what I'm assuming you're using now. 16,000 is crazy!


          Also most people won't notice the difference between 24 frames per second and 30 frames per second. Typically people up the FPS to 30 so reducing it back down to 24 will give you more frames to work with but still have smooth transitions.


          If you set your document to 24fps and want it to pause for 5 seconds on each image then a script to pause for 5 seconds would look like this in AS3:


          Import on the first frame:


          import flash.utils.setTimeout;


          Stop for 5 seconds:


          // stop the playhead



          // wait 5000 milliseconds (5 seconds), then play()



          Your timeline fading between images would then look like this:




          This doesn't include an audio layer to keep it simple. The first frame script would contain the import above, and also the pause script. Then each [a] frame script you see would only be the pause script.


          In that picture an image fades in for 1 second (24 frames) while the previous image fades out for 1 second at the same time, overlapping (a dissolve).


          The [a] frame script stops the playhead for 5 seconds each time you see it. So by the time the 95th frame is hit you have shown 5 pictures for 5 seconds. If you did that all on the timeline without the script you'd have to extend the timeline out (5 pics for 5 seconds) 25 seconds, or (24fps x 25 seconds) 600 frames.


          Simple scripts like that will save you a lot of time and effort. If you reduce the fade time by half (12 frames instead of 24, half a second) you'd get about 10 pictures in the same space and most people wouldn't notice the difference, except the fade is quicker.


          It's a lot to take in so I'll stop there for now.


          The script version would be a bit too complex if you're not a coder. There's a so many ways to code it I don't want to go down any bunny trails ahead of myself.

          1 person found this helpful
          • 2. Re: Scene issue
            m0rgan01 Level 1

            Thats correct, its a form of slide show however it isnt a pre preped one, I had 40ish images on a single document and a single large audio file, I cut up a large audio file to the specific sections per slide and photoshopped the images.
            The reason it exceeds 16,000 is for example the first piece of audio is 1:30 seconds long so for the frame rate needed (Im running at 24 fps)  would be 24x90 = 2160 frames for the first slide and with 40ish slides the frame numbers built up quickly.


            So am I right in thinking that the action script would stop the timeline, when it hits the script, on the image for the duration mentioned? and if so wouldnt this then effect the audio stream?


            I currently have a small fade between them using a classic tween and the alpha transparancy.


            Im not a AS3 coder but I am confidant in HTML, CSS,  a bit of PHP and Jquery

            • 3. Re: Scene issue
              sinious Most Valuable Participant

              Syncing will be the biggest challenge then. Is this audio a seamless song?


              With the SoundChannel class you can load a sound from the library (or filesystem with Sound class). It's pretty easy and it has an event when the sound is finished playing.


              e.g. Loading/playing a library sound:


              import flash.media.SoundChannel;


              // get an actionscript linked instance of the library sound

              var mySound:SomeLibrarySound = new SomeLibrarySound1();


              // load it into a SoundChannel, play it

              var mySoundChannel:SoundChannel = mySound.play();


              An event is dispatched when that sound is done. That's where you could tell yourself to load the next sound.


              Using the code above:


              import flash.events.Event;


              mySoundChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);


              function soundCompleteHandler(e:Event):void


                   // sound is finished, load something else, sound 2..

                   mySound = new SomeLibrarySound2();

                   mySoundChannel = mySound.play();



              Again if you're not froggy on going the code route I don't want to go too far down that bunny trail but you can see here that code is being used to play the sound which removes your need to use the timeline to play it.


              How fast a users computer is would dictate how much time it would take to swap sounds and there's faster ways to have other sounds "preloaded" so they play back to back more efficiently.


              Alternatively, keep in mind if you make a new MovieClip in the library,  you can put the audio inside a layer. If you drop that MovieClip on the timeline it will take up 1 frame yet it will play the audio inside it (which can be up to 16,000 frames of audio). Nesting things inside MovieClips lets you take something that would normally take a large number of frames and condense it down to 1 frame. Then you can use the above mentioned timeline example and place the sounds on the timeline but not need to extend it just for the audio. Make sense?

              • 4. Re: Scene issue
                m0rgan01 Level 1

                Yes I think I understand, thank you you've been an amazing help

                • 5. Re: Scene issue
                  sinious Most Valuable Participant

                  You're welcome and good luck!