0
我正在嘗試將位圖加載到舞臺上,然後在完全使用AS代碼時補間它。下面的工作,但是當它添加一個新的位圖圖像的階段,它離開最後一個,從而留下一個相同的位圖的負載。基本ActionScript 3 sprite補間
任何想法?我嘗試添加「removeChild(myLoader);」但那沒有做什麼。非常感謝。
import flash.display.MovieClip;
import flash.events.*;
stage.frameRate = 31;
var a =0;
btn111.addEventListener(MouseEvent.CLICK, go);
function go(event:MouseEvent):void
{
this.addEventListener(Event.ENTER_FRAME, drawrect);
function drawrect(evt:Event)
{
// Create a new instance of the Loader class to work with
var myLoader:Loader=new Loader();
// Create a new URLRequest object specifying the location of the external image file
var myRequest:URLRequest=new URLRequest("logo.png");
// Call the load method and load the external file with URLRequest object as the parameter
myLoader.load(myRequest);
// Add the Loader instance to the display list using the addChild() method
addChild(myLoader);
// Position image
myLoader.x = 100;
myLoader.y = a++;
if(a > 50)
{
//removeChild(box);
removeEventListener(Event.ENTER_FRAME, drawrect);
}
}
}