Try this maybe:

package {
        import flash.util.trace;
        import flash.display.Sprite;

        public class MXController extends Sprite {
                public function MXController () {
                        var f:AppTest = new AppTest();
                        f.addEventListener ("creationComplete",
creationComplete);
                        //addChild (f); <-- do this
                }
                protected function creationComplete (event:Event):Void {
                        event.target.txt_input.text = "bar";
                }
        }
}

Another method would be to extend AppTest rather than making it a child of
MXController; not sure what the purpose of MXController is so this might not
even help, but I'll post it anyway:

package {
        import flash.util.trace;

        public class MXController extends AppTest {
                public function MXController () {
                        addEventListener ("creationComplete",
creationComplete);
                }
                protected function creationComplete (event:Event):Void {
                        txt_input.text = "bar";
                }
        }
}

// <MXController />

I haven't actually tested these...

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tiago Vale
Sent: Thursday, October 20, 2005 9:32 AM
To: Flashcoders mailing list
Subject: [Flashcoders] AS3 and mxml

Hi List,


Heres what Im trying to do.

AppTest.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"; xmlns="*"
currentState="Init" >
<mx:Canvas width="100%" height="588" id="form1" label="form1"
themeColor="haloSilver">
<mx:TextArea x="85" y="94" id="txt_input" editable="true" text="foo"/>
</mx:Canvas>
</mx:Application>

MXController .as

package {
import flash.util.trace;
import AppTest;
import flash.display.Sprite;

public class MXController extends Sprite{
public function MXController ()
{
var f:AppTest = new AppTest();
f.txt_input.text = "bar";
}
}
}




TypeError: Error #1009: null has no properties.
at MXController$iinit()



Is there any other way to do this?


--
Cheers Tiago Janz
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to