I am working on a component that attaches a movieclip. When I drag it to the stage it attaches multiple copies of this movieclip skipping my checks and balances. But when I test the movie it works fine and only shows one instance like i designed it to. Is there anyway to find out in my component class file if the instance is on the stage or in a test movie?

class myComponent extends TextInput {

  // constructor
  function myComponent() {

  }

  function init() {
     if ("onTheStage") {
        // exit out and do not attach movie
     }
     else {
        // attach movie
         styleRequired()
      }

  }

   // style the text box when the value is valid
   function styleRequired() {
       trace("style required")
required_mc = _parent.attachMovie("required_mc",this+"_required", this._parent.getNextHighestDepth());
       if (required) {
           trace("required="+required)
           if (requiredAlign=="left") {
               required_mc._x = _x - required_mc._width;
               required_mc._y = _y;
           }
           else {
               required_mc._x = _x + __width;
               required_mc._y = _y;
           }
       }
       else {
           required_mc._visible = false;
       }
   }
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to