简体   繁体   中英

Determining the NumericStepper that called the valueFormatFunction

I need to get the component that called the function from inside the function. Usually function properties of components have an argument such as the data column in the labelFunction property of grids, but here I just have the value of the stepper. Is there a way to get the component? Thanks.

No.

Since arguments.caller is no longer available, you may not be able to magically find out the calling component.

However, many ActionScript developers would prefer to implement in this way:

public function getValueFormatFunction(ns:NumericStepper):Function
{
    return function (value:Number):String { return ns.id + " " + value.toString() }
}

Use it as:

<s:NumericStepper id="ns1" valueFormatFunction="{getValueFormatFunction(ns1)}"/>
<s:NumericStepper id="ns2" valueFormatFunction="{getValueFormatFunction(ns2)}"/>

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