taragdes

Actionscript question:Casting to / from different map types

Recommended Posts

Can I create a generic Map object, then cast it into the version I need? The following code runs, but the map is not attached. I don't think the cast works in this scenario?

 

 

 

//----- preloading / application messages --------------------------//

#include "com/fusionmaps/includes/LoadingFunctions.as"

#include "com/fusionmaps/includes/AppMessages.as"

import com.fusionmaps.core.Map;

import com.fusionmaps.maps.World8Map;



//----- Main() --------------------------//

var mapContainer_mc:MovieClip = this.createEmptyMovieClip("MapHolder", 1);

var xml_obj:XML = XML(LoadMapXml("World8Map.xml"));

var newMap_obj:World8Map = World8Map(CreateMap(mapContainer_mc));

newMap_obj.setXMLData(xml_obj);

newMap_obj.render();



//----- create map -------------------------------------------------//

function CreateMap(mapContainer_mc:MovieClip):Map {

map_obj = new Map(mapContainer_mc, 1, 740, 420, 26, 26, true, "EN", "exactFit");

return map_obj;

}

//----- load xml file  ---------------------------------------------//

function LoadMapXml(file_str:String) {

var xml_obj:XML = new XML();

xml_obj.ignoreWhite = true;

xml_obj.load(file_str);

xml_obj.onLoad = function(success:Boolean) {

	if (success) {

		return xml_obj;

	}

};

}

 

 

 

Any suggestions?

 

 

 

Thank you!

 

 

 

 

 

-- Tara Deschenes

 

Technimedia, LLC

Edited by Guest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now