so is it possible to define the default function if it is not defined?

lets say the user does not define the function, i would want it to fall back
on a default behavior.


On 1/29/07, Alex Harui <[EMAIL PROTECTED]> wrote:

   You cannot define the prototype of the function in the variable that
holds the function.  And you cannot replace methods that are defined.  Wish
we could, but you can't.  So it is:



private var _externalInterfaceFunction:Function


 ------------------------------

*From:* [email protected] [mailto:
[EMAIL PROTECTED] *On Behalf Of *dorkie dork from dorktown
*Sent:* Sunday, January 28, 2007 11:42 PM
*To:* [email protected]
*Subject:* [flexcomponents] How to let user create user defined function



In the Tree component you can assign a function to the labelFunction
property. I would like to do that in my component but I'm only receiving
errors. What I want is exactly the same as the Tree component. Here is the
closest I could get:

In my component class file:

    // user defined function. user should be able to define or redefine
this function
    private function _externalInterfaceFunction(value:Boolean):Boolean {
        return true;
    }

    // setter that lets user override default function with user defined
function
    public function set externalInterfaceFunction(value:Function) {

        if (value!=null) {
            _externalInterfaceFunction = value;
        }
    }

Reply via email to