|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Limiting a scroll using onEnterFrame
Hello all and thanks for checking this post out.
I have a scroll set up so that certain parts of a movie are "masked" out but can be scrolled to. I have 4 buttons to scroll north, south, east and west. Example... To scroll west I have this code: on (press) { delta_y = 0; delta_x = 10; } on (release) { delta_x = 0; } In Frame 1, I have this code ("map2" being the movieclip which is actually scrolling under the mask): map2._y = map2._y+delta_y; map2._x = map2._x+delta_x; Right now, it will scroll as long as I have my mouse held down which ends up just displaying the bk color. I have been informed that I must use an onenterFrame command to check the position of the map2 movieclip before starting the movement. I have no experience with this command and am having a hard time even figuring out the correct syntax in writing. Does anyone have any advice for writing the onEnterFrame part? Thanks so much! |
|
#2
|
|||
|
|||
|
put a limits on _x and _y.
here's an example to start you off: // define the minimums and maximums minX = -80; maxX = 200; minY = 0; maxY = 350; // if object reaches limits if (map2._x >= maxX){ map2._x = maxX; } ..... and so forth and so on. |
|
#3
|
|||
|
|||
|
Thanks so much. I'm still having problems. This is driving me nuts.
So here's what I did.... In Frame 1 of my movie, I declared the variables for minX, etc. Then on my button to scroll west, I wrote this: on (press) { while (map2._x>=minX) { delta_y = 0; delta_x = 10; } } on (release) { delta_x = 0; } I don't understand why this doesn't work. It seems like the logic is pretty simple. But it NEVER stops scrolling while your holding the button down. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Limiting a scroll using onEnterFrame |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|