The framework's Application class has no 'container' property, and I get a runtime error when I try to access it:
ReferenceError: Error #1069: Property container not found on ApplicationContainerTest and there is no default value. You must have defined it in your app. -Gordon Smith Adobe Flex SDK Team ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Thursday, December 06, 2007 1:11 PM To: [email protected] Subject: RE: [flexcoders] Application.application.container? Thanks. No, and in fact I can trace out a value it's typeof object and has an internal name same as my app. I was told by someone on this list a while back to do it that way. Jason Merrill Bank of America L&LD GT&O eTools & Multimedia Research & Development ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Thursday, December 06, 2007 4:03 PM To: [email protected] Subject: RE: [flexcoders] Application.application.container? Didn't you get an exception accessing application.container? I don't think we have such a property. You can draw on the graphics layer of any UIComponent, but it may be obscured by children. You should just be able to pass in Spite(Application.application) ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Thursday, December 06, 2007 11:30 AM To: [email protected] Subject: [flexcoders] Application.application.container? OK - not understanding something here. Application.application.container? I'm trying to figure out the base UI class I can add sprite children to. I have a class which draws objects, and I want those objects to be drawn in my flex app. So here is the simplified version of the code below. The thing I don't get is if I leave in "_container = Application.application.container;" then the constructor in my class does not run, but if I take it out, it runs. ?!? Is Application.application.container the correct way to reference the base UI object you can start adding Sprites to and then draw on with Actionscript? <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute" applicationComplete="init()"> <mx:Script> <![CDATA[ import src.MyClass; import mx.core.UIComponent; private var _myClass:MyClass; private var _container:UIComponent; private function init():void { _container = Application.application.container; _myClass = new MyClass(_container); } ]]> </mx:Script> </mx:Application> The MyClass.as file is: package src { import mx.core.UIComponent; import mx.core.Application; public class MyClass { private var _container:UIComponent; private var _circle:Sprite; public function MyClass(container:UIComponent) { trace("constructor runs") _container = container; drawGraphics(); } private function drawCircle():void { _circle.graphics.drawCircle(100, 100, 100); _container.addChild(_circle); } } } Any ideas as to what is going on? How do you handle getting to the base UI class to draw objects with Actionscript? Thank you. Jason Merrill Bank of America L&LD GT&O eTools & Multimedia Research & Development

