Shouldn't be required, but ok
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Wednesday, September 19, 2007 2:44 PM To: [email protected] Subject: RE: [flexcoders] Actionscript sprite within the Flex framework wait -thanks guys - changing to extends UICOmponent instead seems to have fixed it: //App: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute" applicationComplete="EntryClass.main()"> <mx:UIComponent id="host" /> </mx:Application> //ActionScript file Entry Class: package { import mx.core.Application; import mx.core.UIComponent; public class EntryClass { public static function main():void { var testSprite:TestSprite = new TestSprite(12, 100, 100); var host:UIComponent = Application.application.host; host.addChild(testSprite); } } } // ActionScript file TestSprite: package { import flash.display.Sprite; import mx.core.UIComponent; public class TestSprite extends UIComponent { private var _x:int; private var _y:int; private var _radii:int public function TestSprite(size:int, posx:int, posy:int) { x = posx; y = posy; _radii = size; graphics.lineStyle(1, 0xFFCC33); graphics.beginFill(0xCC3300, 1); graphics.drawCircle(0, 0, _radii); graphics.endFill(); } } } Jason Merrill Bank of America GT&O Learning & Leadership Development eTools & Multimedia Team ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Wednesday, September 19, 2007 4:53 PM To: [email protected] Subject: RE: [flexcoders] Actionscript sprite within the Flex framework Shouldn't be, appcomplete is way late, long after host is ready. Can I see what your code looks like now? Both the app and the TestSprite. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Wednesday, September 19, 2007 1:36 PM To: [email protected] Subject: RE: [flexcoders] Actionscript sprite within the Flex framework Alex, thanks, but changing to your code suggestion, I still get an error, Main Thread (Suspended: ReferenceError: Error #1069: Property host not found on MyTestApplication and there is no default value.) and I think it is because EntryClass.main() gets called on the event applicationComplete, so the id for the UICompoenent does not exist yet, since it is further down the MXML. Chicken and egg thing, and not sure how to fix? Jason Merrill Bank of America GT&O Learning & Leadership Development eTools & Multimedia Team

