Flash mx 2004 -drag & drop - do I use a movie clip or buttons or both?

Hi all I’ve been looking around at tutorials which involve drag / drop of shapes both on a canvas and onto target areas.

There seems to be different information being given about what needs creating for this effect to be created. Some tutorials tell you to simply convert the shape into a movie clip and then add the necessary action script to the shape.
http://www.tutorialized.com/view/tutorial/Drag-and-drop-objects-using-mouse-in-Flash-MX-2004./8272

Other tutorials on the other hand say that you should create a movie clip for the shape first, then create as button within the movie clip and then finally add the action script code into the button itself?
http://www.actionscript.org/resources/articles/26/1/Drag-n-Drop-and-Drop-Targets/Page1.html

The second web site says that you can’t attach ‘on’ events to a movie clip i.e. on click, on press etc whilst you can’t drag buttons either, only movie clips…so why do both examples work or what is the logic behind these decisions please?

I’ve also seen the colour book tutorial on kirupa that converts shapes to movie clips and then buttons as well, I just dont know which is the best method to do it?

Some of them over simple… and wind up being technically wrong.

You can make a MC into a button with AS

you need startDrag() functionality

you make it sound more complex than it is

surely there is a tut here on this?

I suggest you look into onClipEvent(mousePress){}

Thanks to the people who replied, I must admit to still being confused though. I just wanted to know if either way was actually right / wrong as one has an explanation saying you can’t do something in which the other tutorial has done to create the same effect?

Movieclips can not have on() commands, for example on(release) or on(press), put or used on them.

I’m not really sure what you are talking about here mate, there is no “wrong” or “right” way to drag anything, but using movieclips and programming it from the main timeline.

Hi gigaboost the confusion surrounds the issue that although you have said a movie clip can’t have any on() commands added to it, I have seen and used for practice purposes a tutorial which does exactly that
[FONT=Arial]http://www.tutorialized.com/tutorial/Drag-and-drop-objects-using-mouse-in-Flash-MX-2004./8272

The code complied and no errors are reported, yet I also see in other places where it says this can’t be done and I need to create a movie clip and add a button within this?
[/FONT]

There are always more than one way to skin a cat…use whichever method that you’re most comfortable with.

on handlers can be added directly to buttons within a movieclip and this method has been available since Flash Player 2. onClipEvent handlers were added with Flash Player 5. The onPress handler was added with Flash Player 6. Those tutorials have obviously been written as the Flash Player versions have developed, which is why they offer different methods.

The reason why there are examples of movieclips containing buttons is because, prior to the introduction of onClipEvent handlers, there was no way of making a movieclip clickable in the same way as a button. But the technique, while antiquated, still works.

The recommended approach for MX would be to use the movieclip.onPress handler (http://www.wildform.com/tutorials/draganddrop/) with all code contained on your main timeline but, as I said at the beginning, you can use whichever method you’re most familiar with.