Need a helping hand with this please. I have a drag and drop game where you click on an item in a scrolling pane. A instance of that item is attached from the library to mouse and you drag the item to one dropZone. Above the dropZone are 4 brownCircle's. What I am trying to do is everytime you drop an item in the dropZone, that item is then added to a brownCircle until you fill all 4 of the brown circles.
Here is my code so far, everything works apart from the items added to the brownCircles:
var itemList:Array = []
var curr_item;
for (var i = 1; i <= 20; i++)
{
curr_item = itemLine["item" + i];
curr_item.num = i;
curr_item.onPress = function(){
attachMovie("item" + this.num, "newItem", this._parent.getNextHighestDepth());
newItem._x = _xmouse;
newItem._y = _ymouse;
newItem.startDrag();
}
curr_item.onRelease = function(){
newItem.stopDrag();
unloadMovie(newItem);
}
curr_item.onReleaseOutside = function(){
newItem.stopDrag();
unloadMovie(newItem);
if (newItem._droptarget == "/dropZone") {
newItem._x = _root.dropZone._x;
newItem._y = _root.dropZone._y;
newItem.stopDrag();
//trace(this.num);
itemList.push(this.num);
trace(itemList);
for (var i = 1; i <= 4; i++){
addNewItem = "brownCircle" + i;
addNewItem.attachMovie("item" +this.num, "newItem",this._parent.getNextHighestDepth());
}
}else{
unloadMovie(newItem);
}
}
}
- var itemList:Array = []
- var curr_item;
- for (var i = 1; i <= 20; i++)
- {
- curr_item = itemLine["item" + i];
- curr_item.num = i;
- curr_item.onPress = function(){
- attachMovie("item" + this.num, "newItem", this._parent.getNextHighestDepth());
- newItem._x = _xmouse;
- newItem._y = _ymouse;
- newItem.startDrag();
- }
- curr_item.onRelease = function(){
- newItem.stopDrag();
- unloadMovie(newItem);
- }
- curr_item.onReleaseOutside = function(){
- newItem.stopDrag();
- unloadMovie(newItem);
- if (newItem._droptarget == "/dropZone") {
- newItem._x = _root.dropZone._x;
- newItem._y = _root.dropZone._y;
- newItem.stopDrag();
- //trace(this.num);
- itemList.push(this.num);
- trace(itemList);
- for (var i = 1; i <= 4; i++){
- addNewItem = "brownCircle" + i;
- addNewItem.attachMovie("item" +this.num, "newItem",this._parent.getNextHighestDepth());
- }
- }else{
- unloadMovie(newItem);
- }
- }
- }
Would really appreciate any help with this as its doing my head in, Cheers