Try adding this to your fla
addChild(hw);
In your HelloWorld class you've added your textField inside but since you
have added you HelloWorld() object to the display list of the movie it
will never get drawn.
I have a question back at you along this example. I'm running on windows
and if I set up my project that I have
my.fla
[MyPackage]
MyPackage.as (with the HelloWorld class)
using the code in the fla I never get HelloWorld to properly initiate.
Instead I get an error
**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 :
[Compiler] Error #1046: Type was not found or was not a compile-time
constant: HelloWorld.
var hw:HelloWorld = new HelloWorld();
if I change the name of the .as file to
HelloWorld.as
then all works fine
any insights why yours can run as MyPackage.as?
Rob
On Thu, 22 Mar 2007 09:08:45 -0400, Merrill, Jason
<[EMAIL PROTECTED]> wrote:
//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...)
_______________________________________________
[email protected]
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