Hi All! Many thanks for the replies, I really appreciate the pro help. :)

See inline replies below:

On Fri, Jan 14, 2011 at 8:48 PM, Dave Watts <dwa...@figleaf.com> wrote:
> I'm not sure if this is what you're asking for.

Doh, sorry if my question was a little convoluted and ambiguous. :(

> new com.google.maps.controls.ZoomControl();

Thanks for tip! In this case, I would like to do something like this:

for each (var s:String in _controls) {
        new com.google.maps.controls[s]();
}

Unfortunately, that does not work. :(

> Not if you have a property of the object that is an array.

Ahh, not in this case.

My document class is calling the "controls" setter like so:

_map.controls = ['PositionControl', 'ZoomControl', 'MapTypeControl',
'ScaleControl', 'OverviewMapControl'];

Where each is a class method of com.google.maps.controls.

Based on your feedback, it is sounding like what I am trying to do is
bad practice. Basically, I was just trying to avoid writing a setter
for each type of map control.

On Sat, Jan 15, 2011 at 1:31 AM, Henrik Andersson <he...@henke37.cjb.net> wrote:
> You want the getDefinitionByName function, not the dynamic property access
> syntax.

Ah, interesting! You know, I come across this function via Google, but
I was not able to grasp how to properly use it in this situation...

This is the class:

com.google.maps.controls

And this is a method of the class (for example):

ZoomControl()

I have tried a few different variations of the below code with no success:


var classRef:Class = getDefinitionByName('com.google.maps');
for each (var s:String in _controls) {
        // Test #1:
        //var classRef:Class =
getDefinitionByName('com.google.maps.controls.' + s + '()');
        //var controls = new classRef();
        // Test #2:
        new classRef.controls[s]();
}

Nine times out of ten I get this error:

[[

Implicit coercion of a value with static type Object to a possibly
unrelated type Class.

]]

On Sat, Jan 15, 2011 at 2:14 AM, Leandro Ferreira <dur...@gmail.com> wrote:
> You must declare each class or they are not gonna be compiled. Just put all
> the class names you need separated by comma: ZoomControl, PositionControl,
> ScaleControl;

This sounds interesting! Could you clarify a bit further? I am not
sure where I should do this.

Thanks again everyone! I greatly appreciate the pro assists on this one. :)

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

Reply via email to