【问题标题】:looking for button commands for actionscript 3.0寻找 actionscript 3.0 的按钮命令
【发布时间】:2011-08-15 12:51:17
【问题描述】:

我是 actionscript 3.0 的新手,目前正在做一个 flash 演示。除了按钮之外都完成了,我不知道如何使用actionscript 3.0。我有很多按钮,但我需要的只是使按钮(单击时)转到另一个场景并重播它所在的场景的命令。

谢谢

【问题讨论】:

  • @user729786 你使用的是文档类还是时间线?

标签: flash actionscript button flash-cs5


【解决方案1】:

如果你在舞台上有一个按钮,比如说button0,那么:

button0.addEventListener("click", button0Clicked);

function button0Clicked(evt:*):void
{
     //do whatever you want to do here
}

还有一些其他事件,只需将点击更改为mouseDownmouseUpdoubleClickmouseOvermouseOut。我认为这些类型不言自明。

如果你使用双击,你必须将doubleClickEnabled设置为true

button0.doubleClickEnabled = true;

知道也很有用:

button0.buttonMode = true;
button0.useHandCursor = true;

如果 button0 不是 Button 实例,而是 MovieClip 实例,并且您希望鼠标悬停在按钮上时变成“手”。

我希望这可以帮助你更接近你的目标。

【讨论】:

    【解决方案2】:
     import flash.events.MouseEvent;
     //use stop in the begin to avoid the repeat frames again
     stop();
    
    //here i have play button is play_mc if it click then it goes to the 
     function GameStart
    
    mc.play_mc.addEventListener(MouseEvent.CLICK, GameStart);
    mc.play_mc.useHandCursor = true;
    mc.play_mc.buttonMode = true;
    
    function GameStart(event:MouseEvent):void
    {
     //gotoAndPlay by using to go to the frame Gameplay is the frame name it 
       goes to that frame
    
       gotoAndPlay("GamePlay");
    }
    

    如果你想了解更多,去这里学习http://www.adobe.com/devnet/flash/articles/accessible_animated_preso.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-13
      • 2014-04-03
      • 1970-01-01
      • 1970-01-01
      • 2013-09-08
      • 2014-05-19
      相关资源
      最近更新 更多