package { import flash.display.Sprite; import flash.events.Event; /** * ... * @author JMIM */ public class Main extends Sprite { public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point var hg:HasGetter = new HasGetter(); var func:Function = hg.getStuff; func(); } } } internal class HasGetter { public function get getStuff():Boolean { trace("hay!"); return true; } public function HasGetter() { }; }
Thursday, January 3, 2013
Binding Getters To Function Types
No, you cannot assign a function variable to a getter function.
This code will error.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment