hi,
i am using get and setters in my as3 code to edit values of an other class (because those variables are shared) i dont like to put stage.sharedVar.isScrabble in my code every time to change a variable so i used get/set functions
see below
private function get isScrabble(){return stage.sharedVar.isScrabble;}
private function set isScrabble(val){stage.sharedVar.isScrabble = val;}
private function get superGrid(){return stage.sharedVar.superGrid}
private function set superGrid(val){stage.sharedVar.superGrid = val;}
private function get gridSize(){return stage.sharedVar.gridSize}
private function set gridSize(val){stage.sharedVar.gridSize = val}
private function get blokDefaultWidth(){return stage.sharedVar.blokDefaultWidth}
private function set blokDefaultWidth(val){stage.sharedVar.blokDefaultWidth = val}
private function get blokDefaultHeight(){return stage.sharedVar.blokDefaultHeight}
private function set blokDefaultHeight(val){stage.sharedVar.blokDefaultHeight = val}
as you van see it has a lot of duplicate code every time the "return stage.sharedVar." and the "stage.sharedVar."+ the value + " = val" is constantly comming back.
i was wondering is there a other way of creating these get/sets? something like?:
private function get variable1(){getValue("hisOwnFunctionName")}
private function set variable1(val){setValue("hisOwnFunctionName")}
and so on??
thanks, Matthy