| View previous topic :: View next topic |
| Author |
Message |
mtm2 AFC Member
Joined: 19 Feb 2008 Posts: 3
|
Posted: Fri Feb 22, 2008 10:34 am Post subject: Info Window dont show up... |
|
|
Hi there,
I'm having trouble displaying the info window. I got your example .fla and it works great when i preview it but if i just copy/paste the code into my .fla (where i have my map), the window doesn't show up (and i find it odd...).
The code i have with my map (taken from other example files) is:
| Code: | import flash.filters.DropShadowFilter;
var ds:DropShadowFilter = new DropShadowFilter(5,45,0x000000,.70,4,4,1,1,false,false,false);
gMap.setCenter({lat:0,lng:0},15);
var point = gMap.addPoint({lat:0,lng:0, index:"", radius:16 ,name:"Map",fillRGB:0xFF0033, description:"Description Map", strokeThickness:1, filters:[ds]});
Stage.align = "TL";
Stage.scaleMode = "noScale";
gMap.addControl("GPositionControl");
gMap.addControl("GZoomControl", {display:"compact"});
gMap.addControl("GTypeControl"); |
And the code that i want to use (and it works well on your example .fla) is:
| Code: | var point = gMap.addPoint({lat:48.858842,lng:2.346997, name:"Paris, France"});
function eventResponder(evnt){
// open info window
evnt.target.openInfoWindow({title:evnt.target.name});
}
point.addEventListener("GEOMETRY_ON_RELEASE", eventResponder); |
Can anyone explain me what am i doing wrong?
Thanks.
(Your component is very good - as the support as well!) |
|
| Back to top |
|
 |
nerfkhat AFC Team

Joined: 19 Nov 2007 Posts: 2105
|
Posted: Fri Feb 22, 2008 4:36 pm Post subject: |
|
|
Hi MTM2,
In your code you are missing the event listener for your point to open. But please also make sure your map instance name is gMap. It will not give error since you are using AS2. But this is what your code should look like. I have organized it also. This should work for you now.
| Code: | import flash.filters.DropShadowFilter;
//add controls
gMap.addControl("GPositionControl");
gMap.addControl("GZoomControl", {display:"compact"});
gMap.addControl("GTypeControl");
//set stage
Stage.align = "TL";
Stage.scaleMode = "noScale";
//set map center
gMap.setCenter({lat:0,lng:0},5);
//marker dropshadow
var ds:DropShadowFilter = new DropShadowFilter(5,45,0x000000,.70,4,4,1,1,false,false,false);
//create 1st point
var point = gMap.addPoint({lat:0,lng:0, index:"", radius:16 ,name:"Map",fillRGB:0xFF0033, description:"Description Map", strokeThickness:1, filters:[ds]});
//open infowindow
function eventResponder(evnt){
evnt.target.openInfoWindow({title:evnt.target.name});
}
point.addEventListener("GEOMETRY_ON_RELEASE", eventResponder); |
Thanks,
Nerath |
|
| Back to top |
|
 |
mtm2 AFC Member
Joined: 19 Feb 2008 Posts: 3
|
Posted: Fri Feb 22, 2008 5:21 pm Post subject: |
|
|
Hi Nerath, thank you for the quick reply.
Here's what happens:
If i copy/paste the code that you gave me into my .fla gmap (that was originally a "save as" from one of your examples, on witch i have those custom "cool black semi-transparent zoom controls" and the custom drop shadow on my icon), nothing happens. The window still don't show up.
If i copy/paste your code on a blank new document (with gmap component on stage, and named "gMap" - as with previous .fla), the window appears to be ok (as i wanted) but the custom "cool black semi-transparent zoom controls" are gone (replaced by the default white one) and the custom shadow appears along the default shadow...
I really don't know what i missed...
And one more thing; why are the gmap items different in the component window on the files that you provide as examples and a new file created from scratch? In your files i have a "doubleClickMode" option but its missing from the component window if i drag gmap component to stage/library from a new .fla.
And the place/location/display of the Google logo/elements are also different.
Thanks. |
|
| Back to top |
|
 |
nerfkhat AFC Team

Joined: 19 Nov 2007 Posts: 2105
|
Posted: Fri Feb 22, 2008 6:17 pm Post subject: |
|
|
HI,
Please make sure that your gmap component is up to date. Try dragging a new map component to stage with a old file that was already created. If the one on stage is old it will ask to be replaced. I have opened the custom control example and setup the open infowindow function and it works.
| Code: | import flash.filters.DropShadowFilter;
var zoomControl = new com.afc.GMap.controls.zoom.GZoomControl({display:"expanded"});
map.addControl(zoomControl);
var positionControl = new com.afc.GMap.controls.position.GPositionControl();
map.addControl(positionControl);
var mapTypeControl = new com.afc.GMap.controls.type.GTypeControl();
map.addControl(mapTypeControl);
var myLayer = map.addLayer({name:"my locations"});
var point = myLayer.addPoint({lat:39.74002, lng:-104.992261, index:"D",name:"Denver, Colorado",fillRGB:0xFF0000, strokeThickness:1});
myLayer.addPoint({lat:39.74002, lng:-104.992261, index:"D",name:"Denver, Colorado",fillRGB:0xFF0000, strokeThickness:1});
function GEOMETRY_ON_RELEASE(evnt){
map.setCenter({lat:evnt.target.lat, lng:evnt.target.lng});
evnt.target.openInfoWindow({title:evnt.target.name, content:"AFC!", h:60});
trace("fire");
}
point.addEventListener("GEOMETRY_ON_RELEASE", this); |
Thanks,
Hopefully this works for you this time. If you are still having trouble please send file to support at afcomponents.com
Nerath
Last edited by nerfkhat on Fri Feb 22, 2008 11:41 pm; edited 1 time in total |
|
| Back to top |
|
 |
mtm2 AFC Member
Joined: 19 Feb 2008 Posts: 3
|
Posted: Fri Feb 22, 2008 7:55 pm Post subject: |
|
|
I must be very dumm.
I used your last code on the "gmap_custom_controls.fla" that came with the gmap component, replacing the existing code. I dragged the gmap component from the window components to the stage and used the "Replacing Existing Component" option, as you mentioned. Did the same with my gmap.fla ("saved as..." from an example .fla from you) and finally from a new .fla (without the need to "Replace Existing Component") and it did not work.
Its odd, because if i use your example files "as they are", they work well (thats the case with my gmap.fla) but if i combine the specific "gmap_info_window.fla" script with the "gmap_custom_controls.fla", i don't get both features. I mean, if i copy/paste the script part of info window into the custom controls script, i don't get the info window (and vice-versa).
If i can´t manage to get this to work with your kind help here online, i´ll send you the file, as you mentioned.
Thanks |
|
| Back to top |
|
 |
|