Abbreviated AS3:

==========

import com.google.maps.controls.*;

// Setter:
public function set controls($a:Array):void {
        _controls = $a; // Array of string method names.
};

private function onMapReady($e:Event):void {
        // This works:
        _map.addControl(new ZoomControl());
        // This does not work:
        for each (var s:String in _controls) {
                // Call methods by name... But, how?
                _map.addControl(new this[s]()); // Gives me error.
                // How to refer to the imported "com.google.maps.controls" 
instead of "this"?
        }
};

==========

I really want to call com.google.maps.controls.* methods by name, but
when I try (see "new this[s]()" line above) I get this error:

[[

Property ZoomControl not found on my.package.util.GoogleMaps and there
is no default value.

]]

Where "ZoomControl" is just one of the possible control methods that I
want to call.

Questions:

1. How to call com.google.maps.controls.* methods by name?

2. Is it bad practice to pass an array to a setter?

3. If #2 answer is yes, would it be best to just have one setter per
"control" method?

Am I making any sense here? :D

Please let me know if I can clarify further.

Thanks!
Micky
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to