|
Selteco.com > FlashDesignerZONE.com >
Tutorials > T1029
startDrag and stopDrag in ActionScript.by Alan BurkhartDRAG MULTIPLE OBJECTS FROM A SINGLE ACTIONSCRIPT If you need to be able to drag several objects (one at a time) in a single frame this is a good way to get it done. You can click and drag either of the rectangles below:
NOTE: Minimum Flash Designer version 5.0.17 (verify revision number under "Help" > "About...", download update if required) Follow the steps below:
Next, highlight and copy the script below, then right-click on the frame (not a rectangle) and click ActionScript in the context menu. Paste the script into the dialog and change the Sprite number to match yours (Change "Sprite5" to "Sprite3" for example) if needed.
Sprite3.onPress = function()
{ Sprite3.startDrag(); }; Sprite3.onRelease = function() { Sprite3.stopDrag(); }; Sprite4.onPress = function() { Sprite4.startDrag(); }; Sprite4.onRelease = function() { Sprite4.stopDrag(); }; Click the Preview button to see the results of your labor. HINT: To drag a text object, it's easier if you place the text on top of a rectangular shape and group them, then convert them to a sprite. Otherwise, the mouse pointer has to be directly over the text to drag it. You'll "miss" if you point and click between the letters. You can make the shape the same color as your background and it won't be noticed. See also: _droptarget property
|
|
Products
|
Purchase
|
Downloads
|
Support
|
Flash Tutorials
|
Contact
Copyright © 1999-2013 Selteco Software, Inc. www.selteco.com, ph: +1 810 377 5778 |