A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: wind farm

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    1

    wind farm

    hi,

    on clicking start wing should move n with the stop button wind should stop.

    wind should circular fashion.
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    Move the enterFrame listener into the start and stop functions. You were adding the listener as soon as the program started, you'll want to add it only when you want to play, and remove it when you want it to stop.

    Code:
    function start_play(e:MouseEvent)
    {
    	arm.gotoAndPlay(2);
    	arm.addEventListener(Event.ENTER_FRAME, rotatearm);
    }
    
    start_btn.addEventListener(MouseEvent.CLICK,start_play);
    
    function stop_play(e:MouseEvent)
    {
    	arm.gotoAndPlay(2);
    	arm.removeEventListener(Event.ENTER_FRAME, rotatearm);
    }
    stop_btn.addEventListener(MouseEvent.CLICK,stop_play);
    
    
    
    function rotatearm(e:Event):void{
    	
    	arm.rotation += 1}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center