|
Flash ActionScript Help Please
Hello everyone. I've been trying to get this working for the past month. I searched as much as I could and everywhere that I could. Please help with my situation.
I'm loading external swf files to a movie container, but I want to show a preloader before it is ready and play. The problem is the preloader get stop prematurely and there is a gap between the preloader stopping and the movie playing.
**************************************************
BUTTON: (note that button is not on _root, but within containers after containers, and it will be extremely difficult to redo all that animation work)
on (rollOver, dragOver) { //as2 on button
gotoAndPlay(2); //animation of the button
_root.PrevCon._visible = false; //make movie container invisible
loadMovie("path here", _root.PrevCon); //load movie to container
_root.PreLoadCon.gotoAndStop(2); //frame 2 of preloader container plays it
}
on (rollOut, dragOut) {
gotoAndStop(1); //animation of the button
unloadMovie(_root.PrevCon); //unload movie from container
_root.PreLoadCon.gotoAndStop(1); //frame 1 of preloader container stops it
}
//this part is irrelevant but i purposely dun load it on release
on (release) {
_root.pro_btn.gotoAndPlay(2);
_root.gotoAndPlay(3);
}
**************************************************
MOVIE CONTAINER: (aka PrevCon)
onClipEvent (enterFrame) { //as2 on movie clip
if (this.getBytesTotal != 0) { //if something is loaded
if (this.getBytesLoaded() == this.getBytesTotal()) { //if it's complete
_root.PreLoadCon.gotoAndStop(1); //preloader animation stops
_root.PrevCon._visible = true; //movie is visible
}
}
}
**************************************************
PRELOADER CONTAINER: (aka PreLoadCon)
No script except stop() on frame 1 and 2 on action layer, and on animation layer frame 1 is clear and frame 2 has self play animation that keeps on looping.
**************************************************
Any help to solve this would be greatly appreciated. It has been many restless nights after work.
Cheers~
__________________
"Be water, my friend." (Bruce Lee)
"I would complain about severe understeer and they would show me how it was me, the nut behind the wheel that caused the understeer." (Alex Chiu - Director of Velocity Driver Development)
"I drift not because it is a quicker way around a corner, but it is the most exciting way" (Keiichi Tsuchiya - Drift King)
"With chocolate, you know what you're gonna get and I can't always be delicious."
|