7 Replies Latest reply on May 11, 2012 10:41 AM by FlashKatt

    speed up on/off visibility?

    FlashKatt Level 1

      I have a simple animation involving flames and I'd like this flame to be visible for a frame, invisible for a frame...or 2 frames or whatever looks good. As a newbie, I'm doing each frame at a time..select item, key frame, change alpha to zero or 100% depending on which frame that is.

       

      Is there a smarter faster way to tell an object to be alternately visible/invisible on a cycle of ever N-frames?

       

      thank you,

       

      cat

        • 1. Re: speed up on/off visibility?
          Ned Murphy Adobe Community Professional & MVP

          You will probably fair better if you don't use frames and use code instead.  Since you mention 100% alpha it isn't clear if you are using AS2 or AS3, but in either case there are timing elements available that you can use to change the alpha/visible property on a regular basis that you can control more flexibly than using frames.

           

          As an alternative to a coded approach, you could create the on/off switching as a small movieclip (2 frames, 4frames, etc, to control the timing) and use that instead of trying to arrange it along an entire timeline.

          1 person found this helpful
          • 2. Re: speed up on/off visibility?
            FlashKatt Level 1

            Ah..code...action script.

             

            while I know of action script, I don't know how to make it work for me but I thank you...I had a feeling code would be involved in what I'm after..the movieclip idea sounds like a clever Plan B.

             

            kat

            • 3. Re: speed up on/off visibility?
              FlashKatt Level 1

              Ned;

               

              As Action Script goes, is my goal to easily handle that flame animation on the easier side of the spectrum? Can you suggest any tutorials that are best for a complete Action Script greenhorn to get productive?

               

              thank you,

               

              kat

              • 4. Re: speed up on/off visibility?
                Ned Murphy Adobe Community Professional & MVP

                I can offer some information if you can indicate which version of Actionscript your file is being published for... check your Flash Publish Settings.

                • 5. Re: speed up on/off visibility?
                  FlashKatt Level 1

                  Ah, yes, you did mention this...I have Flash CS 5 for Mac OS X, and in the publish settings, it says:  Action Script 3.0

                   

                  That's just what appears there; I have no idea which version it ought to be; the pull down offers other choices, of course...

                   

                  Thank you for your help, Ned!

                   

                  kat

                  • 6. Re: speed up on/off visibility?
                    Ned Murphy Adobe Community Professional & MVP

                    For Actionscript 3 you can use the Timer class to manage the changing of the status.  The first thing you need to do is have your flame as a movieclip that you can assign an instance name to so that you can target it using code.  So after you create the movieclip, drag an instance of it onto the stage and assign it an instance name in the Properties panel where it says <Instance Name>.  Let say you name it "flames".

                     

                    Next you need to add some code for it to make a Timer instance that will switch the flames' visibility on and off.  So create  layer for some code, select the keyframe in that layer and with the Actions panel opened, enter the following code in the Actions panel...

                     

                         var timer:Timer = new Timer(100);    

                         timer.addEventListener(TimerEvent.TIMER, switchVisibility);

                     

                         function switchVisibility(evt:TimerEvent):void {

                               flames.visible = !flames.visible;

                         }

                     

                         timer.start();

                     

                    That 100 that you see in the first line is the amount of time the switching will occuring at, in this case 100 msec.  You can change that value to make the switching go faster or slower.

                    1 person found this helpful
                    • 7. Re: speed up on/off visibility?
                      FlashKatt Level 1

                      Thank you, Ned...that gives me something to chew on. As I read the code you provide above, I think I can get a sense of how the instructions work.

                       

                      and based on my hunch and your comments, seems like AS is essential to stepping on the gas during production for things which are iterative...and other things, too!

                       

                      kat