I have a button that loads an external swf using the movie clip loader. The problem is if I want to stop the moving from loading before it is completely downloaded I can’t. The movie still loads.
I thought using clearInterval would stop this, but it doesn’t seem to be the problem. I have attached my actionscript and test fla’s.
You can view the movie here: http://www.visualscientists.com/vstest/interval/clearinterval.html
If you click the orange square it will load an external swf. If you click the yellow square it will unload the movies and clearInterval.
Thanks!
#include "lmc_tween.as"
var _nInterval:Number;
var _nIntervalFlipContent:Number;
var _nFlipInterval:Number;
var _nFlipBackInterval:Number;
//clear interval
function unloadContent():Void{
clearInterval(_nInterval);
clearInterval(_nIntervalFlipContent);
clearInterval(_nFlipInterval);
clearInterval(_nFlipBackInterval);
trace(_nIntervalFlipContent);
unloadMovie("_parent.mc_flip");
unloadMovie("_parent.mc_flipcontent");
}
//portfolio flip
var my_mcflip:MovieClipLoader;
my_mcflip = new MovieClipLoader();
var myListenerFlip:Object = new Object();
myListenerFlip.onLoadInit = function(target_mc:MovieClip) {
};
myListenerFlip.onLoadComplete = function(target_mc:MovieClip) {
function loadFlipFade():Void{
loadFlipContent();
loadWorkPad();
trace("loadcomplete");
clearInterval(_nFlipInterval);
}
_nFlipInterval = setInterval(loadFlipFade, 400);
};
my_mcflip.addListener(myListenerFlip);
// load flip function
function loadFlip():Void{
_parent.createEmptyMovieClip("mc_flip", _parent.getNextHighestDepth());
my_mcflip.loadClip("work_flip.swf", "_parent.mc_flip");
_parent.mcHolderwork._visible = false;
trace("load flip");
}
//portfolio flip content
var my_mcl2:MovieClipLoader;
my_mcl2 = new MovieClipLoader();
var myListener2:Object = new Object();
myListener2.onLoadComplete = function(target_mc:MovieClip) {
trace("transform");
target_mc._alpha = 0;
target_mc._visible = false;
function contentIntro():Void{
target_mc._visible = true;
target_mc._alpha = 0;
//mcHolder.tween("_alpha", 100, 5, sTween, 0.020);
target_mc.alphaTo(100, 2, sTween, 0.005);
clearInterval(_nIntervalFlipContent);
}
_nIntervalFlipContent = setInterval(contentIntro, 0);
};
my_mcl2.addListener(myListener2);
function loadFlipContent():Void{
_parent.createEmptyMovieClip("mc_flipcontent", _parent.getNextHighestDepth());
my_mcl2.loadClip("flipcontent.swf", "_parent.mc_flipcontent");
trace("flipcontent loaded");
}
mc_btn.onRelease = function():Void {
trace("mc_btn clicked");
loadFlip();
};
mc_btn2.onRelease = function():Void {
trace("mc_btn2 clicked");
unloadCo