Hi,
This board isn't really intended to give people actionscript training
however i'll help you out, from looking at your code it looks like you
are probably coming from Java. First when adding a listener, you don't
do it inside of the onClick function. First you need to put the ground
overlay variable outside of the function so you can access it later.
private var groundOverlay:GroundOverlay
private function onMapReady(event:MapEvent):void {
groundOverlay = new GroundOverlay( .. );
checkbox.addEventListener(Event.CHANGE, onChange);
}
private function onChange(e:Event):void {
if(checkbox.selected) {
map.addOverlay(groundOverlay);
}
}
}
Jonathan
ScribbleMaps.com
On Aug 20, 7:07 am, apps <[email protected]> wrote:
> Hello
> I’m new in Flex und AS.
> I'm creating an interactive web map using the Google Maps API.
> I added an groundoverlay to the google map.
> Aim is to select several overlays by a checkbox.
>
> How can I link overlay and checkbox function?
>
> Code to add on overlay:
>
> private function onMapReady(event:MapEvent):void {
> …
> var KartenLoader:Loader = new Loader();
> var urlRequest:URLRequest = new URLRequest("…..png");
>
> KartenLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
> function(e:Event):void {
>
> var groundOverlay:GroundOverlay = new GroundOverlay(
>
> KartenLoader, new LatLngBounds(new LatLng(47.716216,7.213393), new
> LatLng(54.765641,14.139235)));
> map.addOverlay(groundOverlay);
>
> groundOverlay.foreground.alpha = .9
> });
> KartenLoader.load(urlRequest);
>
> }
>
> private function onclick(event:MouseEvent):void {
> checkbox.addEventListener(MouseEvent.click, onClick);
> if (checkbox.selected== true)
>
> ? map.addOverlay ()
>
> Any ideas?
>
> Thanks
--
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en.