A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Return MC to last position (not an specific one)

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    2

    Return MC to last position (not an specific one)

    Hello, I'm trying to make like a chess board table, then I need to drag and drop MCs on some drop areas and when it fails gets returned to the last position it was.

    on (release) {
    this.stopDrag();
    if(this._droptarget =="/dt1")
    {
    this._x=_root.dt1._x;
    this._y=_root.dt1._y;

    } else if(this._droptarget =="/dt119")
    {
    this._x=_root.dt119._x;
    this._y=_root.dt119._y;

    } else if(this._droptarget =="/dt120")
    {
    this._x=_root.dt120._x;
    this._y=_root.dt120._y
    }

    // if not, return the droppable object to a predefined position, using the
    // x and y coordinates. (but I want it to return to the last position it was instead)
    else{
    this._x= 55;
    this._y= 255;

    }
    }

    Hope you can help me, thnx

  2. #2
    Junior Member
    Join Date
    Apr 2014
    Posts
    2
    Oks, thnks any way I just resolve it just adding a Variable, hope this anwer helps to someone else...

    on (press) {
    var X:Number = this._x
    var Y:Number = this._y
    this.startDrag();
    ...
    ...
    ...

    else{
    this._x= X;
    this._y= Y;

    }
    }

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