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"
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