Answered
Listening for the end of a movie
Hi, I have some code that loads a movieclip into an empty
clip
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
container.attachMovie("twdc_mc", "twdc_mc", 1, {_x:300, _y:275});
then i want to wait until the end of the movieclip, unload it and load another in its place - all without leaving frame one of my main timeline...so my initial thought was to add this:
function getframes(numFrames,totalFrames) {
if (numFrames == totalFrames){
trace("removed") //changed the return variable to this for testing
}
};
container.twdc_mc.onEnterFrame = getframes(container.twdc_mc._currentframe,container.twdc_mc._totalframes);
(the use of a function because i want to re-use it)
the problem is that the if statement is parsed and evaluated to false immediately, then it moves on to the next statement without looking back despite the existance of the onEnterFrame function
So my question is how can I listen for this event without the need to add unLoad or removeMovieClip to the end of the offending mc?
Thankyou in advance for any replies, I'm trying hard to get to grips with "as" but Im a php boy at heart and really struggling!
Sam
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
container.attachMovie("twdc_mc", "twdc_mc", 1, {_x:300, _y:275});
then i want to wait until the end of the movieclip, unload it and load another in its place - all without leaving frame one of my main timeline...so my initial thought was to add this:
function getframes(numFrames,totalFrames) {
if (numFrames == totalFrames){
trace("removed") //changed the return variable to this for testing
}
};
container.twdc_mc.onEnterFrame = getframes(container.twdc_mc._currentframe,container.twdc_mc._totalframes);
(the use of a function because i want to re-use it)
the problem is that the if statement is parsed and evaluated to false immediately, then it moves on to the next statement without looking back despite the existance of the onEnterFrame function
So my question is how can I listen for this event without the need to add unLoad or removeMovieClip to the end of the offending mc?
Thankyou in advance for any replies, I'm trying hard to get to grips with "as" but Im a php boy at heart and really struggling!
Sam