To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-18-2004, 05:13 PM   #1
nmuta
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.

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
__________________
-Nmuta
nmuta is offline   Reply With Quote
Old 10-18-2004, 06:11 PM   #2
jbum
Senior Member
 
jbum's Avatar
 
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){
__________________
jbum is offline   Reply With Quote
Old 10-18-2004, 06:31 PM   #3
nmuta
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
nmuta is offline   Reply With Quote
Old 10-18-2004, 06:51 PM   #4
jbum
Senior Member
 
jbum's Avatar
 
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.
__________________
jbum is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:05 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.