-
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.
code:
_root.multiplier=60;
_root.pccount=103;
_root.dragmode=false;
function movepane(){
panely=_root.controlpanel._y
mousey=_root._ymouse;
if (mousey>panely+400){
_root.controlpanel._y=_root.controlpanel._y+multip lier;
multiplier= multiplier*0.99;
}else if (mousey<panely-100){
_root.controlpanel._y=_root.controlpanel._y-multiplier;
multiplier= multiplier*0.99;
}else{
multiplier=60;
}//end if mousey
}
Here is the link: try it out.
http://www.newmediatech.net/nuSite/helpdesk3.html
-
Senior Member
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){
-
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.
-
Senior Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|