动作脚本小错误
你好,我已经编写了这些代码,当我运行 PUBLISH 时,它没有显示任何错误,但是当我在最后一张海报上运行 flash 窗口时,它显示
TypeError: Error #1010: A term is undefined and has no properties.
at slider_fla::MainTimeline/nextClick()
这里代码:
var sliderNum:int = 0;
var sliderMaxNum:int = 0;
function nextClick(event:MouseEvent):void
{
if (sliderNum > sliderMaxNum){
sliderNum = 0;
}
var myTween:Tween = new Tween(poster[sliderNum],'x',Strong.easeOut,poster[sliderNum].x,-800,2,true);
if (sliderNum == sliderMaxNum){
trace(String(sliderNum));
trace(String(sliderMaxNum));
sliderNum = 0;
} else {
sliderNum = sliderNum +1;
}
var myTween2:Tween = new Tween(poster[sliderNum],'x',Strong.easeOut,poster[sliderNum].x,(myStage.stageWidth - 640)/2,2,true);
}
我使用此代码加载 XML:
function loadXML(event:Event):void{
sliderXML=XML(sliderXMLloader.data);
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = true;
var menuXML:XML = XML(sliderXMLloader.data);
xmlDoc.parseXML(menuXML.toXMLString());
//var X:int = 100;
for each(var listItem:XML in sliderXML..listItem){
strTitle[sliderMaxNum] = listItem.itemTitle.toString();
strPosterLink[sliderMaxNum] = listItem.posterLink.toString();
strVideoLink[sliderMaxNum] = listItem.videoLink.toString();
var _temp:Loader = new Loader();
poster.splice(sliderMaxNum, 0, _temp);
poster[sliderMaxNum].load(new URLRequest(strPosterLink[sliderMaxNum]));
//var posterClip:MovieClip = new MovieClip(); //load the movieclip
//posterClip.addChild(poster[sliderMaxNum]); //convert poster[sliderMaxNum] to movieClip
addChild(poster[sliderMaxNum]);
poster[sliderMaxNum].x = myStage.stageWidth;
poster[sliderMaxNum].y = 28;
poster[sliderMaxNum].addEventListener(MouseEvent.CLICK, poster_click(sliderMaxNum));
sliderMaxNum = sliderMaxNum+1;
}
LastSliderNum = sliderMaxNum - 1;
//*************************************************
var myTween:Tween = new Tween(poster[sliderNum],'x',Strong.easeOut,poster[sliderNum].x,(myStage.stageWidth - 640)/2,2,true);
//*************************************************
}
hello i have written these piece of code, when i run PUBLISH it shows me no error but when i run flash window on last poster it shows
TypeError: Error #1010: A term is undefined and has no properties.
at slider_fla::MainTimeline/nextClick()
here code:
var sliderNum:int = 0;
var sliderMaxNum:int = 0;
function nextClick(event:MouseEvent):void
{
if (sliderNum > sliderMaxNum){
sliderNum = 0;
}
var myTween:Tween = new Tween(poster[sliderNum],'x',Strong.easeOut,poster[sliderNum].x,-800,2,true);
if (sliderNum == sliderMaxNum){
trace(String(sliderNum));
trace(String(sliderMaxNum));
sliderNum = 0;
} else {
sliderNum = sliderNum +1;
}
var myTween2:Tween = new Tween(poster[sliderNum],'x',Strong.easeOut,poster[sliderNum].x,(myStage.stageWidth - 640)/2,2,true);
}
i use this code to load XML:
function loadXML(event:Event):void{
sliderXML=XML(sliderXMLloader.data);
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = true;
var menuXML:XML = XML(sliderXMLloader.data);
xmlDoc.parseXML(menuXML.toXMLString());
//var X:int = 100;
for each(var listItem:XML in sliderXML..listItem){
strTitle[sliderMaxNum] = listItem.itemTitle.toString();
strPosterLink[sliderMaxNum] = listItem.posterLink.toString();
strVideoLink[sliderMaxNum] = listItem.videoLink.toString();
var _temp:Loader = new Loader();
poster.splice(sliderMaxNum, 0, _temp);
poster[sliderMaxNum].load(new URLRequest(strPosterLink[sliderMaxNum]));
//var posterClip:MovieClip = new MovieClip(); //load the movieclip
//posterClip.addChild(poster[sliderMaxNum]); //convert poster[sliderMaxNum] to movieClip
addChild(poster[sliderMaxNum]);
poster[sliderMaxNum].x = myStage.stageWidth;
poster[sliderMaxNum].y = 28;
poster[sliderMaxNum].addEventListener(MouseEvent.CLICK, poster_click(sliderMaxNum));
sliderMaxNum = sliderMaxNum+1;
}
LastSliderNum = sliderMaxNum - 1;
//*************************************************
var myTween:Tween = new Tween(poster[sliderNum],'x',Strong.easeOut,poster[sliderNum].x,(myStage.stageWidth - 640)/2,2,true);
//*************************************************
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是完整的代码:
我只是将其最小化,只留下我认为可能有问题的代码
this is a full code:
i just minimized it and left only the code where i think could be a problem