开发者

Use actionscript to uncheck a checkbox in a component?

开发者 https://www.devze.com 2023-02-18 06:16 出处:网络
I have a component with checkboxes, the checkboxes are bound to booleans in the main code: <mx:CheckBox id=\"LyrClearAll\" selected=\"{Application.application.bLyrClearAll}\"/>

I have a component with checkboxes, the checkboxes are bound to booleans in the main code:

<mx:CheckBox id="LyrClearAll" selected="{Application.application.bLyrClearAll}"/>  

This works fine for the checkboxes that don’t change unless a user interacts with them again. My problem appears because I want开发者_Go百科 to “uncheck” one of the boxes everytime the component is closed. (I know something other than a checkbox would work better, but I’m trying to keep things consistent in this component.)

I have tried setting the bound Boolean variable to false, and I’ve tried setting the checkbox.selected value to false. Neither are working, everytime I open the component the checkbox is still checked.

private function makeLyrsPopUp(evt:MouseEvent):void  
{  
  var panelLyr:popUpLayers = PopUpManager.createPopUp(this, popUpLayers, false) as popUpLayers;    
  panelLyr.LyrClearAll.selected == false; //?? set checkbox back to unchecked 
  panelLyr["cancelButton"].addEventListener("click", removeMe);
  panelLyr["okButton"].addEventListener("click", submitData);
  PopUpManager.centerPopUp(panelLyr);

  function submitData(event:Event):void  //change layer visibility based on check boxes in popupLayer
  {
    bLyrStreet = panelLyr.LyrStreet.selected;
    bLyrParcel = panelLyr.LyrParcel.selected;
    bLyrClearAll = panelLyr.LyrClearAll.selected;
    if (bLyrClearAll)
    {
      clearLayers();
      bLyrClearAll == false;  //?? set checkbox back to unchecked
    } 
    removeMe(event);
  }
} 


Needed to change == false to = false


bLyrClearAll should be declared bindable:

[Bindable]
var bLyrClearAll: Boolean;
0

精彩评论

暂无评论...
验证码 换一张
取 消