How to use a DisplayObject as the source of a <flow:img/>
I have a text flow that I am loading from an external file that has this snippet of xml in it:
...
<flow:p>
<flow:img styleName="chart" id="fig1" height="250"/>
</flow:p>
...
What I need to do is put a Flex chart in place of that image. I tried the following before passing my TextFlow into the thing that displays it.
var flow:TextFlow = TextConverter.importToFlow("sample.xml", TextConverter.TEXT_LAYOUT_FORMAT);
var figs:Array = flow.getElementsByStyleName("chart");
for (var i:int = 0; i < figs.length; i++) {
if (figs is InlineGraphicElement) {
var id:String = FlowElement(figs).id;
var figure:DisplayObject = getFigure(id);// <-- this returns an instance of my chart
InlineGraphicElement(figs).source = figure;
}
}
The result is that nothing happens, I don't see my chart, just an empty space. My understanding was that you can set a DisplayObject as the source of the InlineGraphicElement as described at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/frames.html?http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html&http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/all-classes.html&filter_flex=4&filter_flashplayer=10&filter_air=1.5
The difference is that I am not creating my flow programatically but I wouldn't expect that to make a difference. I am using Flex 3.4 though. Could that be the difference?
