![Avatar of 1Cougar](https://filedb.experts-exchange.com/files/public/2013/11/18/8fb2999d-b9ff-40b4-8232-a42f8aab2a68.png)
1Cougar
asked on
load mc via loadMovie and play only once!
Hello,
I think this should be easy, but I must be missing something. I have a two frame movie. First frame is stop(). Second frame has a mc on it. I export this to a swf.
I load the swf in my movie. I would like it to play once and then I would like to take it off the stage. But, it keeps looping and looping. What to do?
Code below.
Many thanks in advance!
I think this should be easy, but I must be missing something. I have a two frame movie. First frame is stop(). Second frame has a mc on it. I export this to a swf.
I load the swf in my movie. I would like it to play once and then I would like to take it off the stage. But, it keeps looping and looping. What to do?
Code below.
Many thanks in advance!
_root.createEmptyMovieClip("myIntroAnim",_root.getNextHighestDepth());
for (i=0; i<=1; i++){
_root.myIntroAnim.loadMovie(path+"Section1IntroAnim.swf");
setProperty("myIntro",_x,80);
setProperty("myIntro",_y,60);
}
_root.myIntroAnim.gotoAndPlay(2);
_root.myIntroAnim.removeMovieClip();
trace("I am in intro");
![Avatar of Dreammonkey](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
sorry, this one is better, I guess...
_root.createEmptyMovieClip("myIntroAnim",_root.getNextHighestDepth());
for (i=0; i<=1; i++){
_root.myIntroAnim.loadMovie(path+"Section1IntroAnim.swf");
setProperty("myIntro",_x,80);
setProperty("myIntro",_y,60);
}
_root.gotoAndStop(2);
_root.myIntroAnim.gotoAndPlay(2);
_root.myIntroAnim.removeMovieClip();
trace("I am in intro");
![Avatar of 1Cougar](https://filedb.experts-exchange.com/files/public/2013/11/18/8fb2999d-b9ff-40b4-8232-a42f8aab2a68.png)
ASKER
Hi,
I have a 1 frame movie run in actionscript, so I don't want to have the root go to frame 2. The external movie plays fine until I load it in the main movie. Frame 1 has the mc on it with the action and Frame 2 has a stop(). Movie plays 1 time and then stops. But, when I load it in main movie, it loops over and over and it seems like I can't control the movie. Maybe there are too many nested movie clips? This is how it is:
Main movie-->mc myIntroAnim --> loads Section1IntroAnim.swf -- has 2 frames, frame 1 with mc and frame 2 with stop.
Thanks again,
I have a 1 frame movie run in actionscript, so I don't want to have the root go to frame 2. The external movie plays fine until I load it in the main movie. Frame 1 has the mc on it with the action and Frame 2 has a stop(). Movie plays 1 time and then stops. But, when I load it in main movie, it loops over and over and it seems like I can't control the movie. Maybe there are too many nested movie clips? This is how it is:
Main movie-->mc myIntroAnim --> loads Section1IntroAnim.swf -- has 2 frames, frame 1 with mc and frame 2 with stop.
Thanks again,
![Avatar of Dreammonkey](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
Ok, how about this one?
_root.createEmptyMovieClip("myIntroAnim",_root.getNextHighestDepth());
for (i=0; i<=1; i++){
_root.myIntroAnim.loadMovie(path+"Section1IntroAnim.swf");
setProperty("myIntro",_x,80);
setProperty("myIntro",_y,60);
}
_root.myIntroAnim.gotoAndPlay(2);
_root.myIntroAnim.removeMovieClip();
trace("I am in intro");
stop();
![Avatar of Antonio Estrada](https://filedb.experts-exchange.com/files/public/2016/0/19/88efe27a-c7e9-4d15-a536-134ea9850a85.png)
Why are you using removeMovieClip? removeMovieClip(); is the counter method for attachMovie();, not loadMovie(); ...You should use unloadMovie instead.
unloadMovie(_root.myIntroA nim);
Another thing, if the loaded MovieClip has 2 frames and you're telling him to gotoAndPlay(2) it could be the cause for the looping, why don't you use gotoAndStop(2)
-V
unloadMovie(_root.myIntroA
Another thing, if the loaded MovieClip has 2 frames and you're telling him to gotoAndPlay(2) it could be the cause for the looping, why don't you use gotoAndStop(2)
-V
![Avatar of 1Cougar](https://filedb.experts-exchange.com/files/public/2013/11/18/8fb2999d-b9ff-40b4-8232-a42f8aab2a68.png)
ASKER
Hi there and thanks for your comments. I will change the remove Movie Clip statement. I have gotten the movie to stop looping by putting another stop() in the nested mc (swf).
Now I have another issue. The main movie doesn't wait for the swf to finish playing before moving ahead....what can I do to stop the main movie to wait until the loaded swf has finished?
Thanks a lot for any ideas!
Cheers!
Now I have another issue. The main movie doesn't wait for the swf to finish playing before moving ahead....what can I do to stop the main movie to wait until the loaded swf has finished?
Thanks a lot for any ideas!
Cheers!
![Avatar of Antonio Estrada](https://filedb.experts-exchange.com/files/public/2016/0/19/88efe27a-c7e9-4d15-a536-134ea9850a85.png)
Well since you're loading and unloading pretty much at the same time you can't see anything. A way make sure the entire loaded swf is played is the following:
<code>
Or something along these lines, would be better to see your *.fla to see it working/failing.
Good luck.
-V
<code>
Or something along these lines, would be better to see your *.fla to see it working/failing.
Good luck.
-V
_root.createEmptyMovieClip("myIntroAnim",_root.getNextHighestDepth());
for (i=0; i<=1; i++){
_root.myIntroAnim.loadMovie(path+"Section1IntroAnim.swf");
setProperty("myIntro",_x,80);
setProperty("myIntro",_y,60);
}
_root.myIntroAnim.gotoAndPlay(2);
_root.myIntroAnim.onEnterFrame = function() {
_root.stop();
if(this._currentframe == this._totalframes) {
_root.play();
unloadMovie(this);
}
}
trace("I am in intro");
stop();
![Avatar of 1Cougar](https://filedb.experts-exchange.com/files/public/2013/11/18/8fb2999d-b9ff-40b4-8232-a42f8aab2a68.png)
ASKER
Hi,
Your suggestion has improved performance in that it is stopping, but it does not move forward. In fact, I put a "trace" statement inside of the function myIntroAnim.onEnterFrame and it never executes....why would it never go into the function?
Any ideas?
Your suggestion has improved performance in that it is stopping, but it does not move forward. In fact, I put a "trace" statement inside of the function myIntroAnim.onEnterFrame and it never executes....why would it never go into the function?
Any ideas?
![Avatar of Antonio Estrada](https://filedb.experts-exchange.com/files/public/2016/0/19/88efe27a-c7e9-4d15-a536-134ea9850a85.png)
Interesting.
Looks like something's wrong with the loadMovie method, I'll create a test *.fla for you to use. Do you have Flash 8 or CS3?
-V
Looks like something's wrong with the loadMovie method, I'll create a test *.fla for you to use. Do you have Flash 8 or CS3?
-V
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
![Avatar of 1Cougar](https://filedb.experts-exchange.com/files/public/2013/11/18/8fb2999d-b9ff-40b4-8232-a42f8aab2a68.png)
ASKER
Hi and thanks! Your code is perfect and that is now working....but, still more issues. Will post another question.
Cheers!
Cheers!
or just put a stop(); in the actions layer ...
Open in new window