A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Adding a mouse event into a script (rotator menu)

  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    48

    Adding a mouse event into a script (rotator menu)

    I am creating a rotating menu. This is the code in each one of the 4 buttons inside the menu.

    PHP Code:
    onClipEvent(load){
        
    y=0;
        
    speedR=5;
        
    radius=100;
        
    xcenter=393/2;
        
    ycenter=325/2;
        
    zcenter=100;
        
    angle=0;
        
    fl=150;
        }

        
    onClipEvent(enterFrame){
        
    _x=Math.cos(angle*Math.PI/180)*radius+xcenter;
        
    _y=y+ycenter;
        
    z=Math.sin(angle*Math.PI/180)*radius+zcenter;
        
    scale=fl/(fl+z);
        
    _xscale_yscale scale*100;
        
    angle+=speedR;
        if(
    angle>359){
        
    angle-=360;
        }

        } 
    How can I add a mouse event in which slows down the speed of the button or stop the menu of moving??

    Thank you

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe you can adapt this to what you are trying to do...

    On main timeline...
    Code:
    var isOver = false;
    On clips...
    Code:
    onClipEvent (load) {
    	y = 0;
    	speedR = 5;
    	radius = 100;
    	xcenter = 393 / 2;
    	ycenter = 325 / 2;
    	zcenter = 100;
    	angle = 0;
    	fl = 150;
    	this.onRollOver = function() {
    		_root.isOver = true;
    	};
    	this.onRollOut = function() {
    		_root.isOver = false;
    	};
    }
    onClipEvent (enterFrame) {
    	_x = Math.cos(angle * Math.PI / 180) * radius + xcenter;
    	_y = y + ycenter;
    	z = Math.sin(angle * Math.PI / 180) * radius + zcenter;
    	scale = fl / (fl + z);
    	_xscale = _yscale = scale * 100;
    	angle += ((_root.isOver) ? 0.5 : speedR);
    	if (angle > 359) {
    		angle -= 360;
    	}
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center