|
|
|
#1 |
|
Member
Join Date: Apr 2001
Posts: 75
|
Need an Mc to always stay on screen
I have a very tall Flash application that I will be using as part of a Help Desk application .
The document is 1500 pixels tall. There is a little "control panel" on the right hand side of the screen that always needs to stay on screen , no matter how far down you scroll. The scroll panel is 510 pixels tall, and the registration point is toward the top/middle. I have the code set so that now, if the mouse gets too far away from the panel, the control panel will travel down (or up) to find the mouse y position. But its a little choppy and sometimes you have to move the mouse to the extreme top or bottom of the screen to get it to position itself properly.
Here is the link: try it out. http://www.newmediatech.net/nuSite/helpdesk3.html
__________________
-Nmuta |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
Figure out the minimum and maximum Y values that the control panel should be allowed to have. Let's say it's 0 and 1000.
MINIMUM_Y = 0; MAXIMUM_Y = 1000; Then change these two lines: if (mousey>panely+400){ ... }else if (mousey<panely-100){ to this: if (mousey>panely+400 and _root.controlpanel._y < MAXIMUM_Y){ ... }else if (mousey<panely-100 and _root.controlpanel._y > MINIMUM_Y){ |
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 2001
Posts: 75
|
thanks! I didn't think about using a minimum and maximum y value. It's still stopping too soon in both directions, but I can work with it based on what you've said. I need to figure out how to change the registration point on the mc, that will help me get the measurements more precise.
__________________
-Nmuta |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
Yep. Having a precise registration point always makes scripting easier.
For example, if the registration point is at the top of the MC, than the maximum _y is going to be Stage.height - mc._height; If the registration point is at the exact center of the MC, then maximum _y is going to be Stage.height - mc._height/2; But if the registration point is "near" the top or center, then all bets are off ![]() I often use the properties panel to move content to insure that the registration point is exactly centered. If a movie is 140 pixels high, I will manually set the y position to -70. |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|