I’m making my personal portfolio, and I need the pages get loaded as external .swf files because I wanted transitions between the different pages. I followed this tutorial here at kirupa.com and maked the required mc and added this code to my button:
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "profile";
container.loadMovie("profile.swf");
} else if (_root.currMovie != "profile") {
if (container._currentframe>=container.midframe) {
_root.currMovie = "profile";
container.play();
}
}
}
My .swf file to load is caleled profile.swf and is in the same folder. My mc it should load in is called container.
Can anybody help me? If you need the .fla just ask.
Although you didn’t exactly ask a question, I’m guessing your movies aren’t loading into the container clip, right?
Did you give your container clip an instance name? (click on the container clip and look in the properties box)
Another tip is put this in the if statement to see if your conditions are actually met:
when you trace something, flash outputs whatever is in the () if the conditions are met. So if you put trace(this part works); in your if statement, you could tell whether it’s conditions are being met by whether ‘this part works’ appears in your output window. Hope that helps.
[font=verdana, arial, helvetica][size=2] Still have two questions:
The external .swf is showing up behind the main movie. Is there any way to make it come in front?
After clicking either main or profile, and click on profile or main, it doesn’t work.
Example:
I click profile (profile is coming in) 2. I click main (profile fading out and main shows up) 3. Then I click profile again and nothing comes up? It’s the same when you do main and then profile. It’s like it can’t load the same .swf twice…
_root refers to the main timeline. If it would be another movieclip, substitute yourContainer for the instance name of the movieclip you want to load that external swf into.
You can basically think of _root in the same way as your harddrive. Just think of root as your C:
If you need to access a folder you would use C:\myfolder\mypictures\yourfile.exe
(I was lucky enough to grow up using DOS…)
OK now lets go to flash. Each movieclip, button or whatnot has to have an instance name for you to access it (click on movieclip, look in properties)
so you might have to access a properrty in a movieclip three “folders” down.
You can do this by using:
_root.firstMC.secondMC.ballMC._alpha = 50; (the _alpha property governs transparency.
So in this example you have your root of the movie, (the screen that Flash starts off in when you start a new file.) On the stage is a movieclip with the instance name firstMC. Inside that movie is another clip with the instance name secondMC. Inside the secondMC is your instance BallMC.
Now if you were to click on the instance BallMC and put this in the actions box: _parent._alpha = 50;
You would be adressing a property of the movieclip that contains ballMC (secondMC, as ballMC is inside it)
If you would use _parent._parent.ballMC._alpha = 50; you would be accessing firstMC.
Hope this helps a bit. If not please post a Fla file and someone can help you out with the structure and explain what exactly is going wrong