473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

StopDrag, add item ++

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:

Expand|Select|Wrap|Line Numbers
  1. var itemList:Array = []
  2.  
  3. var curr_item;
  4. for (var i = 1; i <= 20; i++)
  5. {
  6.     curr_item = itemLine["item" + i];
  7.     curr_item.num = i;
  8.     curr_item.onPress = function(){
  9.         attachMovie("item" + this.num, "newItem", this._parent.getNextHighestDepth());
  10.         newItem._x = _xmouse;
  11.         newItem._y = _ymouse;
  12.         newItem.startDrag();
  13.     }
  14.     curr_item.onRelease = function(){
  15.         newItem.stopDrag();
  16.         unloadMovie(newItem);
  17.     }
  18.      curr_item.onReleaseOutside = function(){
  19.         newItem.stopDrag();
  20.         unloadMovie(newItem);
  21.         if (newItem._droptarget == "/dropZone") {
  22.             newItem._x = _root.dropZone._x;
  23.             newItem._y = _root.dropZone._y;
  24.             newItem.stopDrag();
  25.             //trace(this.num);
  26.             itemList.push(this.num);
  27.             trace(itemList);
  28.             for (var i = 1; i <= 4; i++){ 
  29.             addNewItem = "brownCircle" + i; 
  30.             addNewItem.attachMovie("item" +this.num, "newItem",this._parent.getNextHighestDepth()); 
  31. }
  32.         }else{
  33.             unloadMovie(newItem);
  34.             }
  35.     }
  36. }
  37.  
Any help would be appreciated! Thanks
Jan 17 '08 #1
0 1241

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: tuvok | last post by:
I have an Item object which allocates memory in its ctor and frees it in its dtor. I want to add such items to a vector. But the program crashes. Why? How do I fix it? #include <vector> ...
2
by: Ash Jones | last post by:
I trying to do nested items in a collection. I've got an item which one of the properties is subitems, which is a collection of item. can do the root level but if i do a subitem at design time i...
7
by: Devron Blatchford | last post by:
Hi there, I have created an owner draw menu item using DrawItem and MeasureItem in VB.NET. This seems to work well. I was wondering how I can do mouse over effects in these menus. Basically the...
3
by: Dean Slindee | last post by:
In a checked listbox, I am allowing drag/drop of the items within (resequencing). Problem is, when dropping a checked item, the checked state always reverts to unchecked (unwanted). Anyone know...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
6
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
1
by: HKSHK | last post by:
Hi guys, I have a problem with the combo box I'm writing on. What I want is custom items, which are fine so far, but when I select one the combo box shows the project name...
3
by: Bmack500 | last post by:
I have a sub, and a class. The sub is like this: Sub dothis() Dim aInfoListX As New infoWrapperClass aInfoListX.params = ReadConfig() Dim sqlCMD As New SqlCommand aInfoListX.sqlCmd = sqlCMD ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.