简体   繁体   中英

how can I add viewstates to a component through actionscript?

I want to add a few ToggleButton s through actionscript.

<s:ToggleButton label="Toggle Button" enabled.viewMode="false" enabled.editMode="true"/>

I do this like this:

var critbtn : ToggleButton = new ToggleButton();
critbtn.label = 'testlabel;
critbtn.enabled.viewMode="false";
critbtn.enabled.editMode="true"
criteriaGroup.addElement(critbtn);

but that won't work. How can I add the different enabled values for different States with actionscript and not with MXML?

Quick answer, no, you cannot add state based properties in actionscript. It's an MXML only affair. If you really want to add components with Actionscript but want to add state based properties, I would recommend you use a skin instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM