Wow..
On Mon, Mar 17, 2008 at 5:08 PM, Merrill, Jason <
[EMAIL PROTECTED]> wrote:
>
> Try this instead, this is how I would do it (you have a few screwy
> things in the code you posted, too many to bother commenting on :) ):
>
>
> package
> {
>
> import flash.display.MovieClip
> import flash.text.*;
>
> public class DataCard extends MovieClip
> {
> public function set name(value:String):void
> {
> theTextField.text = value;
> }
> }
> }
>
> And in the .fla with the clip's class set to DataCard:
>
> var dc:DataCard = new DataCard();
> dc.name = "Hello";
>
>
>
> Jason Merrill
> Bank of America
> GT&O L&LD Solutions Design & Development
> eTools & Multimedia
>
> Bank of America Flash Platform Developer Community
>
>
> Are you a Bank of America associate interested in innovative learning
> ideas and technologies?
> Check out our internal GT&O Innovative Learning Blog & subscribe.
>
>
>
>
>
>
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] On Behalf
> >>Of Omar Fouad
> >>Sent: Sunday, March 16, 2008 9:24 AM
> >>To: Flash Coders List
> >>Subject: [Flashcoders] Writing Custom MovieClip Classes
> >>
> >>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
> >>[email protected]
> >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> 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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders