0 Replies Latest reply on Sep 5, 2009 6:27 AM by prajeeshmp86

    createClassObject is retun null value while using this method to draw dynamic button to the stage

    prajeeshmp86

      Hi

      I am new to ActionScript world

       

      I am using AS2 .I want to draw a dynamic button uisng createClassObject method.I have used  seaparte code for Button drawing .

       

      In the below code snippet I called  createClassObject method :

       

       

      function makeButton(_label, _w, _h, _fn)

          {

       

      trace("called make button");

              var __reg2 = new Object();

              __reg2.label = _label;

              __reg2._width = _w;

              __reg2._height = _h;

              __reg2._x = this.width / 2 - _w / 2;

              __reg2._y = this.height / 2 - _h / 2;

              __reg2._alpha = 0;

       

              this.launch_button = this.mc.createClassObject(controls.PixtorieButton, "launch_button", this.mc.getNextHighestDepth(), __reg2);

       

       

              this.launch_button.personalization = this;

              this.launch_button.addEventListener("click", mx.utils.Delegate.create(this, _fn));

       

              if (this.launch_button.personalization.textRotation != 0 && this.launch_button.personalization.textRotation != undefined)

              {

                  this.rotateButton(this.launch_button.personalization.textRotation);

              }

              var __reg3 = new mx.transitions.Tween(this.launch_button, "_alpha", mx.transitions.easing.Strong.easeOut,0, 100, 20, false);

       

       

          }

       

       

      When  I debug the code I found that in  createClassObject ( )  method  calling attachMovie( ) function and passed my button class as the classname  .But problem is that attachMovie didn't get the refernce to my button action script class.

       

      Also I have insert a symbol in the library of my working  fla, which was registered to my button actionscript class(controls.PixtorieButton) using Object.registerClass( ) method.

       

       

      I have get null value return after calling createClassObject ( ) method with the parametrs above specified.