You have to wait for the "complete" event, then
trace(swfLoaderID.content.numChildren) should be the same as

 

trace(numChildren) on the root of the Flash SWF.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of celumbra
Sent: Sunday, March 23, 2008 1:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: accessing children of flash generated swf

 

Thank you for your response. 

"background" is the id of the SWFLoader tag. 

If the content property is the root of the SWFLoader, shouldn't I be
able to call its children with something like this: 

swfLoaderID.content.numChildren or 
swfLoaderID.content.getChildAt(index); ? 

I think I am missing a step. 

If background is the SWFLoader, would I write 

If .content is the root, does this mean --- In
flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex
Harui" <[EMAIL PROTECTED]> wrote:
>
> A SWFLoader's .content property is the root of the Flash SWF assuming
it
> was published for player 9. What is background?
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of celumbra
> Sent: Saturday, March 22, 2008 11:34 AM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] accessing children of flash generated swf
> 
> 
> 
> I have a vector graphic that originated in Illustrator, which I then
> imported into Flash CS3. I converted the graphic elements to symbols,
> linking them to AS3 classes, and exported the swf to load into Flex 3.
> 
> In Flex, when I load the swf into an Image or SWFLoader tag, I can
> capture a mouseover event for the individual elements in the graphic,
> reading the event.target value just fine and feeding the object to the
> functions I want to operate on the individual elements (to apply
> filters). 
> 
> Now I want to programmatically (and randomly) select the individual
> graphic symbols, but can't seem to read them.
> 
> In this sample code, which is not working, "background" holds Flash
> swf. background.numChildren returns 1, and I cannot seem to read the
> equivalent of background.getSelectedChild(0).numChildren. The 
> underlying symbols are typed as movie clips, but casting the selected
> children as movie clip doesn't seem to help beca
> 
> public function applyRandom():void
> 
> {
> var graphicCount:int = background.numChildren
> var index:int = NumberUtilities.random (0, graphicCount-1, 1);
> var _target:Object;
> 
> _target = Object(background.getChildAt(index));
> applyFilter(_target);
> }
> 
> I've installed Flex Component for Flash CS3 and pulled the individual
> components into Flex, but even if I re-composed the graphic by moving
> the individual symbols back into place, in my initial tests, I am
> running into the same problem.
> 
> Any suggestions would be greatly appreciated.
>

 

Reply via email to