0 Replies Latest reply on Jan 8, 2012 1:03 PM by Marauder64r

    video itemrenderer and netstream

    Marauder64r Level 1

      Hi! I'm trying to do videochat and decided to use itemrenderer and list component, but i think i have some problem with binding netstream. ArrayCollection looks like {name:UserName, rating:Rating, stream:NetStream Object} When i'm start my programm it's ok for 2 users but when smbd connect video objs change position and usernames are not similar with them, how can i solve this problem? here is example of I.R.

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"

                                              xmlns:s="library://ns.adobe.com/flex/spark"

                                              xmlns:mx="library://ns.adobe.com/flex/mx"

                                              autoDrawBackground="true">

       

                <fx:Script>

                          <![CDATA[

                                    [Bindable]

                                    public var stream:NetStream;

       

                          ]]>

                </fx:Script>

                <fx:Binding source="{data.stream}" destination="stream"/>

                <s:BorderContainer id="bc" width="200" height="180" backgroundColor="#DEDEDE"

                                                           dropShadowVisible="true" borderVisible="false">

                          <mx:UIComponent id="uic" width="200" height="164">

                                    <mx:creationComplete>

                                              <![CDATA[

                                              var video:Video = new Video;

                                              video.width = uic.width;

                                              video.height = uic.height;

                                              uic.addChild(video);

                                              if(stream == null){

                                              var c:Camera = Camera.getCamera();

                                              c.setMode(320,240,30);

                                              video.attachCamera(c);

                                              }else{

                                              video.attachNetStream(stream);

                                              }

                                              ]]>

                                    </mx:creationComplete>

                          </mx:UIComponent>

                          <s:HGroup x="10" y="167" width="44" height="11" verticalAlign="middle">

                                    <s:Image width="14" height="13" smooth="true" smoothingQuality="high" source="img/user.png"/>

                                    <s:Label color="#005281" depth="1" fontWeight="bold" text="{data.name}"/>

                          </s:HGroup>

                          <s:HGroup x="144" y="167" width="44" height="11" verticalAlign="middle">

                                    <s:Image width="14" height="15" source="img/топ юзеров.PNG"/>

                                    <s:Label color="#C1761E" depth="2" fontWeight="bold"

                                                         text="{data.rating}" textAlign="right"/>

                          </s:HGroup>

                </s:BorderContainer>

      </s:ItemRenderer>