I have a NumericStepper declared as a UIComponent:
<![CDATA[
private var component:UIComponent;
component = new NumericStepper();
]]>
I need to change the .maximum value of the NumericStepper but due to the UIComponent not having a .maximum property the following code fails with the error: 1119: Access of possibly undefined property maximum through a reference with static type mx.core:UIComponent .
component.maximum = 11;
My question is how would I define a property in this scenario?
Another solution you can use is "casting":
var component:UIComponent;
component = new NumericStepper;
(component as NumericStepper).maximum = 500;
This has compile-time checking, but i don't know if it has any "downsides"
Hope this helps.
You can define it using the dynamic/string syntax:
component["maximum"] = 11;
I use that a lot, the only downsides are:
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.