FORUMS: list search recent posts

scrolling menu reponds to mouse pointer - Help

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
christopher toplisek
scrolling menu reponds to mouse pointer - Help
on Mar 27, 2009 at 5:50:23 pm

trying to make a scrolling menu but having trouble stopping the the movie clip scrolling off the page:

i also want to make the motion smoother and stop the scrolling if the mouse pointer is not over the movie clip, aswell as stoping when i press on a botton in the flash movie clip


heres the code so far


var myShape:Shape = new Shape()
myShape.graphics.beginFill(0x7E00E3);
myShape.graphics.drawRect(0,0,1500,600)

addChild(myShape)
menu_mc.mask=myShape

stage.addEventListener(Event.ENTER_FRAME, movemenu);
function movemenu(myevent:Event):void {
menu_mc.x = menu_mc.x + (0.5 * myShape.width - mouseX) / 4;

}



not a can guru at all
any help many thanks

http://christoplisek.co.uk/slider.swf
this is it so far


Return to posts index

Abraham Chaffin
Re: scrolling menu reponds to mouse pointer - Help
on Mar 27, 2009 at 11:23:34 pm

What you would want to do is add a few limiters on it using if then statements such as this below:


stage.addEventListener(Event.ENTER_FRAME, movemenu);
function movemenu(myevent:Event):void {
new_x = menu_mc.x + (0.5 * menu_mc.width - mouseX) / 4;

if(new_x > menu_mc.x && menu_mc.x < stage.stageWidth-300){
menu_mc.x=new_x;
}else if(new_x < menu_mc.x && menu_mc.x > 300-menu_mc.width){
menu_mc.x=new_x;
}
}


That should give you a little starting idea of what you might do.

Abraham


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]