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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transitions between External Swf, thats inside another external swf. 1

Status
Not open for further replies.

nofx1728

Technical User
Jan 26, 2006
65
US
Sorry for the confusing topic title. These external .swfs are really killing me, can't seem to get them to play correctly. Here is what I have, based on a tutorial I found here:
Let me try to explain this the best I can:

*ssfp.fla
I have a main movie titled ssfp.fla. Inside here I have a blank movie clip that loads the "content" of each section of my page.

I have several different products, each set up identical, with the information changing. The first of these pages is titled ssfpbedroom.fla.

*ssfpbedroom.fla

In this ssfpbedroom.fla I have a few layers. On the bottom layer I have a blank movie clip (which will load external swf's of larger images) with the instance name "container".

Then on the next layer above I have buttons (which are thumbnails.) The idea is, when you click on a thumbnail it then loads a larger image with a description of the product. The current buttons have instance names of bed1_btn and bed2_btn.
bed1_btn:
Code:
on (release) {
	if (this.currMovie == undefined) {
		this.currMovie = "bed1";
		container.loadMovie("bed1.swf");
	} else if (this.currMovie != "bed1") {
		if (container._currentframe >= container.midframe) {
			this.currMovie = "bed1";
			container.play();
		}
	}
}
bed2_btn
Code:
on (release) {
	if (this.currMovie == undefined) {
		this.currMovie = "bed2";
		container.loadMovie("bed2.swf");
	} else if (this.currMovie != "bed2") {
		if (container._currentframe >= container.midframe) {
			this.currMovie = "bed2";
			container.play();
		}
	}
}

Then on my actions layer I have this code:
Code:
_root.currMovie = "bed1"; 
container.loadMovie(_root.currMovie+".swf");

*bed1.fla
In my bed1.fla I have 2 layers. On the botton layer is the larger picture (bed1_gr) with 2 motion tweens. Frames 1-30 goes from 0 alpha to 100. Then I have a frame on 31. Then Frames 32-62 the graphic goes from 100 to 0 alpha.

On my actions layer I have this code:
Frame 1
Code:
midframe = 31
Frame 31
Code:
stop();
Frame 62
Code:
_root.container.loadMovie(_root.currMovie+".swf");

When I preview the movie in ssfpbedroom.fla it works properly. The images fade in and out and everything is great. However, when I load ssfpbedroom.swf into my ssfp.swf it gets all screwed up. On the buttons it use to say _root. instead of where it says this. but the buttons would not do anything when I loaded my external swf.

Now, the bed1.swf loads properly when the external swf is brought in. And the buttons function. Here is the problem. If I click on bed2_btn first it will play the transition and change the content in my container. But then if I click on bed1_btn it will replay the bed2.swf. And vise versa. If the first button I click on is bed1_btn it will play the transition and show bed1 (even though it is displayed from the beginning), but then when I click on bed2_btn it will replay bed1.swf. Not sure why it is doing this.

Can someone please help me.

Thanks,

nofx1728
 
I'm not sure if I understood your problem fully, but I can say the problem is "_root". When you run ssfpbedroom.swf, _root means ssfpbedroom.swf. But when you load it into ssfp.swf, _root becomes ssfp.swf, therefore it cannot find any properties which you assigned to _root.

You can use _lockroot but it's a bad practice. If you want to do it properly, use _parent: from bed1.swf, ssfpbedroom.swf would be this._parent, for example.

Kenneth Kawamoto
 
I'll try that right now. Thanks for the advice.

Thanks,

nofx1728
 
It worked perfect :O. Yippy! Thanks so much bro, I really appreciate it.

Thanks,

nofx1728
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top