View Full Version : Inport Image Map

10-11-2007, 06:49 PM
I'm trying to figure out a way to import an image map or build one using coordinates from an XML file and build out a swf that sports the mapped areas as buttons.

I'm thinking the script would work something like this:
1) Create MC - import "page" which is an external JPG image (file info in XML).
2) Create a button or MC that can act as a button sized and positioned based on the cords from the XML file.
3) Give that MC or button a getURL to popup related content in a new window.
4) Look for more cords to build another button... etc.

Has anybody seen anything like this, is it even doable? My flash scripting is limited.

10-16-2007, 03:35 PM
This isn't exactly what you're talking about, but it should get you started:

var myCoords:XML = new XML();
myCoords.ignoreWhite = true;
myCoords.onLoad = function(success) {
if (success) {
function parseXML(coordXML) {
var hotSpot1:XMLNode = coordXML.idMap["HotSpot1"];
var hotSpot1_xS:XMLNode = hotSpot1.childNodes[0].firstChild;
var hotSpot1_xE:XMLNode = hotSpot1.childNodes[1].firstChild;
var hotSpot1_yS:XMLNode = hotSpot1.childNodes[2].firstChild;
var hotSpot1_yE:XMLNode = hotSpot1.childNodes[3].firstChild;
var xStart:Number = parseInt(hotSpot1_xS.nodeValue);
var xEnd:Number = parseInt(hotSpot1_xE.nodeValue);
var yStart:Number = parseInt(hotSpot1_yS.nodeValue);
var yEnd:Number = parseInt(hotSpot1_yE.nodeValue);
this.onMouseMove = function() {
if ((this._xmouse>xStart) && (this._xmouse<xEnd) &&
(this._ymouse>yStart) && (this._ymouse<yEnd)) {
this.imageMapClip.myText.text = "You've rolled over the area
provided by the XML.";
} else {
this.imageMapClip.myText.text = "";


<spot id ="HotSpot1">