I recently added a room list to the flash Simple MMO World example. I am having problems removing the avatars of the previous room from the stage before joining the new room. I looked at the Avatar Chat example and saw that they used this:
Code: Select all
while (panel_chat.avArea.avContainer.numChildren > 0)
removeAvatar(getAvatar(0))
I modified it to this and added to the onRoomJoin function:
Code: Select all
while (mapArea.avContainer.numChildren > 0)
removeAvatar(getAvatar(0))
This isn’t working though, when I initially join a room I get this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
If I join a room after that I get the following error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
I looked through the Avatar Chat example and saw that the removeAvatar and getAvatar functions are identical to the removeAvatar and getAvatar functions in the Simple MMO World example so I’m not sure why I’m getting this error. Any help would be greatly appreciated.
Thanks,
Scott