View Full Version : loading external SWF files into MC

01-29-2001, 12:04 AM
I've being reading about people loading external SWF files into MC. I can't seem to get the hang of it. Could someone give me an example how to do that? and what advantages does it have?

01-29-2001, 12:42 AM
I only use this with blank MC> So CTrl F8 to create a new MC. Don't put anything in it. Drag a copy of it ontot he main stage and give it an instance name like 'dog'.

Then you can have you external file (test.swf) loaded in to that:

loadMovie ("test.swf", "/dog");

The main benefit is ease of manipulation, you can animate the movie clip around the screen and stuff and the content (test.swf) will go around with it.



01-29-2001, 04:02 AM
cool, I've got that working, but how do I target and detect variables set in the loaded movie.

Here is what I have

I have an external movie called test.swf, and within the test.swf, I've set a few variables.

On my main timeline, I've got a button and an empty movie called movie. I've assigned the following actions to the button:

on (release) {
loadMovie ("/test.swf", "movie");
with (_root.movie) {
if (_root.movie:movie_open_status=="close") {
gotoAndPlay (2);
} else if (_root.movie:movie_open_status=="open") {
gotoAndPlay (_root.movie._currentframe);
} else if (_root.movie:movie_open_status=="end") {
stop ();

when I test it, it doesn't load the movie at all. What did I do wrong?

01-29-2001, 04:54 AM
You can't use any objects from a loaded movie until it's loaded. So as a rule, you can't manipulate a movie or access its variables until you've given it at least 1 frame to get loading!
Add your manipulation code on the next frame.



01-29-2001, 05:50 AM

I know this is going to be a dumb question, but how do I build that into a button? I need the user to click on the button, then start playing the loaded movie depending on the variable set within the loaded movie. but according to what you said, I can't manipulate the movie until it is loaded. But how do I load the movie first with the button, then manipulate the movie with one single click?

01-29-2001, 07:37 AM
Hmm I see the problem.
How about having a triggerring movie clip, something like Metrov8's 'initializing' movie clip. it pops up on click ad says "Hang on" for like 5 frames or something, and at the end it does your variable test, or your gotoAndPlya(), etc...

Get me?
It would need a blank first frame with a stop in it. And then some sort of 'wait' info for a few frames. You really just need to give flash a second to understand what you want to do. Remeber that actions on the same button might as well be performed instantaneously, the delay is so short.



01-29-2001, 10:38 PM
hmm, I sorta get what you are saying, but there are 3 different variables set within the loaded movie and at different times depending on the user interaction. From what I understand, it could only detect one variable at a time and in order to detect any one of the other variable, the user would have to click again? By the way, could I get the URL to the web site you were talking about? Perhaps if I see the actual site, it would go through my mind a little easier.

Thanks Jesse

02-01-2001, 05:43 AM
Grr this is a tricky one. The 3 diff variable might cause problems. I'll tell you what, take a look at Metrov's Tutorial which will come online tonight or tomorrow and see if it helps out.

If not, we'll brainstorm again... if all else fails, can't you just have a preloader in the loaded clip that triggers something in root (like a function goDoIt() ) when it's fully loaded?



02-02-2001, 07:14 AM
Well, the reason I have 3 different variables was to detect wether a window is open or not so that when the user clicks on a button it opens a window, but if the user clicks on the same button again, it will stay open instead of reloading the window. Is there a better way of do this?

[Edited by jake88 on 02-02-2001 at 02:25 AM]

05-02-2006, 01:07 AM
At 01-28-2001 09:54 PM Jesse said "You can't use any objects from a loaded movie until it's loaded. So as a rule, you can't manipulate a movie or access its variables until you've given it at least 1 frame to get loading!
Add your manipulation code on the next frame."

I'm running into a similar sort of problem as jake88. I want to access and manipulate the _height and _width of my SWF that was loaded into a MC using MovieClipLoader. I chose this instead of loadMovie because it allows you to to write code that only executes after the movie clip is completely loaded (see "onLoadComplete"). However, even then my SWF is now the same size as the MC. So what I want to do is download the _height and _width of the SWF before I load the Movie. Is there any way to do this using LoadVars/Load/LoadVariables?

~ Joseph ~