#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2006
    Location
    America
    Posts
    146
    Rep Power
    9

    Question Why won't inventory work inside a mc?


    Hi, I made an inventory and it works, the problem is that I need it to be inside a movieclip (menu) but it won't work. Here's how I made it:

    I made movieclips that are squares with no fill and gave the instance "itemSlot" + number (I made 16). Then I added this code to the main actions frame:
    Code:
     currentslotnum = 1;
    stop ();
    function addToslot (item) {
     if (!item.found) {
     item._x = eval ("itemSlot" + currentslotnum)._x;
     item._y = eval ("itemSlot" + currentslotnum)._y;
     item.found = true;
     currentslotnum++;
     }
    }
    And items are movieclips smaller than the slots with instance "item" + number with this code:

    Code:
    onClipEvent (enterFrame) {
     if (_root.player.hitTest (this)) {
     _root.addToslot (this);
     }
    }
    ("player" is the user)

    It works, I've tested it, but only when it is out of the movieclip. Can anyone tell me how to make this work inside the movieclip?

    Thanks in advance
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2004
    Location
    Hampshire, UK
    Posts
    990
    Rep Power
    315
    try

    _root["itemSlot" + currentslotnum];

    or if the itemSlot mc is in a differnt container the reference that instead of _root
    Scott Perham, BSc (hons), CCNA, MCPD

IMN logo majestic logo threadwatch logo seochat tools logo