2 Replies Latest reply on Apr 23, 2010 9:26 AM by dakasadakasadaka

    SpriteVisualElement in for loop

    dakasadakasadaka

      Ok I have more then one camera and I need to place it into SpriteVisualElement.

      I trying ike this:

      public function broadCastMeNow(event:Event):void
         {
          //var camId = comments.selectedItem["o_id"];
          broadCastMe = new broadcastNow(comments.selectedItem["o_id"]);
          for (var i:int = 0; i < comments.selectedItem["o_id"].length; i++)
          {
           connn[comments.selectedItem["o_id"]].addChild(broadCastMe);
          }
         }

       

      But to to insert into SpriteVisualElement and that every one of SpriteVisualElement (cams)  goes in the horizontal way.... didn't work

       

      <s:Panel includeIn="indexObjectState" id="camPanel" width="100%" height="150" title="Live Webcams">


        <s:layout>


                  <s:HorizontalLayout paddingLeft="1" paddingRight="1" paddingTop="1" paddingBottom="1" gap="1" />


              </s:layout>


         <s:Group width="290">


         <s:SpriteVisualElement x="100" id="connn" />


        </s:Group>


      </s:Panel>

       

      So how could I make this work that all of SpriteVisualElement(cams) goes in horizontal next to each other?

        • 1. Re: SpriteVisualElement in for loop
          David_F57 Level 5

          hi,

           

          you set the panel layout but add the sprites to the group which has no layout, you should just add the sprites straight to the panel or use a hgroup which fills the panel and not worry about panel layout.

           

           

          David.

          1 person found this helpful
          • 2. Re: SpriteVisualElement in for loop
            dakasadakasadaka Level 1

            ok,

            But can you say it in codes, becouse I have all cames maded but not seeing all in spritevisualelement only the last one:

            public function broadCastMeNow(event:Event):void
              {
               camId = comments.selectedItem["o_id"];
                broadCastMe = new broadcastNow(camId);
                connn.addChild(broadCastMe);
              }

             

            and

            <s:Panel includeIn="indexObjectState" id="camPanel" width="100%" height="150" title="Live Webcams">
              <s:layout>
                        <s:HorizontalLayout paddingLeft="1" paddingRight="1" paddingTop="1" paddingBottom="1" gap="1" />
                    </s:layout>
               <s:Group width="290">
               <s:SpriteVisualElement x="100" id="connn" />
              </s:Group>
            </s:Panel>

             

            every time someone clicks on start webcam it fires the function  broadCastMeNow.

            but each time it is other value of camId.

            so how could I add it to the panel with  <s:SpriteVisualElement x="100" id="connn" /> next to each other?

            I suppose I need to do something with connn but what?