MetalMewtwo
Member
|
For Tauguy quote:
Ok, im trying to do a temp. inventory, and im using this code as the function: currentslotnum = 1; _root.evidence._visible = false; function addToslot (item) { if (!item.found) { item._x = eval ("_root.evidence.itemSlot" + currentslotnum)._x; item._y = eval ("_root.evidence.itemSlot" + currentslotnum)._y; item.found = true; currentslotnum++; } } evidence is a movieclip which contains a load of inventory slots when you click on something this function is supposed to happen to it ^^^ it works if the slot is in the root. timeline and I remove the evidence from the code, but I need it in a movieclip so it can be visible/invisible on various button clicks. any ideas what sort of basic error im making?/quote] I tried remaking what you did, and surprisingly, and the same thing happened! I tried modifying things. I went inside one of the itemslots, moved it a bit away from its registration point, then i played the swf and found the item appeared in the _x of the timeline instead. This will show you whats happening: http://spamtheweb.com/ul/upload/260309/5743_inventorytest2.swf -at first, if you click the item, it will put itself to the far upperleft -now refresh the page -inside the evidence box, drag the upper left box and move it to the right. Then click the item. The item will always be at the upperleft of that itemslot for some reason. /////////////////// I've seen the inventory system you're using alot of times, and i believe its useless with complicated games. After you put the item into the slot, the item is still clickable, and would probably still animate/trigger if you dont want it to. So i suggest using attachMovie. It's MUCH more lengthier, but it works. Its currently 1am in the morning where i live, so i made some quick adjustments, though its not completely done. http://spamtheweb.com/ul/upload/260309/3851_inventorytest.swf using this code in the timeline: currentslotnum = 1; addToslot = function () { _root.evidence["itemslot"+currentslotnum].attachMovie("redy1", "redy1"+currentslotnum, 1000+currentslotnum); currentslotnum++; }; this code in the item: on (release) { _root.addToslot.call(); this.swapDepths(2); this.removeMovieClip(); } and when i turned that circle into a symbol, i also gave it the linkage name of "redy1" /////////////////// My way of making inventory systems is VERY long in terms of code. It takes 100 lines for every item... plus 50 more for the item itself and linkage... But from an old work i dug up, i once made myself a perfect inventory system... http://spamtheweb.com/ul/upload/260309/4613_my_own_inventory_system_2_testing.swf -arrowkeys to move, and you can click on the circles when they're inside the boxes to delete them. Well i hope you find this helpful
< Message edited by MetalMewtwo -- 3/26/2009 1:45:45 >
|