Determining the NumericStepper that called the valueFormatFunction

62 Views Asked by At

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.

1

There are 1 best solutions below

0
Chaniks On

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)}"/>