0 Replies Latest reply on Sep 2, 2007 9:54 AM by cpriest9774

    Function.prototype

    cpriest9774
      Hey all, I come from an ajax environment and have been using Prototype.js library for quite some time.

      I'm attempting to recreate some of the features by extending the core Function object, however I am not having much luck. Has anyone done this with Flex yet? Here's a snippet of what I'm attempting:

      Function.prototype.bind = function():* {
      var __method:Object = this, args:Array = arguments, object:Object = args.shift();
      return function():* {
      return __method.apply(object, args.concat(arguments));
      }
      }

      var tmp:Function = function():void {
      }

      Then when doing something like:
      Alert.show(tmp.bind(null));

      I get the error (in Flex Builder 2):
      1061: Call to a possibly undefined method bind through a reference with static type Function.

      Anyone have any idea on how to do what I'm trying? Thanks!