tags:

views:

273

answers:

2

Hi!

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!

+1  A: 

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}" />
Michael Brewer-Davis
Thx! It works only with parentDocument, though I only can see only one nesting with <mx:Component>, as you said... well, whatever! :D
huff
A: 

It only worked with parentDocument in FLEX 3, but I am so grateful! Thank-you for this!

Noob