1 Reply Latest reply on May 20, 2013 4:02 PM by Bramblethorne

    Spark List replaces first ItemRenderer w/internal typicalItem instantiation.

    Bramblethorne Level 1

      From the View that houses the Spark List component:

       

      protected function creationCompleteHandler():void

      {

         // trace("MakeAToolLearnItView FUNCTION creationCompleteHandler")

          addBlankItem("yell");

          addBlankItem("shout");

          addBlankItem("blather");

          addBlankItem("cry");

      }

       

      protected function addBlankItem(s:String):void

      {

          //trace("MakeAToolLearnItView FUNCTION addBlankItem")

          var len:uint = itemArray.length+1;

          var obj:Object = new Object();

          obj.numberLabel = len;

          obj.scream = s;

          itemArray.addItemAt(obj, itemArray.length);

      }

       

      override protected function getToolData():void

      {

          trace("MakeAToolLearnItView FUNCTION setToolData")

          tooldata = <rows> </rows>;

       

          trace("itemArray.length: "+itemArray.length);

       

          for(var i:uint = 0; i < itemArray.length; i++)

          {

              trace("------ itemArray[i]: "+itemArray[i].p);

              trace("------ itemArray[i].scream: "+itemArray[i].scream);

              trace("------ itemArray[i].behaviorNameTextInput.text: "+itemArray[i].behaviorNameTextInput.text);

       

              var xml:XML =

                  <row>

                      <rowNum>{itemArray[i].numberLabel}</rowNum>

                      <behaviorName>{itemArray[i].behaviorNameTextInput.text}</behaviorName>

                      <behaviorDescription>{itemArray[i].behaviorDescriptionTextArea.id}</behaviorDescription>

                  </row>;

       

              xml.appendChild(itemArray[i].choosePictureButton.getMediaXML());

              tooldata.appendChild(xml);

          }

      }

       

      Console output for that  code snippet: Note: I entered 'a' and 'b' in the TextInput and TextArea components, 'c' and 'd' in the second and so on.

      Note the difference between Red and the Violet. I am all the more confused that it has the proper 'scream' property but is definitely not the one I typed input into... also that my 'length' is 4 (substitution as opposed to addition I suppose)

       

      itemArray.length: 4

      ------ itemArray[i]: LearnItListItemRenderer166

      ------ itemArray[i].scream: yell

      ------ itemArray[i].behaviorNameTextInput.text:

      PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer238

      ------ itemArray[i].scream: shout

      ------ itemArray[i].behaviorNameTextInput.text: c

      PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer274

      ------ itemArray[i].scream: blather

      ------ itemArray[i].behaviorNameTextInput.text: e

      PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer310

      ------ itemArray[i].scream: cry

      ------ itemArray[i].behaviorNameTextInput.text: g

       

      Here is the relevant section of the custom ItemRenderer associated with this Spark List:

       

      [Bindable]

      public var dataProxy:ObjectProxy;

       

      [Bindable]

      public var v:MakeAToolBase;

       

      protected function creationCompleteHandler():void

      {

          trace("LearnItListItemRenderer FUNCTION creationCompleteHander");

          trace("\n------- this:\n"+this);

          dataProxy = new ObjectProxy(data);

           trace("------- My Heart Yearns To: ");

          dataProxy.choosePictureButton = choosePictureButton as ChoosePictureButton;

          dataProxy.behaviorNameTextInput = behaviorNameTextInput as TextInput;

          dataProxy.behaviorDescriptionTextArea = behaviorDescriptionTextArea as TextArea;

          dataProxy.p = this as LearnItListItemRenderer;

      }

       

      And the console output:  Again, note the difference between Red and the Violet, and that there is now 5 (as expected, dataProvider + layout instance) instead of 4, and the order of the trace statements does not reflect the order of object instantiation (yell, shout, blather, cry) and that the 5th object (for measuring) has the property 'yell'.... though I suppose that's to be expected if the first one instantiated is duplicated, properties and all as the typicalItem.

       

      LearnItListItemRenderer FUNCTION creationCompleteHander

       

      ------- this: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer202

      LearnItListItemRenderer FUNCTION creationCompleteHander

      ------- My Heart Yearns To: cry

       

      ------- this: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer238

      LearnItListItemRenderer FUNCTION creationCompleteHander

      ------- My Heart Yearns To: yell

       

      ------- this: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer310

      LearnItListItemRenderer FUNCTION creationCompleteHander

      ------- My Heart Yearns To: blather

       

      ------- this: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVie wNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItVi ew148.SkinnableContainerSkin149.contentGroup.itemList.ListSkin152.Scroller154.ScrollerSkin 155.DataGroup153.LearnItListItemRenderer274

      LearnItListItemRenderer FUNCTION creationCompleteHander

      ------- My Heart Yearns To: shout

       

      ------- this:

      LearnItListItemRenderer166

      ------- My Heart Yearns To: yell

        • 1. Re: Spark List replaces first ItemRenderer w/internal typicalItem instantiation.
          Bramblethorne Level 1

          Setting useVirtualLayout="false" of course fixes all, but I'm rather concerned that this behavior is -very- incorrect.   Seems a bad trade to lose the benefits of the virtual layout if this is a bug. At least it's not rendering an extra very expensive ItemRenderer which was VERY costly in terms of time on an iPad2. Here are the expected results:

           

          MakeAToolView FUNCTION clickMakeAToolButton(LearnItButton)

          MakeAToolView FUNCTION navigateToTool(LearnItButton)

          LearnItListItemRenderer FUNCTION creationCompleteHander

          ------- PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer344

          ------- My Heart Yearns To: yell

          LearnItListItemRenderer FUNCTION creationCompleteHander

          ------- PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer378

          ------- My Heart Yearns To: shout

          LearnItListItemRenderer FUNCTION creationCompleteHander

          ------- PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer412

          ------- My Heart Yearns To: blather

          LearnItListItemRenderer FUNCTION creationCompleteHander

          ------- PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer446

          ------- My Heart Yearns To: cry

          MakeAToolLearnItView FUNCTION setToolData

          itemArray.length: 4

          ------ itemArray[i]: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer344

          ------ itemArray[i].scream: yell

          ------ itemArray[i].behaviorNameTextInput.text: a

          ------ itemArray[i]: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer378

          ------ itemArray[i].scream: shout

          ------ itemArray[i].behaviorNameTextInput.text: c

          ------ itemArray[i]: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer412

          ------ itemArray[i].scream: blather

          ------ itemArray[i].behaviorNameTextInput.text: e

          ------ itemArray[i]: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedVi ewNavigatorSkin8.contentGroup.makeATool.ViewNavigatorSkin13.contentGroup.MakeAToolLearnItV iew327.SkinnableContainerSkin328.contentGroup.itemList.ListSkin331.Scroller333.ScrollerSki n334.DataGroup332.LearnItListItemRenderer446

          ------ itemArray[i].scream: cry

          ------ itemArray[i].behaviorNameTextInput.text: g

          MakeAToolBase FUNCTION saveTool()

          <tool cdate="1369090803000" userid="000000" toolType="Learn-It" version="1" toolName="">

            <filename>000000Tool1369090803000.xml</filename>

            <history>

              <save>1369090811538</save>

            </history>

            <tooldata>

              <rows>

                <row>

                  <rowNum>1</rowNum>

                  <behaviorName>a</behaviorName>

                  <behaviorDescription>behaviorDescriptionTextArea</behaviorDescription>

                  <media type="">

                    <mediaXMLFilename/>

                  </media>

                </row>

                <row>

                  <rowNum>2</rowNum>

                  <behaviorName>c</behaviorName>

                  <behaviorDescription>behaviorDescriptionTextArea</behaviorDescription>

                  <media type="">

                    <mediaXMLFilename/>

                  </media>

                </row>

                <row>

                  <rowNum>3</rowNum>

                  <behaviorName>e</behaviorName>

                  <behaviorDescription>behaviorDescriptionTextArea</behaviorDescription>

                  <media type="">

                    <mediaXMLFilename/>

                  </media>

                </row>

                <row>

                  <rowNum>4</rowNum>

                  <behaviorName>g</behaviorName>

                  <behaviorDescription>behaviorDescriptionTextArea</behaviorDescription>

                  <media type="">

                    <mediaXMLFilename/>

                  </media>

                </row>

              </rows>

            </tooldata>

            <students/>

          </tool>