Avatar.init

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
svizzari
Posts: 64
Joined: 18 Jun 2010, 11:55

Avatar.init

Post by svizzari »

Hey -- Just wondering, should an avatar instance always be on the display list when it's init method is called?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Not necessarily. In fact the avatar could be out of sight when created, which means it isn't in the display list.
Paolo Bax
The SmartFoxServer Team
svizzari
Posts: 64
Joined: 18 Jun 2010, 11:55

Post by svizzari »

hi bax -- I see...

The reason I asked was that my Avatar subclass implements the Flex ILayoutManagerClient interface to be able to be invalidated via the LayoutManager. Invalidation is core to our programmatic approach.

I was experiencing some strange behaviour from my Avatar subclasses related to when they were appearing on the display list and when they were first being invalidated.

So, would it be fair to say that, in OpenSpace, viewport management is achieved by adding and removing elements from the display list? From what I can see, the avatar.destroy method is only fired when the map is 'disposed of'.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

svizzari wrote:So, would it be fair to say that, in OpenSpace, viewport management is achieved by adding and removing elements from the display list? From what I can see, the avatar.destroy method is only fired when the map is 'disposed of'.
Yes, that's exactly how OpenSpace works. To improve the scrolling performance, only visible tiles are added to the display list. As avatars are contained inside the tiles, they follow the same rule.
Also, the destroy method is called whenever an avatar leaves the map too.
Paolo Bax
The SmartFoxServer Team
svizzari
Posts: 64
Joined: 18 Jun 2010, 11:55

Post by svizzari »

Hi bax -- so, referring back to an earlier post of mine, it sounds like the view related functionality already exists within the OpenSpace system to determine whether a particular tile is on-screen ;)
Post Reply