0

I have a <mx:Script> on the main file, where I define this:

[Bindable]
private var dpCols:ArrayCollection = new ArrayCollection([
{'prx':'bl', 'nmb':'Blanco', 'ral':'RAL1013', 'hex':'E8E4CD'},
{'prx':'am', 'nmb':'Amarillo', 'ral':'RAL1005', 'hex':'C79E03'},
{'prx':'gr', 'nmb':'Gris Perla', 'ral':'RAL7045', 'hex':'8E939E'}
 ]);

I can use it as a dataProvider in many places, but not here:

<mx:TileList dataProvider="{dpCols}">
    <mx:itemRenderer>
    <mx:Component>
        <mx:Box backgroundColor="{int('0x' + data.hex)}"
            height="64" width="72">
            <mx:Label text="{data.ral}" textAlign="center" width="100%"/>
            <mx:Label text="{data.nmb}" textAlign="center" width="100%"/>
        </mx:Box>
    </mx:Component>
    </mx:itemRenderer>
</mx:TileList>

This TileList is within a <radg:RaDG> (my subclass for AdvancedDataGrid), <radg:columns>, <mx:AdvancedDataGridColumn>, <mx:itemEditor> and <mx:Component>. If I put it outside, it just works. But I need it to put it has the itemEditor.

How should I refer to dpCols then? (or how can I solve this error?)

Thanks!

huff
  • 1,954
  • 2
  • 28
  • 49

1 Answers1

1

You need outerDocument, since you're inside the <mx:Component> tag. See the "Using the Component Tag" section in this Adobe docs page or this SO question.

If you're getting particularly tricky with nesting, you may need to use parentDocument instead, but it sounds like outerDocument should work in your case (only one nesting of <mx:Component> tags).

Usage:

<mx:TileList dataProvider="{outerDocument.dpCols}" />
Community
  • 1
  • 1
Michael Brewer-Davis
  • 14,018
  • 5
  • 37
  • 49
  • Thx! It works only with parentDocument, though I only can see only one nesting with , as you said... well, whatever! :D – huff Feb 22 '10 at 06:48
  • If you move your inline component or ItemRenderer into it's own file then you need to change `outerDocument` to `owner.parentDocument` or `owner.document` since `outerDocument` is a property provided only to the inline `fx:Component` tag. This information is in the link to the Adobe docs in the answer above. – 1.21 gigawatts Oct 13 '15 at 04:07