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!

ActiionScript - easy question about gotoAndPlay

Status
Not open for further replies.

webscripter

Programmer
Jul 29, 2002
266
US
I'm adding a gotoAndPlay to my script for the first time. I have traces in the only 2 frames in my MovieClip.

Buttons are in the _root of the movie, and only one timeline.

I put this in for one of the buttons to test:

on (release) {
donethat = 1;
trace("add_door btn clicked, adminpage = "+adminpage);
adminpage = "ADDdoor.swf";
gotoAndStop("page1",2);
}
//page1 is the first Scene 1 which I renamed for the fun of it.

the problem is the traces I put in report it's going back to frame 1 again and then to frame 2. So I put a if condition so it would skip the code in frame 1 like this.

//frame 1
if(donethat != 1){
doornm = new Array();
doords = new Array();
//textfield for showing status of perl program
_root.loadsts.backgroundColor = 0xFFFFFF;

//initialize some variables
_global.loadstat = new String();
// load the inital page
_global.adminpage = "ADDdoor.swf";

myMovie = createEmptyMovieClip("pagebody",_level10);
myMovie._x = 300;
myMovie._y = 75;

// var unloadmv is set to 1 with button click
myMovie.loadMovie(adminpage);

_root.onLoad = function(){
trace ("onData called");
//doornames is sent through
_global.onld = 1;
};
myvars = new LoadVars();
myvars.load("doors.txt");
_global.unloadmv = 0;
myvars.onLoad = function (success) {
if (success) {
trace("myvars.doornames = "+myvars.doornames);
if(myvars.doornames == undefined){
loadstat = "No doors added or unable to load doors.txt."
_root.loadsts.text = loadstat;
trace(ldstatus);//var name for textfield
}else{
doornm = myvars.doornames.split("|");
doords = myvars.doordescs.split("|");
trace(doornm.length);
door_list.removeAll();
for(i=0;i<doornm.length;i++){
door_list.addItem(doornm,doornm);
}
var i = 0;
}
}
};
trace(&quot;inside frame 1&quot;);
}

//frame 2 simply has a trace call in it and stop();
trace(&quot;you're in frame 2&quot;);

Why do I have to use the conditional if test to skip the first frame Thanks
Tricia
yorkeylady@earthlink.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top