Go Back   kirupaForum > Flash > ActionScript 1.0/2.0

Reply
 
Thread Tools Display Modes
Old 11-26-2009, 03:19 PM   #1
kingkelly
Registered User
Controlling a MC's timeline

Hey everyone,

Im wondering if its possible to control a movieclips timeline a bit more than the simple play, stop functions.

I was hoping by pressing a button, it would make the MC's playhead not just jump to frame 20, but play to it.

So if the movieclip's timeline is on frame 60, I press a button and it scrubs all the way back to frame 20. Click another button and it scrubs to frame 40, etc....

I hope you guys get what im trying to say
kingkelly is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-27-2009, 07:03 AM   #2
eki
SHO
 
eki's Avatar
Location Not any more

Posts 1,206
PHP Code:
this.onEnterFrame = function(){
if(
myMc._currentframe != frameNumberToGo){
  if(
myMc._currentframe frameNumberToGo){
    
myMc.prevFrame();
  } else{
    
myMc.nextFrame();
 }
}else{
  
delete this.onEnterFrame;
}


__________________
Hope it helps.
Ondo izan.
eki is offline   Reply With Quote
Old 11-27-2009, 10:25 AM   #3
kingkelly
Registered User
Oooo thanks a bunch!

So to make this code work, do I keep both these lines and replace frameNumberToGo with the frame number?:

if(myMc._currentframe != frameNumberToGo){
if(myMc._currentframe > frameNumberToGo){

Im a bit lost, cant get it to work. I have the code on the first frame, and motion tweened myMc, but it just plays through. What should the buttons be doing?
kingkelly is offline   Reply With Quote
Old 11-27-2009, 10:49 AM   #4
eki
SHO
 
eki's Avatar
Location Not any more

Posts 1,206
Quote:
So to make this code work, do I keep both these lines and replace frameNumberToGo with the frame number?:
Yes you're right on this

About your second point:
PHP Code:
function runMc(frameNumberToGo){
myMc.stop();
  
this.onEnterFrame = function(){ 
if(
myMc._currentframe != frameNumberToGo){ 
  if(
myMc._currentframe frameNumberToGo){ 
    
myMc.prevFrame(); 
  } else{ 
    
myMc.nextFrame(); 
 } 
}else{ 
  
delete this.onEnterFrame

}  
}

//on your button:

myButton.onRelease= function(){
runMc(frameNumberToGo);


__________________
Hope it helps.
Ondo izan.
eki is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:36 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com