mardi 26 mai 2015

close / unload UiLoader as3

I'm using a Loader to display a SWF. I have a button to load the SWF and I want that same button to close or hide or unload the SWF.

Here's part of my code:

var so:Boolean = false ;
    glossary.addEventListener(MouseEvent.CLICK, glossaire)
    function glossaire (e:MouseEvent) {
        var myLoader:Loader = new Loader();                     
        var url:URLRequest = new URLRequest("glossary.swf");
        if (so == false )
        {
            so = true ;
            myLoader1.load(url);                                    
            addChild(myLoader);
        }
        else{  
            so = false ;
            //i tried  
            myUILoader.unload(); 
            removeChild(myUILoader);
            // but my loader still appear in the stage how can remove or hide it
        }
    }

Aucun commentaire:

Enregistrer un commentaire