-
How do I set boundaries for a movieclip??
I have a movieclip that follows the mouse movement..
like in my footer
What code do I use to set up parameters.
e.g. if(movieclip._x<260)
stop)
Say I didn't want my spinning cube to touch the edge..
Is this right? I know I'm close but I can't get it to work.
Somebody please help..
[Edited by itchyfella on 05-03-2001 at 10:06 AM]
-
you need to set up a 2 frame loop to track where the drag is. in frame one try the following
if(_root.movieclip._x <0)
StopDrag
do the same for the values for top bottom left and right in the first fram, in the second frame you just need a go to and play
you don't have to do this you can do it with javascript functions but i don't know how thats done
-
Here is the code I used for the spinning box below... "play" being the box.As you can see I haven't used the startdrag action.. This has really got me stumped.
onClipEvent (enterFrame) {
_root.anim.play._x = _root.anim.play._x + (_root.anim._xmouse-_root.anim.play._x)/10;
Does anyone know how to set up boundaries while using the code above?
-
Modding with Class
Can't you just use the boundaries of the startDrag command? You can specify the area that your movie clip is retained in.
-
When I use the startdrag action and input the boundaries...
My moviclip disappears which sounds like the co-ordinates are incorrect.. but I've checked it a dozen times,,
there must be another way..
-
Hi..
Providing your using the spinning cube scenerio as an example then you can use the following. Place it on the affected MC:
onClipEvent (enterFrame) {
if (this._x>300) {
this._x=300;
} else if (this._x<100) {
this._x=100;
}
}
onClipEvent (mouseMove) {
this._x=_root._xmouse;
}
The second part of this code is only there for examples sake, so you can remove that part.
Hope this helps.
-
Thankyou Marx...
You allowed me to go to sleep...
I would have been up all night otherwise..
Thats exactly what I was looking for and now I'll know it forever..
Goodness to you and everyone else that gave a helping typo.
itchyfella
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
|