Actionscript 3: Delete code-generated movieclips when changing frame -
this code generates airport symbol part of bigger presentation. works pretty well, @ moment objects don't disappear when change frame, them to.
i've tried different methods in other frame, whatever error: "call possibly undefined method removechild through reference static type class."
i'm pretty new as3, keep in mind :)
thank you. below code.
for (var key:object in airports) { var myairport = new airport(); myairport.x = airports[key]["x"]; myairport.y = airports[key]["y"]; myairport.width = 17; myairport.height = 17; addchild(myairport) myairport.addeventlistener(mouseevent.click, this.clickhandler) }
put movieclips each scene array build each scene. can loop through array , remove them calling cleanup function:
function cleanupview():void { for( var i:int = 0; < collectedmovieclipsarray; i++ ) { var parentcontainer:movieclip = collectedmovieclipsarray[ ].parent movieclip; parentcontainer.removechild( collectedmovieclipsarray[ ] ); } }
the as movieclip part not necessary.
Comments
Post a Comment