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);
}
}
}