In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

prototype-based programming

Get Adobe Flash player
by tosik 22 Aug 2010
    Embed
/**
 * Copyright tosik ( http://wonderfl.net/user/tosik )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/yUm4
 */

package {
    import flash.text.TextField;
    import flash.display.Sprite;
    
    public class PrototypeBasedProgramming extends Sprite {
        public function PrototypeBasedProgramming() {
            var hello:HelloWorld = new HelloWorld;
            var textfield:TextField = new TextField;
            addChild(textfield);
            
            Object.prototype.say = function():String
            {
                return "Awesome!";
            };

            textfield.text = hello.say();
        }
    }
}

dynamic class HelloWorld
{
}