View Full Version : jumping to a loaded .swf's frame label
chererene
09-22-2003, 06:50 PM
I have created a main movie where the timeline is cut into six states (labeled section1, section2, etc). Actionscript at each state tells the playhead to stop and then load a certain .swf in an empty mc (called "holder").
Here's my quandry: I have a button on a mc on the main movie and I want it to take me first a certain state on the main timeline (labeled "section2") where a .swf loads and then move to a frame label ("crosstab") on that loaded .swf's timeline.
I put this actionscript on the button:
on (release) {
_root.gotoAndStop("section2");
_root.holder.gotoAndPlay("crosstab");
}
My results:
The button successfully takes me to "section2" on the main timeline, loads the .swf, but the playhead starts playing on the first frame, not at the frame label I specified ("crosstab").
Any way to do this?
webguy
09-22-2003, 08:06 PM
hello chererene and welcome to the forums. the problem lies in the fact that the swf is not loaded yet, so it a call to it fails silently. The best thing to do is to put it inside of the loaded movie to jump to a frame. Something like
this.gotoAndStop("frameLabel");
web
chererene
09-23-2003, 11:05 AM
Thank you for the explanation.
Perhaps I am now venturing into a situation where I'll need to use a conditional statement in actionscript (which I have not done before). I only want the playhead to jump to that frame label if one certain button (called "crosstab") is pressed. I have other buttons that load this same .swf and start playing at frame 1, so I don't want to put a script in the .swf's first frame saying to jump to a frame label in every situation.
It sounds impossible that the movie will know that the "crosstab" button is what got it to section 2 which loaded the .swf, as opposed to another button.
The context of my problem is that I've created a demo showing how to use an online analysis tool, and I am trying to provide a sitemap that jumps to certain places in the demo.
What do you suggest?
webguy
09-23-2003, 06:01 PM
I'd put a variable in the scope of the conditional, or on the _global object. Something like this:
// assigning a variable to the mc called jump
// this will be used by the mc to decide
// where to jump and whether to jump at all
mc.jump = "thisFrameLabel";
// this code is inside of the mc called 'mc'
// simply says that if the variable jump
// does not equal undefined then the clip is supposed
// to jump to a frame defined by the
// jump variable
if(this.jump!=undefined) {
this.gotoAndStop(jump);
}
You could also use boolean true:false instead of using the jump variable to define your frameLabel. Also you have to make sure to change jump to undefined when you don't want it to jump. Doing it globally is also acceptable as it makes it easier to target it from through your movie.
_global.jump = true;
// inside mc
// if(jump) is the same as if(jump==true)
if(jump) {
this.gotoAndStop("frameLabel");
}
Hope that helps.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.