在一个小小的游戏中,我必须为大学制作我在运行时渲染菜单,使用我在插图画家绘制的按钮制作的动画片段。我像往常一样在flash专业人员中导入了illustrator文件,并且像我一样用我的其他动画片剪辑进行AS连接。但是当我尝试渲染这些按钮时,我得到一个错误1009,一个空引用。我顺便使用AS3。
private function initMenuComponents():void{
var btnPlay:MovieClip = new Play();
var btnOptions:MovieClip = new Options();
var btnLikeOnFacebook:MovieClip = new LikeOnFacebook();
var btnShareOnFacebook:MovieClip = new ShareOnFacebook();
btnPlay.x = (stage.stageWidth / 2) - (btnPlay.width / 2);
btnOptions.x = (stage.stageWidth / 2) - (btnOptions.width / 2);
btnLikeOnFacebook.x = (stage.stageWidth / 2) - (btnLikeOnFacebook.width / 2);
btnShareOnFacebook.x = (stage.stageWidth / 2) - (btnShareOnFacebook.width / 2);
btnPlay.y = 100;
btnOptions.y = 150;
btnLikeOnFacebook.y = 200;
btnShareOnFacebook.y = 250;
stage.addChild(btnPlay);
stage.addChild(btnOptions);
stage.addChild(btnLikeOnFacebook);
stage.addChild(btnShareOnFacebook);
}
答案 0 :(得分:0)
听起来您没有正确链接IDE中的文件。您看到的错误源于此问题。我会将几乎所有代码都注释掉,并进行测试以确切找到错误的位置。
var btnPlay:MovieClip = new Play();
//var btnOptions:MovieClip = new Options();
//var btnLikeOnFacebook:MovieClip = new LikeOnFacebook();
//var btnShareOnFacebook:MovieClip = new ShareOnFacebook();