deviant ART

[x]

Dragging and sliding in Flash

Advertisement
~anagoge:iconanagoge: Mar 27, 2008, 3:28:46 PM
I'm a total beginner with Actionscript. I need to make a slideshow that has say, 10 photos next to each other. When a user clicks on one of them and holds and drags the mouse left and right, the photoset will move left and right as well. When the user lets go, the slideshow should naturally slow down after a second or so and come to a complete stop.

How would I do this?

--
[link] The Work Of [link]

Devious Comments

love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0

*SLOShooter:iconSLOShooter: Mar 27, 2008, 4:05:42 PM
There's a startDrag and stopDrag method that can be called in your on(press) and on(release) events.

As for the friction I think you'll have to code that up in actionscript, there may be scripts made already out there that you could search for though.

--
My religion is simple.
My religion is kindness.
- The Dalai Lama
~KOLNstyle:iconKOLNstyle: Mar 27, 2008, 4:12:02 PM
don't use on() methods for handling buttons. Attach a function to a method and use key handlers. on() is deprecated as of AS3.0
~KOLNstyle:iconKOLNstyle: Mar 27, 2008, 4:16:12 PM
Friction: [link] (Robert Penner's easing classes)
For Dragging and moving: Use key handlers and either movieclips or buttons attached to a function which advances your the photos.

That's basically how you would do this. Once you can load in all your images and thumbnails and have all your obscuring set up, what you would do is tie your thumbnails to your photos and when you click and drag, you call a function which moves along the image until it had reached the correct one, using the easing classes to give it "friction". That's the basic logic which you would need.
*SLOShooter:iconSLOShooter: Mar 27, 2008, 4:19:37 PM
Cheers!

Haven't done any ActionScripting in a while.

--
My religion is simple.
My religion is kindness.
- The Dalai Lama
~KOLNstyle:iconKOLNstyle: Mar 27, 2008, 4:22:00 PM
Actually, as of AS3.0, you can use fl.motion.easing or fl.transitions.easing for "friction". Look at Penner's easing classes in order to get an example of what each type of easing is.
~anagoge:iconanagoge: Mar 27, 2008, 5:11:45 PM
As I say, I'm a complete beginner with Actionscript so I don't really know how to use the AS3 packages. I'm not a coder of any sort. I'm more visual. Can you provide me with the script that I'd need to attach to the movieclip or a link to somewhere that has it? I don't know how to use Penner's classes without a further explanation of how to attach them to a movieclip.

Thanks. :)

--
[link] The Work Of [link]
~KOLNstyle:iconKOLNstyle: Mar 27, 2008, 6:16:29 PM
Google is your friend.
~anagoge:iconanagoge: Mar 27, 2008, 6:41:40 PM
Believe me, I've looked for something that will help me but I can't find anything, hence why I've posted here instead.

--
[link] The Work Of [link]
`summaro:iconsummaro: Mar 27, 2008, 9:00:54 PM
I'll help you out. Hang tight.

--
The DataGrid control is intended for viewing data, and not as a layout tool like an HTML table - Adobe