View Full Version : attachedMovieClip + drag and drop

04-26-2007, 07:10 AM

I'm still very new to Flash so this might be a stupid qustion to bother you guys with, but no the less are the tears pressing and the frustration is enomous! :D

I'm trying to build a simple real time stragy engine where when a sudden area is clicked and hold a copy of the clicked button is made and startdrag() is launched on the new item. When the item then is draged onto the map and realeased the new copy is left there.

The best code so far is: (placed on the item that should be clickable)

var number = 0;
onMouseDown = function() {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
var numberAndDepth = getNextHighestDepth();
_root.attachMovie(this._name, this._name+numberAndDepth, numberAndDepth);
_root[this._name+numberAndDepth]._x = this._x;
_root[this._name+numberAndDepth]._y = this._y;
onMouseUp = function() {
if (this.hitTest(_root._xmouse, _root._ymouse)) {

Hope that somebody is able to help me out!