FLASH中怎么制作用按钮控制一个动画的播放/暂停

如题所述

import flash.display.Sprite;
import flash.events.Event;
stop();
var isPlay:Boolean;
var sp:Sprite = new Sprite ;
sp.graphics.beginFill(0xff0000,1);
sp.graphics.drawRect(100,100,80,30);
sp.graphics.endFill();
addChild(sp);
sp.buttonMode = true;

sp.addEventListener(MouseEvent.MOUSE_DOWN,pressed);
function pressed(e:Event ):void
{
if (!isPlay)
{
trace("play now!");
isPlay = true;
//mc.play()
//this.play ()
}
else
{
trace("stop now!");
isPlay=false
//this.gotoAndStop(this.currentFrame )
//trace("frame:",this.currentFrame )
}

}
温馨提示:内容为网友见解,仅供参考
第1个回答  2016-12-22
相似回答
大家正在搜