Dreadart
asked on
API google map all over my pages
Hi,
I am a AS3 and Flash CS4 newb user. I created a simple website which's structure I explain below:
the website has 4 main layers:
1- Houses my script
2- Houses my menu which has movieclips as bottons
3- Houses the content of the pages (1 movie clip with 7 frames for different content)
4- Houses my background design
On the movieclip of fram 3 I inserted 2 layers:
1- Houses my AS3
2- Houses the different frames of the movie with different content)
The problem is that I inserted my script on frame 5 of the AS3 layer for it to display a couple of google maps on the content layer of the movie clip. When I test the website and navigate to the frame 5 where the maps are being displayed, everything displayed ok BUT when I navigate away from that frame the google maps do not go away. They simply go on top of the content of the rest my my movieclip frames overriding whatever content I have.
Here is the code that I used for to insert the google maps. Any help please?
----
import com.google.maps.*;
import com.google.maps.overlays.* ;
import com.google.maps.controls.* ;
var gomap:Map = new Map()
gomap.key = "API key";
gomap.setSize(new Point(220,250))
gomap.x = -260
gomap.y = 155
gomap.addEventListener(Map Event.MAP_ READY, onMapReady);
this.addChild(gomap);
function onMapReady(e:Event):void
{
gomap.enableScrollWheelZoo m();
var nav_position:ControlPositi on = new ControlPosition(ControlPos ition.ANCH OR_TOP_LEF T, -65,0);
var myNavPos:NavigationControl = new NavigationControl();
myNavPos.setControlPositio n(nav_posi tion);
gomap.addControl(myNavPos) ;
var view_position:ControlPosit ion = new ControlPosition(ControlPos ition.ANCH OR_TOP_LEF T, 10,260);
var myViewPos:MapTypeControl = new MapTypeControl();
myViewPos.setControlPositi on(view_po sition);
gomap.addControl(myViewPos );
gomap.setCenter(new LatLng(33.789817, -118.185720),14,MapType.NO RMAL_MAP_T YPE);
gomap.removeMapType(MapTyp e.PHYSICAL _MAP_TYPE) ;
var myMarker :Marker = new Marker(new LatLng(33.789817, -118.185720),
new MarkerOptions({icon:new marker1(),
hasShadow: false}));
gomap.addOverlay(myMarker) ;
}
var gomap2:Map = new Map()
gomap2.key = "API key";
gomap2.setSize(new Point(220,250))
gomap2.x = 80
gomap2.y = 155
gomap2.addEventListener(Ma pEvent.MAP _READY, onMapReady2);
this.addChild(gomap2);
function onMapReady2(e:Event):void
{
gomap2.enableScrollWheelZo om();
var nav_position:ControlPositi on = new ControlPosition(ControlPos ition.ANCH OR_TOP_LEF T, -65,0);
var myNavPos:NavigationControl = new NavigationControl();
myNavPos.setControlPositio n(nav_posi tion);
gomap2.addControl(myNavPos );
var view_position:ControlPosit ion = new ControlPosition(ControlPos ition.ANCH OR_TOP_LEF T, 10,260);
var myViewPos:MapTypeControl = new MapTypeControl();
myViewPos.setControlPositi on(view_po sition);
gomap2.addControl(myViewPo s);
gomap2.setCenter(new LatLng(33.790291,-118.1677 81),14,Map Type.NORMA L_MAP_TYPE );
gomap2.removeMapType(MapTy pe.PHYSICA L_MAP_TYPE );
var myMarker :Marker = new Marker(new LatLng(33.790291,-118.1677 81),
new MarkerOptions({icon:new marker2(),
hasShadow: false}));
gomap2.addOverlay(myMarker );
}
I am a AS3 and Flash CS4 newb user. I created a simple website which's structure I explain below:
the website has 4 main layers:
1- Houses my script
2- Houses my menu which has movieclips as bottons
3- Houses the content of the pages (1 movie clip with 7 frames for different content)
4- Houses my background design
On the movieclip of fram 3 I inserted 2 layers:
1- Houses my AS3
2- Houses the different frames of the movie with different content)
The problem is that I inserted my script on frame 5 of the AS3 layer for it to display a couple of google maps on the content layer of the movie clip. When I test the website and navigate to the frame 5 where the maps are being displayed, everything displayed ok BUT when I navigate away from that frame the google maps do not go away. They simply go on top of the content of the rest my my movieclip frames overriding whatever content I have.
Here is the code that I used for to insert the google maps. Any help please?
----
import com.google.maps.*;
import com.google.maps.overlays.*
import com.google.maps.controls.*
var gomap:Map = new Map()
gomap.key = "API key";
gomap.setSize(new Point(220,250))
gomap.x = -260
gomap.y = 155
gomap.addEventListener(Map
this.addChild(gomap);
function onMapReady(e:Event):void
{
gomap.enableScrollWheelZoo
var nav_position:ControlPositi
var myNavPos:NavigationControl
myNavPos.setControlPositio
gomap.addControl(myNavPos)
var view_position:ControlPosit
var myViewPos:MapTypeControl = new MapTypeControl();
myViewPos.setControlPositi
gomap.addControl(myViewPos
gomap.setCenter(new LatLng(33.789817, -118.185720),14,MapType.NO
gomap.removeMapType(MapTyp
var myMarker :Marker = new Marker(new LatLng(33.789817, -118.185720),
new MarkerOptions({icon:new marker1(),
hasShadow: false}));
gomap.addOverlay(myMarker)
}
var gomap2:Map = new Map()
gomap2.key = "API key";
gomap2.setSize(new Point(220,250))
gomap2.x = 80
gomap2.y = 155
gomap2.addEventListener(Ma
this.addChild(gomap2);
function onMapReady2(e:Event):void
{
gomap2.enableScrollWheelZo
var nav_position:ControlPositi
var myNavPos:NavigationControl
myNavPos.setControlPositio
gomap2.addControl(myNavPos
var view_position:ControlPosit
var myViewPos:MapTypeControl = new MapTypeControl();
myViewPos.setControlPositi
gomap2.addControl(myViewPo
gomap2.setCenter(new LatLng(33.790291,-118.1677
gomap2.removeMapType(MapTy
var myMarker :Marker = new Marker(new LatLng(33.790291,-118.1677
new MarkerOptions({icon:new marker2(),
hasShadow: false}));
gomap2.addOverlay(myMarker
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you! You are a wizard!
When you navigate away from the map page, you need to have:
this.removeChild(gomap);
if that doesn't work, try it without the "this".
AreDubya