Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-09-2007, 08:31 AM   #1
Ritika_S
Ritika
 
Join Date: Oct 2006
Location: Kolkata
Posts: 54
Red face attaching movieclip to mouse

Hi guys

This is what my original post was:
http://www.actionscripts.org/forums/....php3?t=140294

Now that i have achieved in randomly rotating my menu items, i have to try and attach the current menu item on which my mouse rests to the mouse. This has a defined area, if the mouse moves out of that area the menu item goes back and to its original position. Also when the mouse is over the particular item the current item should have the highest depth on the stage.

here's my code for rotating the menu items:

ActionScript Code:
var numPoints:Number = 4; var fl:Number = 300; var vpX:Number = Stage.width/2; var vpY:Number = Stage.height/2; dx = 10; dy = 10; init(); function init() { //attaching the movieclips var point3:MovieClip = attachMovie("point3", "point3", this.getNextHighestDepth()); point3.x = Math.random()*200-100; point3.y = Math.random()*200-100; point3.z = Math.random()*200-100; var point1:MovieClip = attachMovie("point1", "point1", this.getNextHighestDepth()); point1.x = Math.random()*200-100; point1.y = Math.random()*200-100; point1.z = Math.random()*200-100; var point2:MovieClip = attachMovie("point2", "point2", this.getNextHighestDepth()); point2.x = Math.random()*200-100; point2.y = Math.random()*200-100; point2.z = Math.random()*200-100; } //rotation of the movieclips function onEnterFrame():Void { var angleY:Number = (_xmouse-vpX)*.001; var cosY:Number = Math.cos(angleY); var sinY:Number = Math.sin(angleY); var angleX:Number = (_ymouse-vpY)*.001; var cosX:Number = Math.cos(angleX); var sinX:Number = Math.sin(angleX); for (var i:Number = 1; i<numPoints; i++) { var point:MovieClip = this["point"+i]; var x1:Number = point.x*cosY-point.z*sinY; var z1:Number = point.z*cosY+point.x*sinY; var y1:Number = point.y*cosX-z1*sinX; var z2:Number = z1*cosX+point.y*sinX; point.x = x1; point.y = y1; point.z = z2; if (point.z<=-fl) { point._visible = false; } else { point._visible = true; var scale:Number = fl/(fl+point.z); point._xscale = point._yscale=scale*100; point._x = vpX+point.x*scale; point._y = vpY+point.y*scale; point.swapDepths(-point.z); } } }

how should i go about it?
Thanks for your help guys.
Ritika_S is offline   Reply With Quote
Old 07-10-2007, 05:26 AM   #2
Ritika_S
Ritika
 
Join Date: Oct 2006
Location: Kolkata
Posts: 54
Unhappy

hey guys..
went through a few tutorials about attaching a movieclip to mouse but somehow that doesn't seem to work on my file...
if i keep the navigation static it works but not on the rotating one...

what should i do.. anyone please...
Ritika_S is offline   Reply With Quote
Old 07-10-2007, 06:26 AM   #3
Ritika_S
Ritika
 
Join Date: Oct 2006
Location: Kolkata
Posts: 54
Default

ok fine i tried putting this code...kinda works ...not exactly what i wanted but somewhat. but now the problem is that the navigation doesn't go back to its rotating position once i have rolled out of them..
Thats because ofcourse i deleted the onEnterFrame but otherwise the script wasn't working.. now how do i make them go back to original rotating state?
ActionScript Code:
function over() {     speed = 10;     scale = 20;     this._xscale += scale;     this._yscale += scale;     delete _root.onEnterFrame;     this.onEnterFrame = function() {         this._x += (_root._xmouse-this.lastX)/speed;         this._y += (_root._ymouse-this.lastY)/speed;         this.lastX = this._x;         this.lastY = this._y;         dx1 = this._x+100;         dy1 = this._y+100;         dx2 = this._x-100;         dy2 = this._y-100;         if (_xmouse>dx1 || _ymouse>dy1 || _xmouse<dx2 || _ymouse<dy2) {             delete this.onEnterFrame;             this._xscale -= scale;             this._yscale -= scale;         }     };     }

this is just the script for the over state of the menu items..
Ritika_S is offline   Reply With Quote
Old 07-10-2007, 07:33 AM   #4
Ritika_S
Ritika
 
Join Date: Oct 2006
Location: Kolkata
Posts: 54
Default

okay fine
i managed to make the movieclips rotate again.
I did this by distributing the script through a number of frames...
but the revert back to rotation is very jerky...

since on rollout i ask make the movie play from frme1 again where the original points are being attached.. so they are getting attached all over again at random positions...which is what i s'pose is causing the jerk...how do i store the original posion and start rotating it from there?
Ritika_S is offline   Reply With Quote
Old 07-10-2007, 12:34 PM   #5
Ritika_S
Ritika
 
Join Date: Oct 2006
Location: Kolkata
Posts: 54
Default

man...
i m really gone crazy...doing this

i tried calling a function which stores all the values of current positions of the points...no use

can anyone please have a look and tell me what should be the approach...
Ritika_S is offline   Reply With Quote
Old 07-11-2007, 04:52 AM   #6
Ritika_S
Ritika
 
Join Date: Oct 2006
Location: Kolkata
Posts: 54
Unhappy

nobody....

plz someone help.....
Ritika_S is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
movieclip move when mouse is moving? lsatdown ActionScript 2.0 3 09-19-2006 01:20 PM
how can i interact with a movieclip using a rightclick mouse command julbackz ActionScript 1.0 (and below) 4 11-21-2005 02:12 PM
MovieClip mouse events & recursivity gring ActionScript 2.0 1 11-20-2005 10:40 PM
Disabling Mouse Events for buttons hidden by movieclip dravenPT ActionScript 2.0 2 09-21-2004 02:36 PM
Mouse and Any MovieClip Collision Detection pixelwit ActionScript 1.0 (and below) 5 12-16-2001 05:15 PM


All times are GMT. The time now is 02:06 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.