Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-23684

Label throws a 1069 RTE on item selection when using a custom item renderer in DropDownList

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: Adobe Flex SDK 4.0 (Release)
    • Fix Version/s: None
    • Component/s: Spark: DropDownList
    • Labels:
      None
    • Environment:
      Affected OS(s): Mac
      Affected OS(s): Mac OS 10.6
      Browser: Safari
      Language Found: French

      Description

      Steps to reproduce:
      1. Run the following code:
      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
      applicationComplete="applicationCompleteHandler(event)">
      <fx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.events.FlexEvent;

      protected function applicationCompleteHandler(event:FlexEvent):void
      {
      testCombo.dataProvider = new ArrayCollection([

      {label:"Short item", someProperty:"foo"}

      ,

      {label:"This is a much longer item ! It would throw a RTE", someProperty:"bar"}

      ,

      {label:"This is another sample text", someProperty:"foobar"}

      ]);
      testCombo2.dataProvider = new ArrayCollection([

      {label:"Short item", someProperty:"foo"}

      ,

      {label:"This is a much longer item ! It would throw a RTE", someProperty:"bar"}

      ,

      {label:"This is another sample text", someProperty:"foobar"}

      ]);
      }

      ]]
      >
      </fx:Script>

      <s:DropDownList id="testCombo" labelField="label" horizontalCenter="0" verticalCenter="0" width="300">
      <s:itemRenderer>
      <fx:Component>
      <s:ItemRenderer>
      <s:HGroup verticalAlign="middle" width="100%">
      <s:Label text="

      {data.label}"/>
      <s:Label text="{data.someProperty}"/>
      </s:HGroup>
      </s:ItemRenderer>
      </fx:Component>
      </s:itemRenderer>
      </s:DropDownList>

      <s:ComboBox id="testCombo2" labelField="label" horizontalCenter="0" verticalCenter="50" width="300">
      <s:itemRenderer>
      <fx:Component>
      <s:ItemRenderer>
      <s:HGroup verticalAlign="middle" width="100%">
      <s:Label text="{data.label}

      "/>
      <s:Label text="

      {data.someProperty}

      "/>
      </s:HGroup>
      </s:ItemRenderer>
      </fx:Component>
      </s:itemRenderer>
      </s:ComboBox>
      </s:Application>

      2. In the DropDownList, select the 2nd or 3rd item

      Actual Results:
      The spark Label class throws a 1069 error (translated from French):
      ReferenceError: Error #1069: Property -1 cannot be found on _AS3_.vec.Vector.<flash.display::DisplayObject> and there is no default value.
      at spark.components::Label/truncateText()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:1246]
      at spark.components::Label/http://www.adobe.com/2006/flex/mx/internal::composeTextLines()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:485]
      at spark.components.supportClasses::TextBase/measure()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\TextBase.as:533]
      at mx.core::UIComponent/measureSizes()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8042]
      at mx.core::UIComponent/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7966]
      at mx.managers::LayoutManager/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:617]
      at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:733]
      at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

      Expected Results:

      • No RTE
      • The item is actually selected

      Workaround (if any):
      Not found. Tried the following things, none of them work:

      • replace the inline renderer with an external file renderer
      • use plain strings as items in the ArrayCollection
      • set the dataprovider from MXML rather than from code

      More info:

      • As you can see, selecting the first item in the list is working correctly, it seems that the problem is related to the lenght of the item renderer
      • The ComboBox is working perfectly with the same configuration
      • I'm using flash player debugger version 10.1 beta
      • JDK is Apple's 1.6 latest release

        Attachments

          Activity

            People

            • Assignee:
              adobejira Adobe JIRA
              Reporter:
              adobejira Adobe JIRA
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: