Kort med Zoom og scroll
Hej jeg har lavet et lille danmarks kort hvor man kan zoome og scrolle rundt...Mit problem er nu at jeg har lavet 3 store usynlige knapper der fungerer som punkter man kan zoome ind på.(kortet kan kun zoome fra 50% til 100%)
Når man klikker på kortet så sendes et x og y coordinat til mit scripte og det flytter så kortet rundt på skærmen og zoomer hvis man er på 100%.
Alt dette foregår under en maske og jeg ville meget gerne at kortet istedet flyttede det punkt brugeren havde klikket på til centrum af masken.. istedet for kun de faste steder hvor knapperne ligger.
Jeg har også en del problemer med at få den tid kortet scroller/flytter sig til at være det samme som den tid det zoomer.. det ville klart se bedst ud..
her er min kode, jeg har forsøgt at lave en zoom funktion der gør fuldstændigt det samme som "flytte kort" funktionen men det vil ikke virke så nu har jeg denne lappe løsning..
Hi
I made a map and would like to give th user the possibility of zooming and scrolling around the map..wich is behind a mask..
my first try I placed (it' s not a big map) 3 transparent buttons on the map and had them define an x/y coordinate and a zoom state.
this works but is not perfect, the move and zoom function are not timed equally so the map is fininshed zooming before it's finished moving and that looks strange... allso the three buttons makes it hard to go up or down when you are zoomed in cause the only covers the area of the mask, so you cant see the buttons around a button when you are zoomed
I would like for the user to be able to click anywhere on the map and this area would move and become the center of the view...
the map only have to zoom from 50& to 100% nothing else.. so when you click the first time you move the maps "clickpoint" to the center of the visible area and zoom in to 100% then to go out you press the "zoom out" button..
here is the code that uses buttons
[CODE]
onClipEvent (load) {
moveSpeed = 7;
this._width = 230; //424x278 er størrelsen af min maske
this._height = 278;
this._x = 0;
this._y = 0;
}
onClipEvent (enterFrame) {
startX = this._x;
startY = this._y;
scale_Y = this._yscale;
scale_X = this._xscale;
x_move = x_pos-startX;//pos_x og y værdierne fra mine knapper
y_move = y_pos-startY;
this._x = startX+(x_move/moveSpeed);
this._y = startY+(y_move/moveSpeed);
if (scale_X<100 && zoomCount == 1) {
this._xscale += 5;
this._yscale += 5;
} else if (scale_X>=55 && zoomCount == 0) {
this._xscale -= 5;
this._yscale -= 5;
}
}
[/CODE]
så hvordan får jeg kortet til at flytte centrum til et punkt brugeren klikker? og hvordan får jeg min zoom funktion til at vare præcis lige så lang tid som kortet flytter sig x y?
tak for hjælpen..
