개발/FLEX & AIR

[FLEX] Flex 상에서 stage가 null 일경우

내가지니 2010. 8. 20. 10:08

Flex 상에서 stage를 호출할 경우 null로 인식이 되어 속성을 찾지 못하는 경우는 현재 객체가 stage에 addChild 되어 있지 않은 경우이므로 addChild(객체)로 하신 후에 인식이 값을 가져와야 한다.

public function Sample()
{
addEventListener(Event.ADDED_TO_STAGE, init);



public function init(e:Event=null)
{
   //to do
    //trace(stage.width);
}