Hi,

Do additional addChild(hw) in your .fla file. Also, the
DisplayObjectContainer isn't needed.

Cheers,
Petro

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Merrill, Jason
> Sent: Thursday, March 22, 2007 3:09 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
> 
> Getting my feet wet with AS3, I just bought the AS3 cookbook and have
> learned a lot already - great book.  I feel like an idiot asking this
as
> I'm pretty good in AS2, but with AS3, I'm not getting a simple script
> working. I have the Flash 9 AS3 preview, trying to write a simple
> HelloWorld class (based on an example in the book) to show a
TextField:
> 
> //MyPackage.as
> package MyPackage
> {
>       //do I actually need this one?:
>       import flash.display.DisplayObjectContainer;
> 
>       import flash.display.Sprite;
>       import flash.text.TextField;
> 
>       public class HelloWorld extends Sprite
>       {
>               public function HelloWorld()
>               {
>                       var message_txt:TextField = new TextField();
>                       message_txt.text = "Hello World";
>                       addChild(message_txt);  //does not show!
>                       trace("constructor runs")//traces fine
>               }
>       }
> }
> 
> Then in the .fla, I put:
> 
> import MyPackage.*
> var hw:HelloWorld = new HelloWorld();
> 
> The constructor traces fine in the output window, but the TextField
does
> not show.  What have I done wrong?  My Export settings in F9 As3
preview
> are for AS 3.0 and FP9.  In later scripts, I tried moving the
textfield,
> changing the color, changing the stage color to be sure it wasn't
> matching the textfield and this invisible, etc...(but it should show
as
> black Times New Roman text by default anyway...)
> 
> Thanks,
> 
> Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax
set
> to AS3, but have notices code hinting doesn't always work or is
> sometimes incomplete - has anyone else noticed that?  Maybe I just
need
> to update it.
> 
> Jason Merrill
> Bank of America
> GT&O Learning & Leadership Development
> eTools & Multimedia Team
> 
> 
> 
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to