-
swapDepth issue
Hi !
I`m trying to make a game where I drag and drop items from an inventory to scene. If the item doesn´t hit its target, it goes back to inventory when released. The problem is after I click and drag any item and release it and move to another scene the item I dragged duplicate itself in inventory. So far I have 3 items but the problem occurs always on 1st item I drag.
I.E. I have a circle, a star and a square. If I drag the circle, release it and move 2 scenes to left or right, I can drag it again, but a circle copy remains in inventory. The star and square works ok.
I`m attaching a fla.
Sure someone will help me.
Thanks in advance.
test.fla
-
Designer, Programmer, Musician
remove the _root.x +=2; from the on(press) of all the movieclips. That seems to be the issue. Now i ask, what's the _root.x +=2; supposed to do? And ._x and not .x , however I don't see any difference with or without that code...
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Designer, Programmer, Musician
And change the
this.swapDepths(_root.x);
with: this.swapDepths(_root.getNextHighestDepth());
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
Hi,
The main problem is the fact you are putting the buttons/clips on the stage manually, hence giving them a negative depth (-16637).
So swapping depths with the manually placed buttons/clips kind of makes a copy of it and does not remove the original buton/clip.
To use swap Depths properly the buttons/clips should be placed on the stage dynamically, giving them a positive depth(+166337).
i think this is more what you require.
CS5: fla and swf
-
Designer, Programmer, Musician
I noticed the issue the same day I replied, but I didn't have time to upload my .fla, and I couldn't connect to internet until today. But I made exactly what fruitbeard did ( i have not seen his .fla, but I believe is something very similar. Attached, a zip file with 2 .fla's, one with a for loop that controls multiple movieclips ( more advanced) and another one more simple. http://www.mediafire.com/download/ir...59apj/Test.zip
Last edited by angelhdz; 09-27-2013 at 10:27 AM.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|