A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: drag object only left to right

  1. #1
    Junior Member
    Join Date
    May 2003
    Location
    Chicagoland area
    Posts
    23

    drag object only left to right

    I'm new to actionscript. I have figured out how to make an MC draggable however I am trying to restrict the movement. I am trying to make a MC draggable only left to right or right to left but not up or down. I assume this is very simple but I can't seem to figure it out.

    Any help will be greatly appreciated.

    Thanks,
    redfred1969

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    24
    Hey there redfred1969!

    One quick qestion do u want it to follow it all the time? cause if u do then add this to the MC

    onClipEvent(enterFrame){
    this.x=_root.xmouse;
    }

  3. #3
    flashdevil
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    665
    or on mousedown:

    onClipEvent(mouseDown){
    this._x=_root._xmouse;
    }

    you also can check with hittest if the mouse is above the mc, insert this in an if-loop and it will only drag when your mouse is over the mc.
    fifkikker.com
    fresh flash developer, with style.

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