NameTF is the name of the textField in the MovieClip in FLA On Sun, Mar 16, 2008 at 9:42 PM, Steven Sacks <[EMAIL PROTECTED]> wrote:
> What is nameTF? I don't see it declared in your class. If you are > using "Automatically declare stage instances", turn it off. Adobe put > it in there specifically for newbies to code, it's not meant for proper > developers to use. > > Keep in mind you need to declare your stage instances as public vars. > > You cannot make the constructor of a class a static function. > > Setting card name has no effect on the value of the text field in your > code. I recommend using a more generic naming convention anyway. > > package > { > import flash.display.*; > import flash.text.*; > > public class DataCard extends MovieClip > { > public var TXT_Name:TextField; > > public function DataCard() > { > super(); > } > public function set label(value:String):void > { > TXT_Name.text = value; > } > } > > > > > > Omar Fouad wrote: > > 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. > > > > > > > > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- 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