all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

gotoAndStop(scene_variable, 1); ???


Re: gotoAndStop(scene_variable, 1); ??? David Stiller
9/30/2005 3:29:41 PM
flash actionscript:
[quoted text, click to view]

Assuming the term scene_variable is a variable, does this variable refer
to a string?

[quoted text, click to view]

Of course! :) If scene_variable is a variable, the value of that
valuable should be the desired scene name, which will be a string. Where
are you setting this variable?


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: gotoAndStop(scene_variable, 1); ??? David Stiller
9/30/2005 5:35:07 PM
[quoted text, click to view]

I just tested that, and you're right. Wow, bizarre! A string is a
string is a string -- or so I thought. Shouldn't matter if it's a variable
or actual quoted string.

Flash keeps surprising me.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

gotoAndStop(scene_variable, 1); ??? forumnotifier
9/30/2005 7:17:36 PM
gotoAndStop(scene_variable, 1);

if I do this I get an error saying the first value must be a quoted string,
but if i type it as "scene_variable", it looks for a scene called
"scene_variable"

anyone know how to do this???
Re: gotoAndStop(scene_variable, 1); ??? groovything.com
9/30/2005 8:20:16 PM
I duplicate a menu item movieclip like:

//define menu item variables:
sub1_1 = "Introduction";
sub1_2 = "Our Offices";
sub1_3 = "Our Businesses";


//use this function to populate the sub menu:
function populateSubs(whichMenu, subs, x_pos){
y_pos = 83;
for(j=1;j<subs+1;j++){
duplicateMovieClip(sub_item_mc, "sub"+whichMenu+"_"+j+"_mc", j);
this["sub"+whichMenu+"_"+j+"_mc"].menu_text_mc.dynamic_text.text =
_root["sub"+whichMenu+"_"+j];
this["sub"+whichMenu+"_"+j+"_mc"].scene_value = _root["sub"+whichMenu+"_"+j];
this["sub"+whichMenu+"_"+j+"_mc"]._y = _root.y_pos;
this["sub"+whichMenu+"_"+j+"_mc"]._x = x_pos;
this["sub"+whichMenu+"_"+j+"_mc"]._visible = true;
this["sub"+whichMenu+"_"+j+"_mc"].onEnterFrame=function(){
if(_root.active_menu!=whichMenu){this.removeMovieClip();}
}
_root.y_pos += 18;
}
}



I was making the problem too hard...the simple solution is:

You can't select a scene name dynamically - however you can use frame labels.
Put a frame label on frame 1 of the scene, then you can use,

_root.gotoAndStop(scene_variable);

where scene_variable contains a string that matches the frame label you used.

Re: gotoAndStop(scene_variable, 1); ??? NSurveyor
10/1/2005 12:42:09 AM
Using scenes in Flash is very buggy, you should always use Frame Labels in
their place. BTW, I believe using x["y"] notation a lot causes the movie to run
slower. You might want to store it in a variable:

function populateSubs(whichMenu, subs, x_pos){
y_pos = 83;
for(j=1;j<subs+1;j++){
var sub = duplicateMovieClip(sub_item_mc, "sub"+whichMenu+"_"+j+"_mc", j);
sub.menu_text_mc.dynamic_text.text = _root["sub"+whichMenu+"_"+j];
sub.scene_value = _root["sub"+whichMenu+"_"+j];
sub._y = _root.y_pos;
sub._x = x_pos;
sub._visible = true;
sub.onEnterFrame=function(){
if(_root.active_menu!=whichMenu){this.removeMovieClip();}
}
_root.y_pos += 18;
}
}
Re: gotoAndStop(scene_variable, 1); ??? Tom Unger
10/1/2005 11:06:08 PM
groovything.com;
Scene references on the main timeline are converted into frame targets
on the single contiguous main timeline on swf export. Scene names cannot
called dynamically because there are no scene references in swf files--they
exist only as an editing "convenience" in the fla. -Tom Unger

AddThis Social Bookmark Button