Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PLAY and GoToAndPlay on same frame

Status
Not open for further replies.

GooeyHand

Technical User
Jun 25, 2002
17
CA
Hey would anybody know if it is possible to make a button when released, 'Play' 12 frames and then 'GoToAndPlay' another frame further down the TimeLine?

I know this can be done by placing the 2 actions on seperate frames. 'PLAY' on the 1st frame and then 'GoToAndPlay' on the 12th frame. But i need both of these actions to be placed together on the 1st frame. So is there a way to control the amount of frames played when released? and then after played it will jump to another frame?

Thanks a bunch
 
Set a variable to hold the labeled frame to be played...

on (release){
_level0.my_var = "frame46"; // for example...
play();
}

then on the 12th frame, probably also with a stop action, check the variable and have it go the frame that was set...

stop();
if(_level0.my_var == "frame46"){
_root.gotoAndPlay("frame46");
} else {
// do something else...
}

Of course, frame 46 would have been labeled with "frame46".

If you want to use this on several buttons, just label the frames to go to accordingly, set the variable on the "release" and then simply add other "else ifs..." on your 12th frame. Regards,

oldman3.gif
 
alirght i've been givin you're idea a try. but i've been getting stuck cause i'm not too good with this scripting stuff. Now, i'm not too familar with levels. How exactly do they work? and instead of me using _root to go back to the main timeline, to gotoandplay in a MC placed on the main timeline would i go,
_root[name of MC].gotoandplay ("frameName");
 
_root.instance_name.gotoandplay ("frameName");

A movie clip must have an instance name, for each instance on stage. It can be the same as it's Library name, but it does need it to be targeted.

Regards,

oldman3.gif
 
alright, thanks a lot. things are starting to come together now. thanks
 
well it seems i'm still stuck with the _root.instance.go...
so here is my script on the button i wish to redirect from:

on (release) {
_level0.my_var = "oilprofile";
_root.profilemov.gotoAndPlay("profileout");
}

-"profilemov" is the instance name of "profile_mov"(MC) that contains the frame "profileout"(where i want to go).
-"profile_mov"(MC) is located in a "profilebuttons"(MC) on the main timeline.

so it looks like this on my timeline:
Main timeline >
-Profilebuttons(MC) >
-profile_mov(MC) (where frame "profileout" is)
-oil_mov(MC)>
-but_oil(button)(where the script from
above is located)

Sorry about it being so confusing.
 
hooooollllly mother, i'm a fool. nevermind the last reply. i don;t know why i didn't think about considering the instances as folders.

_root.profilebuttons.profilemov.gotoAndPlay("profileout");

works. thanks abunch for the help though.
 
Yes, it is confusing, and seems somewhat far away from your original question.

Can you post a link to your .fla, or have another go at this?

Or maybe this helps...


label -> -> label
mc -> ->grandchildmc1
mc -> ->childmc1 ->childmc3
mc -> parentmc1 parentmc2
_root -> -----------------------------------------------


From childmc3, I want to target a labeled frame (label) in grandchildmc1, I would use:

_root.parentmc1.childmc1.grandchildmc1.gotoAndPlay("label") Regards,

oldman3.gif
 
actually yeah i got it workin. thanks for all your help and patience though.
 
No problem! Regards,

oldman3.gif


Don't worry, if my reply is wrong, BillWatson will clean it up for me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top