
Код AS3:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
initialize="AppInit(event);">
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.events.FlexEvent;
private var t1 :UIComponent = new UIComponent();
private function OnMouseDown( event :MouseEvent):void{
var UIC :UIComponent = UIComponent(event.target);
trace("x = "+UIC.x ); //x = 50
trace("y = "+UIC.y ); //y = 50
trace("width = "+UIC.width ); //width = 0
trace("height = "+UIC.height ); //height = 0
}
private function AppInit( event :FlexEvent ):void{
t1.graphics.lineStyle( 1, 0x000000 );
t1.graphics.beginFill( 0xee0000 );
t1.graphics.drawRect( 0, 0, 50, 50 );
t1.graphics.endFill();
t1.x = 50;
t1.y = 50;
t1.addEventListener( MouseEvent.MOUSE_DOWN, OnMouseDown );
addElement( t1 );
}
]]>
</fx:Script>
</s:Application>
Почему ширина и высота = 0 ?

Код AS3:
trace("width = "+UIC.width ); //width = 0
trace("height = "+UIC.height ); //height = 0
Как нибудь можно сделать так, чтобы у рисованных объектов ( Sprite, SpriteVisualElement, GraphicElement, и т.д.) была высота и ширина ?