2 Replies Latest reply on Jul 11, 2007 1:48 AM by cicnats

    Delay Actions

    ihsutd
      I have the following Actionscript which moves text and images onto the stage. I want to delay p1-p3 so that they float in at set times or intervals. I am extremely confused as to how to achieve this. I am an actionscript fool...but I *think* I need to use Timer but I have no idea how to implement the code. Any info will save my arse.

        • 1. Re: Delay Actions
          Web_Maven Level 1
          Yes you need a timer. There are many version of timers just do a Google search. I had downloaded a timer from www.flashcomponents.net which uses a Flash component (but this is an old habit it is easy to create a timer)

          You also need to create a function for p1-p3.

          function DelayMyAction()
          {
          TransitionManager.start(p1,{type:Fly,direction:Transition.IN,duration:3,easing:Elastic.eas eOut,startPoint:3});
          TransitionManager.start(p2,{type:Fly,direction:Transition.IN,duration:3,easing:Elastic.ea seOut,startPoint:3});
          TransitionManager.start(p3,{type:Fly,direction:Transition.IN,duration:3,easing:Elastic.ea seOut,startPoint:3});
          }

          Your timer will call DelayMyAction(); and after a set time (a time that you had set in your timer) they will start. If you need to start them at different time you can use an "if statement" and use a variable to help move things along. There are may ways to accomplish this task.
          • 2. Re: Delay Actions
            cicnats Level 1
            I usually use just a simple onEnterFrame with a counting variable

            for example:

            mc.count = 30; // 1 sec at 30fps
            mc.onEnterFrame = function() {
            if( this.count-- > 0) return;
            // do whatever you need here, like e.g.
            start_some_function();
            delete this.onEnterFrame;
            }