0

我通过单击按钮将这个 txt 文件加载到 AS3 (Flash) 中。但是当我单击任何其他按钮时,我希望 txt 消失。我试过了 stop(); 和 unloadAndStop,但它不起作用。有任何想法吗?

hello_btn.addEventListener(MouseEvent.CLICK,  buttonClick4)
function  buttonClick4(e:MouseEvent):void
{
     try{
loader_mc.unloadAndStop();
} catch(e:Error) {
}
      var loader:URLLoader;
var info_text:TextField;

CSSFormattingExample();

function CSSFormattingExample():void
{
    info_text = new TextField();
    info_text.wordWrap = true;
    info_text.x = 300;
    info_text.y = 160;
    info_text.width = 800;
    info_text.height = 800;
    addChild(info_text);
}
var url:String = "hello.txt";
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler);
loadit.load(new URLRequest(url));

function completeHandler(event:Event):void
{
    info_text.htmlText = event.target.data as String;
}
}
4

0 回答 0