滚动文本字段帮助 as3
scrolling text field help as3
当前收到舞台下的文字,我想上台并停在舞台上的某个位置 (97, 233.10)。我对在哪里停止它以及使用什么代码有点困惑?
addEventListener(Event.ENTER_FRAME, mcInfo);
function mcInfo (e:Event):void {
//check position of logo
//if inside the stage move left to right
//if outside stage reposition
if (info.x<stage.stageWidth) {
info.x+=30;
stop();
} else {
//reset position
info.x=-450;
}
}
干杯!
当我滚动浏览其余页面时,Flash 现在似乎返回输出错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finaldesign_fla::MainTimeline/mcInfo()
确保信息在舞台上并尝试添加:
if(info != null && stage != null)
在if语句中,我们检查对象是否超出了目标位置,如果超出则停止循环。否则继续增加对象的位置。
targetPosition = {x:97, y:233.10};
addEventListener(Event.ENTER_FRAME, mcInfo);
function mcInfo(e:Event) {
if (info.x >= targetPosition.x) {
info.x = targetPosition.x;
removeEventListener(Event.ENTER_FRAME, mcInfo);
} else {
info.x += 30;
}
}
当前收到舞台下的文字,我想上台并停在舞台上的某个位置 (97, 233.10)。我对在哪里停止它以及使用什么代码有点困惑?
addEventListener(Event.ENTER_FRAME, mcInfo);
function mcInfo (e:Event):void {
//check position of logo
//if inside the stage move left to right
//if outside stage reposition
if (info.x<stage.stageWidth) {
info.x+=30;
stop();
} else {
//reset position
info.x=-450;
}
}
干杯!
当我滚动浏览其余页面时,Flash 现在似乎返回输出错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finaldesign_fla::MainTimeline/mcInfo()
确保信息在舞台上并尝试添加:
if(info != null && stage != null)
在if语句中,我们检查对象是否超出了目标位置,如果超出则停止循环。否则继续增加对象的位置。
targetPosition = {x:97, y:233.10};
addEventListener(Event.ENTER_FRAME, mcInfo);
function mcInfo(e:Event) {
if (info.x >= targetPosition.x) {
info.x = targetPosition.x;
removeEventListener(Event.ENTER_FRAME, mcInfo);
} else {
info.x += 30;
}
}