I'm using a piece of code that allows me to call to a level a .swf file and make it land on a given frame within the .swf file. It's a great piece of code, but for me it only works once. After one clicks the button, goes to the movie, the button and all others with the new code seem dead.
The code I adapted from a user of a different forum. Works for him. I believe my files are basically the same.
Also, there's a preloader. The code makes sure the movie is loaded before going to the specified frame by checking in with the preloader. I can e-mail these files if needed. They are mac files.
Here's the code on the botton:
on (release) {
if (_global.sub1) {
// movie is preloaded
_global.whereToGo = "bars";
_level5.gotoAndStop("bars");
} else {
_global.whereToGo = "bars";
loadMovieNum("/site/flash/bags.swf", 0);
preloader.gotoAndStop(2);
_global.sub1 = true;
// movie is preloaded
}
}
Here's the code on the .swf file:
stop();
this.onEnterFrame = function() {
if (_global.whereToGo == "trunk" || _global.whereToGo == "saddle" || _global.whereToGo == "pannier"|| _global.whereToGo == "all" || _global.whereToGo == "bars" || _global.whereToGo == "other" || _global.whereToGo == "baskets") {
gotoAndStop(_global.whereToGo);
delete this.onEnterFrame;
} else {
gotoAndStop("start");
delete this.onEnterFrame;
}
};
The code I adapted from a user of a different forum. Works for him. I believe my files are basically the same.
Also, there's a preloader. The code makes sure the movie is loaded before going to the specified frame by checking in with the preloader. I can e-mail these files if needed. They are mac files.
Here's the code on the botton:
on (release) {
if (_global.sub1) {
// movie is preloaded
_global.whereToGo = "bars";
_level5.gotoAndStop("bars");
} else {
_global.whereToGo = "bars";
loadMovieNum("/site/flash/bags.swf", 0);
preloader.gotoAndStop(2);
_global.sub1 = true;
// movie is preloaded
}
}
Here's the code on the .swf file:
stop();
this.onEnterFrame = function() {
if (_global.whereToGo == "trunk" || _global.whereToGo == "saddle" || _global.whereToGo == "pannier"|| _global.whereToGo == "all" || _global.whereToGo == "bars" || _global.whereToGo == "other" || _global.whereToGo == "baskets") {
gotoAndStop(_global.whereToGo);
delete this.onEnterFrame;
} else {
gotoAndStop("start");
delete this.onEnterFrame;
}
};