dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Drag & Dop like a rubber

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    4

    Drag & Dop like a rubber

    Hi Forum

    I am looking for a 'how to' for following things:

    An object hanging on a rubber band

    on mouse down: drag object anywhere
    on mouse up: object moves back to his 1st place
    on click: next page

    If possible the object has to move like on a rubber band

    Has someone any ideas?

  2. #2
    Junior Member
    Join Date
    Apr 2008
    Posts
    4
    Hi Forum

    I am looking for a 'how to' for following things:

    An object hanging on a rubber band

    on mouse down: drag object anywhere
    on mouse up: object moves back to his 1st place
    on click: next page

    If possible the object has to move back like on a rubber band

    Has someone any ideas?

  3. #3
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Find some articles on Dynamic Animation, surf this forum and google for "rubber effect in Flash using math" or something like that. You can't achieve this without math.



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  4. #4

  5. #5
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    Actually, I believe that it is possible to achieve this without using math, though I will say that using math will possibly give you better & more customizable results. In a nutshell:
    You could use the Tween class & the Elastic Tween style to get the "rubbery springing back" effect & you could use the lineTo function (in an onEnterFrame) to create the actual "rubber band". I have used this method in throwing together a quick example last year - in this small, unfinished example you can drag the weight hanging at the top of the screen around, & you can also drag it down to the "magnet" or "U" at the bottom of the screen & it will stick :
    http://mediadump.arsenikcandy.com/_CS/TTP/_studies/
    1 Infinite Loop, Cupertino is a portal of Hell.

  6. #6
    Junior Member
    Join Date
    Apr 2008
    Posts
    4
    Hi

    Thank you for the great tips! I am a very newbie - I will try it. gotoAndCrash, do you have a usable source?

  7. #7
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    I don't have a source for that, it was made too long ago. I've got a bunch of work tonite, but I'll try & throw something together in the next day or two, to get you started. Things you can research in the meantime :
    Robert Penner's Tween Class, & the Elastic Tween method within the class
    Drawing Lines dynamically with the Drawing API & onEnterFrame events - you can probably find a tutorial that wraps these two things up on Kirupa.com.
    1 Infinite Loop, Cupertino is a portal of Hell.

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