2012-11-20 8 views
1

콜 아웃을 사용하여 이름을 바꿀 수 있습니다. 설명 선에는 바인딩을 통해 채워지는 textInput (구성 요소에 포함)이 있습니다. 설명 선은 매번 다른 텍스트로 열립니다. 불행히도 바인딩 데이터에 쓸 수있는 모든 텍스트가 매번 첫 번째 텍스트 만 표시됩니다. 샘플을 첨부했습니다.콜 아웃에서 여러 번 사용하면 textInput에 대한 Flex4.6 모바일 바인딩이 작동하지 않습니다.

콜 아웃이 닫히고 콜 아웃으로 다시 연결되면 구성 요소가 연결되어 볼 때 textinput이 올바르게 업데이트됩니다.

도움이 될 것입니다.

<?xml version="1.0" encoding="utf-8"?> 
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" title="TestChgCallout2" 
creationComplete="init()" 
> 

<fx:Declarations> 
    <s:Callout id="COrename"/> 
    <fx:Component className="Rename"> 
     <s:VGroup>   
      <fx:Metadata> 
       [Event(name="cancel", type="flash.events.Event")] 
       [Event(name="updated", type="flash.events.Event")] 
      </fx:Metadata> 

      <fx:Script> 
      <![CDATA[ 
       [Bindable] private var _nom:String=""; 
       private var _NewName:String=""; 

       public function set nom(s:String):void { 
        _nom=s; 
        _NewName=""; 
       } 

       public function get nom():String { 
        return _NewName; 
       } 

       private function doUpd():void { 
        var req:XML=<req><oldName></oldName><newName></newName></req>; 
        req.oldName = _nom; 
        req.newName = Nom.text; 
        _NewName=Nom.text; 
        this.dispatchEvent(new Event('updated')) 
       } 
      ]]> 
      </fx:Script> 


      <s:HGroup verticalAlign="middle"> 
       <s:Label width="90" text="Nom" verticalAlign="middle"/> 
       <s:TextInput id="Nom" text="{_nom}" width="201" maxChars="23" restrict="a-z A-Z0-9" /> 
      </s:HGroup> 
      <s:HGroup width="100%" verticalAlign="middle" horizontalAlign="center"> 
       <s:Button label="cancel" click="this.dispatchEvent(new Event('cancel'))"/> 
     <s:Button label="update" click="doUpd()"/> 
      </s:HGroup> 
     </s:VGroup> 
    </fx:Component> 
</fx:Declarations> 


<s:HGroup gap="5"> 
    <s:VGroup> 
    <s:Label text="{'Count:' + i.toString()}" /> 
    <s:Label text="{'result:' + _res}" /> 
    </s:VGroup> 
     <s:Button id="Bt" label="call" click="doCall()" /> 
</s:HGroup> 

<fx:Script> 
<![CDATA[ 
     [Bindable] private var i:int=0; 
     private var renPlan:Rename = new Rename(); 
     [Bindable] private var _res:String=""; 

     private function init():void { 
      renPlan.addEventListener("cancel", onPlanUpdCancel); 
      renPlan.addEventListener("updated", onPlanUpdated); 
      COrename.addElement(renPlan); 
     } 

     private function doCall():void { 
      if (COrename.isOpen) { 
       COrename.close(); 
      } else { 
       renPlan.nom = "test #"+i.toString(); 
       COrename.open(Bt, false); 
      } 
     } 

     private function onPlanUpdCancel(e:Event):void { 
      i++; 
      COrename.close(); 
     } 

     private function onPlanUpdated(e:Event):void { 
      i++; 
      _res = renPlan.nom; 
      COrename.close(); 
     } 
    ]]> 
    </fx:Script> 

</s:View> 

답변

0

이러한 경우에 대한 일반적인 제안을 시도해 보셨습니까? to change the skin?

<s:TextInput skinClass="spark.skins.mobile.TextInputSkin" id="Nom" 
text="{_nom}" width="201" maxChars="23" restrict="a-z A-Z0-9" /> 
+0

많은 도움을 주셔서 감사합니다. 내 실수로, 나는이 제안을 보았지만 내 문제와이 제안 사이에 공통점을 찾지 못했기 때문에 결코 테스트하지 못했습니다. – serge