I am getting the TypeError: Error #1009: Cannot access a property or
method of a null object reference.
at Google_Map_fla::MainTimeline/frame1()
I have searched, but have not found out how to resolve this problem.
Main SWF AS3
Google Map SWF AS3
My main file works OK and I am able to load all other external swf's
The Google Map works OK and loads all Markers etc.
The problem is when I try and load the external, Google_Map.swf to my
main SWF
file, I get this error.
The AS3 in my main swf, to load the Google_Map.swf is...
var myrequest_Gog:URLRequest=new URLRequest("Google_Map.swf");
var myloader_Gog:Loader=new Loader();
myloader_Gog.load(myrequest_Gog);
myloader_Gog.contentLoaderInfo.addEventListener(Event.COMPLETE,
movieLoaded_Gog);
Rtn_Google_Intro_btn.addEventListener("click",Rtn_Google_Intro_);
function movieLoaded_Gog(myevent_Gog:Event):void {
stage.addChild(myloader_Gog);
var mycontent:MovieClip=myevent_Gog.target.content;
mycontent.x=20;
mycontent.y=20;
}
function Rtn_Google_Intro_(e:Event):void {
gotoAndStop("Google_Intro");
}
Rtn_Google_Intro_btn.addEventListener(MouseEvent.CLICK,
removeMovie_Gog);
function removeMovie_Gog(myevent_CP:MouseEvent):void {
myloader_Gog.unload();
}
The AS3 in my Google_Map.swf is...
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.controls.ZoomControl;
import com.google.maps.controls.PositionControl;
import com.google.maps.controls.MapTypeControl;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.overlays.Marker;
import com.google.maps.InfoWindowOptions;
import com.google.maps.MapMouseEvent;
// Create The Map
var map:Map = new Map();
map.key =
"ABQIAAAAtjV7BW2rkWkte_Dhq1dAMBQeFvO6vKFC-7vH0atZAbV7ZlpJ_RTKx3boiZpgLKpxn0uVnev3W3frZw";
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
this.addChild(map);
function onMapReady(event:MapEvent):void {
map.setCenter(new LatLng(40.710725,-4.012991), 12,
MapType.HYBRID_MAP_TYPE);
map.addControl(new ZoomControl());
map.addControl(new PositionControl());
map.addControl(new MapTypeControl());
xmlLoader();
}
function xmlLoader(){
function loadXML(e:Event):void{
XML.ignoreWhitespace = true;
var google_map:XML = new XML(e.target.data);
for (var i:Number = 0; i < google_map.location.length(); i++){
var latlng:LatLng = new LatLng(google_map.location[i].lat,
google_map.location[i].lon);
var tip = google_map.location[i].name_tip;
var myTitle:String = google_map.location[i].title_tip;
var myContent:String = google_map.location[i].content_tip;
map.addOverlay(createMarker(latlng,i, tip, myTitle,
myContent));
}// end of for loop
// Add Markers On The Map
function createMarker(latlng:LatLng, number:Number, tip, myTitle,
myContent):Marker {
var i:Marker = new Marker(
latlng,
new MarkerOptions({
hasShadow:
true,
tooltip: ""+tip
})
);
i.addEventListener(MapMouseEvent.CLICK, function
(event:MapMouseEvent):void
{
map.openInfoWindow(event.latLng, new
InfoWindowOptions({titleHTML:
""+myTitle, contentHTML: ""+myContent, height:250, width:410}));
});
return i;
}// end function createMarker
}// end of loadXML function
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
xmlLoader.load(new URLRequest("google_map.xml"));
}
Any help appreciated.
--
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.