A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Removing Objects from an Array

Hybrid View

  1. #1
    Junior Member
    Join Date
    Apr 2008

    Removing Objects from an Array

    Hi There

    I'm having a few issues removing an object from an array. I've used the push method from a game class which places an object into an array called Inventory. I'm trying to use the startDrag and StopDrag methods to place it on the stage. Could anyone tell me where may be going wrong.BTW the drag methods are in my main class file and I'm trying to call an object from a different class file.

    Many Thanks


  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    You can use pop(); to remove the top element from the array or maybe even unshift(); to remove the bottom first ( bottom ) element from the array.

    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |

  3. #3
    Actionscript Developer KigD's Avatar
    Join Date
    Jan 2003
    You can also use splice(index,1);
    K2xL - My games, tutorials, message boards, and experiments.

  4. #4
    Junior Member
    Join Date
    Apr 2008

    Removing objects from an inventory Array with the mouse

    Thanks for your comments but this still leaves with a problem. I'm making a drag and drop game and I've got objects populating an array. I have made a new cursor which has a startDrag method attached to it. Everytime I go to the array and drag a new object onto the stage it replaces the mouse cursor for the object in the array. Is there a way to attach objects onto the mouse cursor (By MOUSE_DOWN) so they can be dragged together? Similar to what you would do in an application if you were dragging folders into one another.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center