3 Replies Latest reply on Jun 21, 2007 10:05 PM by kglad

    AS3 - MovieClip.onLoad

      In Flash 8 you could assign a MovieClip to a class and then define an onLoad() function where you could access the inner movieclips within that movieclip. I can't find the new way of doing this in AS3

      Just having an onLoad function defined in the class gives a migration warning to use addEventListener('load', onLoad) but this doesn't work. I have tried addEventListener(Event.ADDED, loadHandler) but my inner movieclips are still null at that point.

      Any ideas? I haven't found anything on the web as it is too difficult to search for something that specific

        • 1. Re: AS3 - MovieClip.onLoad
          kglad Adobe Community Professional & MVP
          read about the Loader class if you want to load an image or swf. read about the URLLoader class if you want to load text, xml or binary data.
          • 2. Re: AS3 - MovieClip.onLoad
            c-dogg Level 1
            I am not talking about loading external images or swfs.

            The class (which is a movieclip) needs an event letting you know that itself it ready to go and you can access inner movieclips.

            So if you have a FLA that has a Circle symbol, you go to its linkage and specify a class. Within that class, how do you detect when the movieclip is loaded? In AS2 you could have:
            function onLoad()
            //access inner movieclips here
            • 3. Re: AS3 - MovieClip.onLoad
              kglad Adobe Community Professional & MVP
              the RENDER event is the time just before all objects on-stage are about to be rendered. items in the first frame of movieclips are available when the RENDER event executes.

              p.s. you must use stage.invalidate() to use the event.RENDER event.