I have a MovieClip in my project that I put in the library. This MovieClip
is used in the application lots of times and I "attach" it on the stage on
run time when required like

var DC:DataCard = new DataCard();
DC.x = Math.random()*550;
DC.y = Math.random()*400;
addChild(DC);

In the Identifier Dialogue Box I set the Class name to DataCard and I am
trying to associate it to a Class file DataCard.as
This MovieClip has a text field for example, and it is named "nameTF".
I want to be able to control the components of the DataCard MovieClip from
the Class Itself, in this case to change the text in the nameTF TextField.

So in the Class I worte:

package {
 import flash.display.MovieClip

 import flash.display.MovieClip;
 import flash.text.*;

 public class DataCard extends MovieClip {

  var cardName:String;

  static public function DataCard():void {
   nameTF.text = cardName;
  }
  public function set cardName(Name:String):void {
   cardName = Name;
  }
 }
}

It shows me many errors and it does not work.

when I tried:

public class DataCard extends MovieClip {

  public function CardName(CN:String):void {
   nameTF.text = CN;
  }
}

and in the FLA:

 var DC:DataCard = new DataCard();

DC.CardName("here is the name");

DC.x = Math.random()*550;
DC.y = Math.random()*400;
DC.name = "dataCard";
addChild(DC);

this worked. But how can I use a Constructor, setters and getters in this
case? Also how can I set the name of the MovieClip like I would do in the
FLA DC.name = "DCName"; in the class itself?


Thanks for the Help.



-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to