A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: back to the starting position

  1. #1
    Senior Member
    Join Date
    Sep 2002
    Posts
    106

    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

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    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;
    }
    }
    }

  3. #3
    Senior Member
    Join Date
    Sep 2002
    Posts
    106
    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.
    www.flashflow.be

  4. #4
    Senior Member
    Join Date
    Jun 2001
    Posts
    289
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center