4 Replies Latest reply on Apr 25, 2006 12:56 AM by Peter Lorent

    createClassObject 's problem! help!

    Emicky Level 1
      Flash 8.
      write a class extends MovieClip:
      ///
      import mx.core.UIObject;
      import mx.controls.RadioButton;
      import mx.controls.RadioButtonGroup;
      class myMc extends MovieClip
      {
      ...
      createClassObject("RadioButton"...)
      ...
      }
      ///
      it reports an error said: it has no such method named createClassObject.


      why? how to solve it? thank you!
        • 1. Re: createClassObject 's problem! help!
          Emicky Level 1
          but if i add a EmptyMovieClip,like:
          //
          import mx.core.UIObject;
          import mx.controls.RadioButton;
          import mx.controls.RadioButtonGroup;
          class myMc extends MovieClip
          {
          ...
          var myMc:MovieClip = this.createEmptyMovieClip("container",this.getNextHighestDepth());
          myMc.createClassObject(...)
          ...
          }
          //
          so it has NO error!
          why? my class named myMc is extended from MovieClip,why can NOT use createClassObject???
          • 2. Re: createClassObject 's problem! help!
            Peter Lorent Level 2
            >>my class named myMc is extended from MovieClip,why can NOT use createClassObject???
            Is createClassObject a method of the MovieClip Class? No. Which the error reports to you:
            >>it reports an error said: it has no such method named createClassObject.
            createClassObject is a method of the UIObject Class. So, with your syntax your class must extend the UIObject Class.
            • 3. Re: createClassObject 's problem! help!
              Emicky Level 1
              yeah, the createClassObject is NOT a mothod of MovieClip. but why i can use:
              //
              var myMc:MovieClip = this.createEmptyMovieClip("container",this.getNextHighestDepth());
              myMc.createClassObject(...)
              //
              it's right!
              • 4. Re: createClassObject 's problem! help!
                Peter Lorent Level 2
                The MovieClip Class is dynamic and the createClassObject method is added at runtime by the V2 component architecture.
                So, either you extend UIObject and use:
                createClassObject("RadioButton"...)
                or you extend MovieClip and use:
                var myMc:MovieClip = this.createEmptyMovieClip("container",this.getNextHighestDepth());
                myMc.createClassObject(...)