2 Replies Latest reply on Oct 18, 2008 10:28 PM by sknygrydg07

    Basic onEnterFrame question

    sknygrydg07
      I'm creating a project, and testing out how do certain things simply before I put them in the real project.

      Attached is code to click btn01, which attaches circleCopy to the stage, then circleCopy is automatically supposed to move from left to right indefinitely.

      The circleCopy attaches, but doesn't move. This code is as simple as I can get it - what am I missing?
        • 1. Re: Basic onEnterFrame question
          Rothrock Level 5
          The problem is the order of execution.

          When flash enters the frame with this code it say, "Okay I know what to do when btn01 is clicked. Oh, and I should attach an onEnterFrame handler to to ballCopy."

          The problem is that at the time you enter the frame there is no such thing as ballCopy. So that second half is just ignored by Flash.

          So you need to wait until ballCopy is attached before you try and assign things to it. The easiest way to do that would be to put the declaration of your onEnterFrame inside of the onRelease handler.
          • 2. Re: Basic onEnterFrame question
            sknygrydg07 Level 1
            Thank you. I thought I had tried that at the vary start, but I think I had a typo, which caused it to not work. Then I tried to change the order, and at that point corrected the typo, not realizing that it was they typo that threw it off in the first place.

            Anyway - thank you for your help.