Skip to main content
Participant
November 3, 2006
Question

Dynamically create AVPresence

  • November 3, 2006
  • 2 replies
  • 252 views
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?
    This topic has been closed for replies.

    2 replies

    DuderrAuthor
    Participant
    November 3, 2006
    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.
    November 3, 2006
    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), it gets removed from the stage.

    Try incrementing the depth.