flash - Cannot unload previous swf while loading the new ones -
i have made main navigation page in adobe flash , 3 buttons in it. have used code in order call external swf's according button pressed. problem when press button load 1 swf want previous 1 unloaded. how can have tried everything
var myloader:loader = new loader(); var myloadermain:urlrequest = new urlrequest("main1.swf"); var myloaderquiz:urlrequest = new urlrequest("quiz.swf"); var myloaderanimation:urlrequest = new urlrequest("athens_animation.swf"); var myloadervideo:urlrequest = new urlrequest("videogallery.swf"); videogallerybtn.addeventlistener(mouseevent.click, videofunc); function videofunc(curevt:mouseevent) { myloader.load(myloadervideo); addchild(myloader); } quizbtn.addeventlistener(mouseevent.click, quizfunc); function quizfunc(curevt:mouseevent) { myloader.load(myloaderquiz); addchild(myloader); } animationbtn.addeventlistener(mouseevent.click, animationfunc); function animationfunc(curevt:mouseevent) { myloader.load(myloaderanimation); addchild(myloader); }
have 2 event listeners each button, first mouse_down unload loader , mouse_up load loader .
videogallerybtn.addeventlistener(mouseevent.mouse_down, mousedown); videogallerybtn.addeventlistener(mouseevent.mouse_up, mouseup); function mousedown(curevt:mouseevent) { trace("mousedown unload, remove"); } function mouseup(curevt:mouseevent) { trace("mouseup load , add it"); }
hopefully principle.
Comments
Post a Comment