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

Newbie Question:: Loading an external movie

Status
Not open for further replies.

sugarlush

Programmer
Jul 17, 2003
3
US
Sorry for the newbie question but this one has stumped me.

I am tring to create an animtion that will run an externaly loaded movie.

In my animation, after a frame with just text runs for 4 seconds I load an external swf file. After that movie completes I am trying to load another 4 second clip immediately after it. This middle swf file is going to be of different lengths (I will be pulling the file name from a database and it could be any size).

What I need to know is how to tell when this file ends so I can load the ending text frame.

How do you find the number of frames for an external file?

Thanks to anyone who helps in advance.



Brian
 
you could probably do something with _totalframes but i think it just would be simpler to place a variable in the last frame of the externally loaded swfs

something like

_global.done = true;

place
_global.done = false;
in the first frame of the main movie and call the second text bit once _global.done = true


_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
I am not too sure if I got your question exact but i hope this helps. an easy way i've found to do (and probably and old way) what you want to do is with tell targets and loaded movie clips.

say your first movie is 20 frames long - and your text stops at, say the 4th frame which is where you would like the other movie to begin playing.

make a second layer and place an empty movie clip in the first frame and label the instance of that movie to a name of your choice. Tell that frame to load the external file movie2.swf (or whatever its called) into the blank movie clip instance that you created.

create a new .swf (movie2.swf or whatever you want to call it. make the first frame of this movie blank and place a stop at the first frame - this is so that nothing will show when the movie gets imported into the first movie. now add the stuff you want in this movie after the first frame.

go back to your first movie and at frame 4 or wherever the text stopped moving at - make a tell target statement that refers to the movie instance you created earlier that tells the targeted swf file to go to and play frame two. and voila your second movie starts to play exactly where you needed it to. and not a second before.

i hope this helps
 
Thanks for the advice from both of you.

The only bad thing is I have no control over the external flash movie. This will be coming from another company and I cannot place any code in that file.

Is there another way to read in the number of frames from an external file and then trigger an event when that elapses?

 
You can use a control movie clip that constantly monitors the external loaded movie's _currentframe, comparing it with it's _totalframes, and controls your main timeline, based on a specific _currentframe or when the external movie as reached it's last frame.

Regards,

cubalibre2.gif

Bacon, eggs and sunshine are still good for me!
 
I've tried several of the above suggestions and I can't seem to get _currentframe or _totalframes to work properly. I have a dynamic text variable called totalframestext that is reading the total frames of the external flash file. The problem is the the value is always equal to 1. It is not reading the correct frame total.

I have attached the code below. Can anyone see the problem with it?

Thanks in advance for your help.


Brian


placeHolder.loadMovie("flashTest2.swf", "/placeHolder");
totalframestext = placeHolder._totalframes;

TotalFramesExternal = placeHolder._totalframes;
CurrentFrame = placeHolder._currentframe;
this.createEmptyMovieClip("checker", 1);
checker.onEnterFrame = function() {
if (currentFrame == TotalFramesExternal) {
// gotoandplay(1);
} else {
// delete this.onEnterFrame;
}
};
 
it reads one because that will be the clip size.

i think you might be better with some preloader code watching placeholder and only once that has fully loaded attempt to get current frame and totalframes

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top