A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Image moving around - detecting border of SWF and bouncing

Hybrid View

  1. #1
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    code:

    onClipEvent (load) {
    x = 0;
    // you'll need to adjust both of these quantities.
    minX = -400; // minimum value for this._x
    maxX = 400; // maximum value for this._x
    }

    onClipEvent (enterFrame) {
    if (x < 0)
    {
    if (this._x + x < minX) this._x = minX;
    else this._x += x;
    }
    else if (x > 0)
    {
    if (this._x + x > maxX)this._x = maxX;
    else this._x += x;
    }
    // simplified these...
    if (_root._xmouse<50) {
    if (x>-3) {
    x -= 0.15;
    }
    }
    if (_root._xmouse>715) {
    if (x<3) {
    x += 0.15;
    }
    }
    }

    Last edited by jbum; 10-16-2004 at 01:18 PM.

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