A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Control playhead

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    13

    [F8] Control playhead

    I'm not really sure how to control the playhead more than the simple stop(); deal...

    If I want the playhead to return to any area on the main timeline, what kind of action script to I write?

    For instance, I would like to
    (this sounds right in my head)

    "at end of movie, gotoAndStop on the root timeline, frame (1) "

    How do I write that in AS2, and should that code be placed on the Actions, on the main timeline?

  2. #2
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    You can do it a couple of ways. From what you wrote I'm getting that you have a movieClip with some animation and you want to get the main timeline to play when the movieClip gets to the end of the animation. you could put the code on a layer in the movieclip and use _root to get to the main timeline like

    _root.gotoAndPlay(2);

    you'd put this on the last frame of the movie clip. Or you could do something on the main timeline like

    this.onEnterFrame= function(){//runs function 1 time every frame
    if(myMC._currentframe == 30){//every frame we check if you mc is at frame 30
    gotoAndPlay(2);//if your mc is at frame 30 then play
    delete this.onEnterFrame;//remove the onEnterFrame because we don't need it anymore.
    }
    }

    There are other ways but those are the two I'd recommend.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    13

    Project completed

    Thank you very much for the quick response. I used the first of your two suggestions, and it worked fine. I had been doing similar the entire time and found some other mistakes along the way. Again, thanks!

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