应该怎么做才能让125输出?

import flash.events.KeyboardEvent;
import flash.display.MovieClip;

stop();

var zhanzi:MovieClip;
var mc:MovieClip = new dasheti;

stage.addEventListener(KeyboardEvent.KEY_DOWN, dasheti1);

function dasheti1(e:KeyboardEvent):void
{
if(e.keyCode == 85)this.removeChild(zhanzi)
if(e.keyCode == 85)this.addChild(mc)
mc.x = zhanzi.x + 100;
mc.y = zhanzi.y
mc.height = zhanzi.height;
mc.width = zhanzi.width;
if(mc.currentFrame == 64)trace("125")
}
现在的问题是,当我按了U键播放完了mc,而最后的trace(125)输不出来?

暮色呼如
浏览 173回答 3
3回答

阿晨1998

import flash.events.KeyboardEvent;import flash.display.MovieClip;stop();var zhanzi:MovieClip;var mc:MovieClip = new dasheti;stage.addEventListener(KeyboardEvent.KEY_DOWN, dasheti1);function dasheti1(e:KeyboardEvent):void{if(e.keyCode == 85)this.removeChild(zhanzi)if(e.keyCode == 85)this.addChild(mc)mc.x = zhanzi.x + 100;mc.y = zhanzi.ymc.height = zhanzi.height;mc.width = zhanzi.width;mc.addEventListener(Event.ENTER_FRAME,refresh);//在mc播放的时候添加逐帧的监听}function refresh(e:Event):void{if (mc.currentFrame == 64){trace("125");}} 

蝴蝶不菲

在第64帧上添加动作trace即可或是把判断写在轮询事件响应函数中都行

天涯尽头无女友

提供教科书,if 语句检查该语句括号中的值或表达式。如果值为 true,则执行大括号中的代码行;否则,将忽略它们。if (age < 20){trace("显示针对青少年的特殊内容")}
打开App,查看更多内容
随时随地看视频慕课网APP