AS3代码的问题
编译器产生错误代码
“1120:访问未定义的属性master_mc。” (粗体)
有人知道出了什么问题吗?
我遵循了教程,但没有任何关于 master_mc
实际工作原理的解释。
请帮助使该脚本正常运行。
这是教程的链接尝试过。
var xmlRequest:URLRequest = new URLRequest("imageData.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML;
var imageLoader:Loader;
var rawImage:String;
var rawH:String;
var rawW:String;
var imgNum:Number = 0;
var checkSec:Timer = new Timer(100);
var numberOfChildren:Number;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);
master_mc.addEventListener(MouseEvent.CLICK, nextImgF);//problem
master_mc.buttonMode = true;//problem
function xmlLoadedF(event:Event):void{
checkSec.start();
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
imgData = new XML(event.target.data);
}
function packagedF():void{
checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
rawImage = imgData.image[imgNum].imgURL;
numberOfChildren = imgData.*.length();
rawW = imgData.image[imgNum].imgW;
rawH = imgData.image[imgNum].imgH;
imageLoader = new Loader;
imageLoader.load(new URLRequest(rawImage));
master_mc.addChild(imageLoader);//problem
imageLoader.x = (stage.stageWidth - Number(rawW))/2;
imageLoader.y = (stage.stageHeight - Number(rawH))/2;
}
function checkerF(event:TimerEvent):void{
if(imgNum == 0){
packagedF();
}
else if(imgNum < numberOfChildren){
imageLoader.unload();
packagedF();
}
else{
imageLoader.unload();
imgNum = 0;
packagedF();
}
}
function nextImgF(event:MouseEvent):void{
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
imgNum++;
}
The compiler produces error code
"1120: Access of undefined property master_mc." (bolded)
Anyone know what went wrong?
I followed a tutorial but there wasn't any explanation on how master_mc
really works.
Please help make this script run properly.
Here's the link to the tutorial I tried.
var xmlRequest:URLRequest = new URLRequest("imageData.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML;
var imageLoader:Loader;
var rawImage:String;
var rawH:String;
var rawW:String;
var imgNum:Number = 0;
var checkSec:Timer = new Timer(100);
var numberOfChildren:Number;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);
master_mc.addEventListener(MouseEvent.CLICK, nextImgF);//problem
master_mc.buttonMode = true;//problem
function xmlLoadedF(event:Event):void{
checkSec.start();
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
imgData = new XML(event.target.data);
}
function packagedF():void{
checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
rawImage = imgData.image[imgNum].imgURL;
numberOfChildren = imgData.*.length();
rawW = imgData.image[imgNum].imgW;
rawH = imgData.image[imgNum].imgH;
imageLoader = new Loader;
imageLoader.load(new URLRequest(rawImage));
master_mc.addChild(imageLoader);//problem
imageLoader.x = (stage.stageWidth - Number(rawW))/2;
imageLoader.y = (stage.stageHeight - Number(rawH))/2;
}
function checkerF(event:TimerEvent):void{
if(imgNum == 0){
packagedF();
}
else if(imgNum < numberOfChildren){
imageLoader.unload();
packagedF();
}
else{
imageLoader.unload();
imgNum = 0;
packagedF();
}
}
function nextImgF(event:MouseEvent):void{
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
imgNum++;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Flash 的舞台上有一个名为 master_mc 的影片剪辑吗?如果没有,我会尝试制作一个并再次编译。
On the stage in Flash do you have a movieclip with the name master_mc? If not I would try making one and compiling again.