Transitions Between External SWFs Tutorial Question

Hi,

After following the Transitions Between External SWFs Tutorial

Does anyone know how I can make this button work if it is not in the main swf? I have loaded a swf in automatically and want to make a button from within the loaded swf to load another swf.

Here is the button code…

on (release) {
	if (_root.currMovie == undefined) {
		_root.currMovie = "myWay";
		container.loadMovie("myWay.swf");
	} else if (_root.currMovie != "myWay") {
		if (container._currentframe>= container.midframe) {
			_root.currMovie = "myWay";
			container.play();
		}
	}
}

Thanks.

Don’t quote me on this because I’m far from an AS expert, but if you have a button on your loaded .swf, you don’t want to have it load another external .swf to the _root, I think you would want to load it something like this:

this.currMovie == undefined

Change your _root to ‘this.’ That way you just replace the current movie with another instead of trying to load it onto the main stage.

In fact, I think your button on inside the external clip can be fairly simple like this:

on (release) {
	//load Movie Behavior
	if (this == Number(this)) {
		loadMovieNum("yourNewClip.swf", this);
	} else {
		this.loadMovie("yourNewClip.swf");
	}
	//End Behavior
}

This would be done on the button itself simply using the built-in behaviors that Flash has. If you have the same buttons as you do on the main stage, I wouldn’t even bother having two buttons doing the same thing though.

I’m not even sure if any of that made sense, but play around with it until someone who knows exactly what they are talking about comes by and corrects me. :run: