Código :
// Create empty movie clip for external SWF.
this.createEmptyMovieClip("temp_mc", 1);
this.temp_mc.createEmptyMovieClip("content_mc", 1);
this.temp_mc.content_mc._lockroot = true;
// Create Spot List Array
var spot_list:Array = [];
var external_swf_file:String = null;
// add spot over sound effect
over_snd = new Sound(this);
over_snd.attachSound("over");
// Create Spot XML object
var spot_list_xml:XML = new XML();
spot_list_xml.ignoreWhite = true;
// When load XML data call this function
spot_list_xml.onLoad = function(load_status:Boolean):Void {
var nodes:Array = this.firstChild.childNodes;
// Get Nodes Length
spot_list_length = nodes.length;
external_swf_width = Number(nodes[0].attributes.external_swf_width);
external_swf_height = Number(nodes[0].attributes.external_swf_height);
starting_swf_file_path = String(nodes[0].attributes.starting_swf_file_path);
create_mask(external_swf_width, external_swf_height);
// read all XML data
for (var i = 1; i<spot_list_length; i++) {
// add all spot information to spotlist array
spot_list.push({location_name:nodes[i].attributes.location_name, x:nodes[i].attributes.x, y:nodes[i].attributes.y, dot_normal_color:nodes[i].attributes.dot_normal_color, dot_rollover_color:nodes[i].attributes.dot_rollover_color, url:nodes[i].attributes.url, url_target:nodes[i].attributes.url_target, swf:nodes[i].attributes.swf});
}
// call duplicate spot function
create_spot_list();
external_swf_file_load(starting_swf_file_path);
};
// load xml file
spot_list_xml.load("xml/spots.xml");
// Define duplicate spot function
create_spot_list = function () {
for (i=0; i<spot_list_length-1; i++) {
// attach spot to map from libray
var spot = this.attachMovie("spot_mc", "spot_mc"+i, this.getNextHighestDepth());
// Define Spot Location Name
spot.location_name = spot_list[i].location_name;
// Placed each spot X and Y coordinate on the map
spot._x = Number(spot_list[i].x);
spot._y = Number(spot_list[i].y);
spot.dot_normal_color = Number(spot_list[i].dot_normal_color);
spot.dot_rollover_color = Number(spot_list[i].dot_rollover_color);
// Define Spot URL data
spot.url = spot_list[i].url;
spot.url_target = String(spot_list[i].url_target);
// Define External SWF file path
spot.swf_file = spot_list[i].swf;
}
};
Saludos.
