Playing sounds on Actionscript

后端 未结 2 654
伪装坚强ぢ
伪装坚强ぢ 2021-01-26 00:38

I have a simple drag and drop game started in flash and mostly working.

I have added my animals and you can drag and drop them in the right place.I have also added sound

2条回答
  •  孤街浪徒
    2021-01-26 01:25

    Look at your MouseUp event handlers.

    You are adding the event listener to the stage. So they are all getting called whenever the stage hears a mouse up event.

    Add those listeners to the cow, pig etc just as you did for the mouse down listeners.

    That should solve it.

    Pig.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    
      function fl_ClickToDrag(event:MouseEvent):void
      {
      Pig.startDrag();
       }
    
     //stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
      // change to this
     Pig.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    

提交回复
热议问题