2012-09-28 3 views
0

나는MXML Null 참조

<?xml version="1.0" encoding="utf-8"?> 
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"> 
    <mx:RadioButton id="radio" /> 
    <mx:Script> 
     public override function set label(value:String):void { 
      this.radio.label = value; 
     } 
     public override function get label():String { 
      return this.radio.label; 
     } 
    </mx:Script> 
</mx:VBox> 

CustomRadio 예를 들어 사용자 정의 MXML 구성 요소 및 응용 프로그램

<?xml version="1.0" encoding="utf-8"?> 
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*"> 
    <local:CustomRadio label="xxx" /> 
</mx:WindowedApplication> 

을하고 난 this.radio가 null의 말을 세트 라벨에 널 참조 arror를 얻을. 왜 ?

답변

0

RadioButton 태그는 Script 태그를 포함해야합니다. 이제 스크립트 태그는 VBox에만 포함됩니다. 'this'포인터를 사용하고 있기 때문에 VBox를 참조하고 있습니다.

+0

아니요. 작동하지 않습니다 : ( –

+0

값이 사용되기 전에 'set'함수에 중단 점을 설정하면 (여기에 추적 또는 유사한 것을 넣음) - 'this'포인터에 정의 된 라디오 버튼의 일부입니까? – ethrbunny

+0

시도하십시오 this : http://cookbooks.adobe.com/post_Button_with_html_text-14186.html -> 'this'대신 'super'가 필요합니다. – ethrbunny