|
-
back to the starting position
I've made a menu you can drag accros the screen. I also made a box where the menu is fixed in, when the animation starts.
Now I want to alow the visetor to put the menu back in its exact start position. And this by simply dragging the menu over the box and when is left there for more then 5 seconds it slides back in it's original place.
I've came up with this:
onclipevent(enterframe){
if(this.hittest(_parent.menu)==true){
_parent.menu._x=-50;
_parent.menu._y=-100;
}
}
Last edited by simpelendidi; 06-23-2003 at 04:19 PM.
www.flashflow.be
-
Okay,
You need a way to know the initial X and Y of the object in question.
To do this you would use the onclipevent(load) handler.
EG;
onclipevent(load){
_parent.startx=_parent.menu._x
_parent.starty=_parent.menu._y
}
Okay now the way you have it written now is that when _parent.menu is hit it will move along the x axis to -50 fips and along the y axis to -100 fips. Is this what you want? Or do you want it slide there?
In order to slide it 50 and 100 you would need it to read like this;
_parent.menu._x -=50;
_parent.menu._y -=100;
If you want it to move when not hit then it should probably be checking for a false right?
anyhow...
onclipevent(enterframe){
if(this.hittest(_parent.menu)==false)
{
if(_parent.menu._x> _parent.menu.startx)
{
_parent.menu._x -=50;
}
if(_parent.Menu_y> _parent.menu.starty)
{
_parent.menu._y -=100;
}
}
}
-
I've tried some of these scripts and I've came up with this :
http://www.flashflow.be/slide.html
You have to click on menu to drag it. When you move it back down it will take the start position.
Thanks for the help.
-
That is pretty neat.
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
|