Groups | Blog | Home
all groups > macromedia flash flashcom > november 2006 >

macromedia flash flashcom : Dynamically create AVPresence



Duderr
11/3/2006 3:28:53 PM
Hey gang,

I am trying to dynamically create AVPresence instances as people log into the
server on each client. Basically trying to re-implement the VideoConference
component.

Unfortunately when I try and create 2 AVPresence it seems they override each
other even if I use different X/Y positions and use seperate Instance names and
setUsername().

If someone could spot out my error that would be great.
This is what I am doing:

var instanceName = "presence_" + username;
_root.attachMovie("FCAVPresenceSymbol", instanceName, 1, {_x:150, _y:150});
_root[instanceName].setUsername(username);
_root[instanceName].connect(connection);

Any help please?
JayCharles
11/3/2006 6:34:01 PM
Not sure without seeing the rest of your code, but something in the attachMovie
argument looks to be a likely culprit.

In this line:

_root.attachMovie("FCAVPresenceSymbol", instanceName, 1, {_x:150, _y:150});

You're defining the depth as 1. If there is already an object at that depth
(like another avpresence), the old one gets removed from the stage.

Try incrementing the depth.
Duderr
11/3/2006 9:20:13 PM
Thanks so much for the reply!

I did not know you couldn't use a depth twice. What if the X/Y is totally
different though?

Also I started incrementing the depth, the new AVPresence appears, but then
dissapears right away. I only get to see the video its streaming for a quick
second then its gone again.

I am doing this in a button click event, is that a problem? Do I have to
instanciate this into an array of AVPresence outside of the button event?

Thanks so much.
AddThis Social Bookmark Button