我认为我有显示此图片所需的导入但是我收到此错误:
1120: Access of undefined property slideImage.
1120: Access of undefined property loader.
1180: Call to a possibly undefined method addChild.
1120: Access of undefined property loader.
我的动作脚本位于名为play.as
的类中这是AS3代码:
package {
import flash.display.MovieClip;
import flash.display.Bitmap;
import flash.net.URLRequest;
import flash.display.Loader;
public class play extends MovieClip {
var loader:Loader = new Loader();
loader.load(new URLRequest("img/Layer_1.jpg"));
addChild(loader);
public function play() {
// constructor code
}
}
}
答案 0 :(得分:0)
这段代码就足够了:
package {
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.display.Loader;
public class play extends MovieClip {
private var loader:Loader = new Loader();
public function play() {
loader.load(new URLRequest("img/Layer_1.jpg"));
addChild(loader);
}
}
}