1

I've imported an FXG from illustrator from Adobe illustrator into flash builder 4.5 and have managed to get it on the stage, the problem I'm facing is accessing the children of the FXG.

Basic FXG that won't work:

<?xml version="1.0" encoding="utf-8" ?>
<Graphic xmlns="http://ns.adobe.com/fxg/2008" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:flm="http://ns.adobe.com/flame/2008">
    <Group id="subChild">
        <Group id="subSubChild" />
    </Group>
</Graphic>

I then try to access these children like so:

var fooObj:MyFxgObj = new MyFxgObj();
fooObj.getChildByName("subChild");

Which promptly greets me with a null error. I've searched google for the past 2 hours or so but to no avail, so any help would be appreciated.

Kara
  • 6,115
  • 16
  • 50
  • 57
  • I didn't think it was possible. FXG elements exist at a different level than ActionScript objects or native flash objects. I view an FXG file as a single asset; kind of like a JPG. What do you want to do that you need to access children of an FXG? Would using MXML Graphics be a better choice for you? – JeffryHouser Nov 22 '11 at 19:35
  • You're right, I exported everything in MXML and it works fine now. Thanks. – James Dardry Nov 23 '11 at 15:49
  • Great; I posted it as a formal answer, then. Please select it as such at your earliest convenience. – JeffryHouser Nov 23 '11 at 16:25

2 Answers2

0

Accessing FXG children is possible and explained in the Adobe doc Using FXG.

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
0

Since you said my comment was your solution, here it is as a formal answer:

I didn't think accessing the children of an FXG graphic was possible. I think FXG assets exist at a different level than ActionScript objects or native flash objects. I view an FXG file as a single asset; kind of like a JPG or PNG or embedded SWF.

If you need to access the children, using MXML graphics is the approach you should consider.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59