PDA

View Full Version : Flash action script help - Map coordinates


figment
08-19-2005, 03:03 PM
I know there has to be an easier way of doing this.
I have this flash map. http://spoiltch.u59.hosting365.ie/extranet/spoiltchilddesign/internalprojects/test.swf

Now i need each of those coordinates on the map (80 wide and 100 tall) when clicked to assign the x,y variables to be sent in a form.

There are something like 8000 coordinates and i will go crazy having to hand code each and every button. Can anyone help do this by actionscript? Payment involved.

Source here: http://spoiltch.u59.hosting365.ie/extranet/spoiltchilddesign/internalprojects/test.fla

I will be scaling the map to enlarge the map down to the county/state level so the buttons will need to grow with it.

finchou
08-19-2005, 03:27 PM
put this on your map clip :

on(press){
trace(_xmouse, _ymouse);//or do what you want
}

does this help?

figment
08-19-2005, 03:34 PM
Thanks finchou, my problem is that when i zoom up the map those _x,_y will not zoom up with it.

Eg, a town called DUBLIN, would have the _x, _y of 40,87 when viewing the full map. When a user enlarges the map to see the town of DUBLIN in more detail the _x, _y needs to remain 40,87.

Shout if i am not making sense :)

finchou
08-19-2005, 03:50 PM
ok... if you click on one of the big squares it fills the whole map movieClip?
you can manage it with a for loop...


var deltaX=0;
var ix;
var jy;
on(press){
trace(_xmouse, _ymouse);
for (var i=0;i<nSquares;i++){
if ((i*widthofsquare<_xmouse)&&((i+1)*widthofsquare>_xmouse){
deltaX=i*widthofsquare;//to rember the x coordinates of the beginning of the zoomed square...
ix=i;
}
}
//same loop for y

//doYourZoom
this._xscale=400;//or something

this._x-=_xmouse*ix*400;//to set the map in the correct position
//same for y...

}
}


then you can return the current _xmouse plus deltax...
it's ugly and untested, slap me if it doesn't make sense :D

figment
08-19-2005, 03:57 PM
finchou would you be interested in taking on this part of the project. Its for a paying client so funds are available and it will take you less time then it would me :)

Regards,
alan alan@spoiltchild.com