A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: simple AS question movie control

  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    67

    Question simple AS question movie control

    Hi

    i have a swf with a movie clip in it (38 static image frames long)

    on loading of the swf i would like to play the movieclip, then pause it on the last frame for 1 second then play the frames in reverse then pause it on the first frame for 1 seond and then play the frames in correct order ETC ETC ETC

    can anyone guide me please ??
    tnx

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Here is one way you can do it.

    Actionscript Code:
    stage.addEventListener(Event.ENTER_FRAME, ef);

    var ended:Boolean = false;

    function ef(e:Event):void{
       
        if(mc.currentFrame == mc.totalFrames){
            ended = true;
            delay();
        }else if(ended && mc.currentFrame == 1){
            ended = false;
            delay();
        }
       
        if(ended){
            mc.gotoAndStop(mc.currentFrame-1);
        }else{
            mc.gotoAndStop(mc.currentFrame+1);
        }

    }


    function delay():void{
        stage.removeEventListener(Event.ENTER_FRAME, ef);
        setTimeout(function(){
                       stage.addEventListener(Event.ENTER_FRAME, ef);
                       }, 1000);
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center