Ive made a significant coding breakthrough since this post so readers should jump down to my second post
The following is a detailed description of my problem, readers may wish to skip to the last paragraph for a strait forward question without the detailed scenario laid out
ok so in my game the server invokes a create arrow(as in bow and arrow) method, flash recieves this message and builds the arrow, first i create a playerarrow:object = new Object(), then i will give this object properties, such as, hp:int = 100, startx:int = 50, starty:int = 50, and so on. The last property of this object is the movieclip to be shown -- playerarrow.theicon = new theplayerarrow() //theplayerarrow is a library graphic of an arrow, this is exported for actionscript with the flash extends movieclip during the create symbol process
ok so newarrow is invoked, object playerarrow = { hp:100, startx:50, starty:50, theicon:theplayerarrow }
so essentially now i have a movieclip that can have very dynamic properties for later, not just its coordinates, but also things like hit points remaining, thearrowID which is an increment sent by the server for easy referencing etc
now that my object[property, property, property, property, movieclip] has been created, i push this into myarrowarray.push(playerarrow) and gw.addChild(playerarrow.theicon) //gw is just another movieclip i have on stage, you can just think of gw == stage for this example.
so now i have been invoked by the server to create a new arrow, so i built this object dynamically with some passed in variables such as hit points, attach a movieclip representation of the object and then add the OBJECT to an array, and add the object.theicon extension itself to the gamewindow
now when i run the program i can extend my arrow objects icon and my enemy objects icon and hit test them versus one another, this is my actual code
for each(var d in myenemyarray){
if (npa.theicon.hitTestObject(d.orcicon)){ connection.send("arrowhitmonster", npa.arrownumber, d.monsternumber) }}
//npa stands for newplayerarrow
this sends the arrows id and monstersid to the server which is relayed back to all players in the game, then there is a recieved handler function which just takes in the arrowID and monsterID and then gets rid of the monster and the arrow from the stage, the following is just the arrow portion:
===========================================================
//DELETE AND REMOVE ARROW FUNCTION (comprised as two functions to prevent trying to delete already deleted object)
var toDelete2 = false //starts by pretending the object was previously deleted
var indexToDelete2 //the index reference if the object appears in the array
//checks if the arrow exists
for each(var d in myarrowarray) {
if (d.arrownumber == arrowid) { //goes through array and figures out oh, hey, it does exist
trace("this arrow exists")
toDelete2 = true //momentarily flip on the 'if flag' for deletion
indexToDelete2 = myarrowarray.indexOf(d)}} //the index we need to delete it from array
//the actual delete method
if (toDelete2 == true) {
toDelete2 = false; //immediatly flip off ability to delete this object, then proceed
trace("index of arrow is " + indexToDelete2)
var temparrayobject = myarrowarray[indexToDelete2]; //easy reference to the array.index.object
gw.removeChild(myarrowarray[indexToDelete2].theicon); //successfully removes graphic representation
myarrowarray.splice(indexToDelete2.theicon, 1); //code that worked in a previous game for removing array movieclips, however, now that its objects its getting fuddled
**********************************************************
//example :
myarrowarray.splice(indexToDelete2, 1); //this is essentially what i WANT but i get the trace error implicit conversion of object to movieclip
===========================================================
ok now the problem, so even though i can successfully remove the movieclip on myarrowarray{([0], property, property, [movieclip])}, it seems i cant remove the parent object, of type object, from the same array
additionally, in a similar fashion, i can remove the moiveclip (.theicon) potion from the gamewindow-movieclip(or stage if you prefer to think of it) but after the graphic goes away the object must be remaining because this now pictureless object can still hit subsequent monsters behind the first one it touched
OK, so the answer im seeking: clearly the problem lies in that im trying to apply a movieclip built in method addChild, and removeChild to an object and theres a conversion error, what i need to know, in short, is what would be the syntax for the exact same thing but for an object class instead of the movieclip class