4 Replies Latest reply on May 15, 2007 10:30 AM by Newsgroup_User

    Calling Movieclips

    romked
      This is an AS3 question:

      I have a movieclip on that starts on frame 2.

      I have code like this:

      target.gotoAndStop(2);

      trace(target.child) //get null

      but if I put that same trace statement on frame to it returns a movieclip.

      Now my understanding is that Flash renders the code then process the frame so that's why it returns null in the AS and returns something when I am calling it on the timeline.

      So my question is that how can I call the movieclip in actionscript without having to write any methods in the timeline?


      Hope I explained this good.
        • 1. Re: Calling Movieclips
          kglad Adobe Community Professional & MVP
          i sure didn't understand what you're doing.
          • 2. Calling Movieclips
            romked Level 1
            Ok. Let me try this again. I have a class file with the following code:

            evtObj.gotoAndStop("introDecode");
            trace("evtObj.decoder_mc: "+evtObj.decoder_mc);

            evtObj being the main stage, decoder_mc being an object on the stage that is created at the framelable "introDecode".

            In AS 2.0 when I try trace the object it returns the object back, but in AS 3.0 when I trace it, it returns null.

            Make sense? Sorry for being sounding so confused, but I have been at it for a few hours. Thank for you help.
            • 3. Re: Calling Movieclips
              kglad Adobe Community Professional & MVP
              that makes sense.

              use an onEnterFrame handler or some other timer that executes after the playhead moves to introDecode and your movieclip is instantiated. (and then terminate the handler or timer.)
              • 4. Re: Calling Movieclips
                Level 7
                see:
                http://www.kirupa.com/forum/showthread.php?p=2113726#post2113726


                "romkeedehaan" <webforumsuser@macromedia.com> wrote in message
                news:f2cncs$mtm$1@forums.macromedia.com...
                > This is an AS3 question:
                >
                > I have a movieclip on that starts on frame 2.
                >
                > I have code like this:
                >
                > target.gotoAndStop(2);
                >
                > trace(target.child) //get null
                >
                > but if I put that same trace statement on frame to it returns a movieclip.
                >
                > Now my understanding is that Flash renders the code then process the frame
                > so
                > that's why it returns null in the AS and returns something when I am
                > calling it
                > on the timeline.
                >
                > So my question is that how can I call the movieclip in actionscript
                > without
                > having to write any methods in the timeline?
                >
                >
                > Hope I explained this good.
                >
                >