Problems with .loadmovie

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.

/
Simon Henriksen

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:

trace(“this part works”);

Yeah, that’s my problem. I did gave it the instance name container.

What do you with “put this in the if statemeny to see if your conditions are actually met” ? What does trace(“this part works”); do?

Here’s links to the fla and the profile.swf it should load.
FLA: http://simonhenriksen.frandt.com/flash/final.fla
profile.swf: http://simonhenriksen.frandt.com/flash/profile.swf

/
Simon Henriksen

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.

If you do that Flash will attempt to trace the value of a variable called: this part works. This will come up as undefined in the output window.

You should therefore use this instead:

trace(“this part works”);

Okay, I got most of it work.

[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:

  1. 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…

Help me… I’ve updated the http://simonhenriksen.frandt.com/flash/final.fla to the new one. Please take a look![/size][/font]

Okay, I got the problems fixed.

A new problem came up when I started making a new site.

I have a menu. In the menu there’s different mc’s. If you click on of them there should load a movie in a mc in the main page.

How do I do that?

on (release) {
_root.yourContainer.loadMovie (“yourMovie.swf”);
}

Ordinathorreur

If you do that Flash will attempt to trace the value of a variable called: this part works. This will come up as undefined in the output window.

You should therefore use this instead:

trace(“this part works”);

Error on my part. Thanks for catching it.

What if it is in another movieclip? Should i make _movieclipname instead of _root then?

_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.

What should i do with the _root then? Change it to something else? Can you give a example?

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 :slight_smile:

Thanks for explaining. I found out that it was a new problem so please check this thread:

http://www.kirupaforum.com/forums/showthread.php?p=581453#post581453

Thanks