A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: swap depth only once? (noob)

  1. #1
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439

    swap depth only once? (noob)

    Hi,

    addEventListener(Event.ENTER_FRAME,myFunction);

    function myFunction(event:Event) {
    swapChildren(button, button2);
    }

    When I publish it keeps swapping over and over.
    How can I get it to call only once?

    Any help is much appreciated!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Code:
    addEventListener(Event.ENTER_FRAME,myFunction);
    
    function myFunction(event:Event) {
      swapChildren(button, button2);
      removeEventListener(Event.ENTER_FRAME, myFunction);
    }

    But why make it an enter frame listener in the first place if you only want it to happen once?

  3. #3
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Cheers thanks

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