Just to follow up for anyone else trying this, I was able to reference
things via SWFLoader dynamically. I had to drag the movie clip to the stage
and give it an instance name "ball_instance" then in Flex I did
swfLoader.content.root["ball_instance"]["label_txt"].text="hello dynamic
world!";
I didnt have any success with getDefinitionByName with AS3Preview published
swfs.
Tried "ball_mc" "ball_instance" "ball_document_classname" and some
combinations of pathing to those "swfLoader.content.root.ball_mc" etc
On 1/4/07, Rick Schmitty <[EMAIL PROTECTED]> wrote:
Thanks Roger,
I was exporting as an AS3 SWF, I used these options on the symbol, is this
correct? (see attached) Is auto generated ok or should I write my own
generic class definition for each object in the library?
Thanks again
On 1/2/07, Roger Gonzalez <[EMAIL PROTECTED]> wrote:
>
> Symbols don't exist in AS3, there are only classes.
> If you exported the SWF from Flash as an AS3 SWF, you should be able to
> use getDefinitionByName to find the class instance in the dynamically loaded
> SWF.
>
> The compiler knows how to reference old-style Flash symbols at compile
> time (via Embed). However, this is only for older SWFs. You can't
> reference an AS3 class this way.
>
> -rg
>
> ------------------------------
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Rick Schmitty
> *Sent:* Friday, December 29, 2006 11:50 AM
> *To:* [email protected]
> *Subject:* [flexcoders] How do you load library symbols without
> embedding via SWFLoader?
>
> Hi all, trying to load some assets from a Flash AS3Preview project but
> I can't figure out how to specify the symbol when loading dynamically
>
> Here's the flex example
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
> <mx:Script>
> <![CDATA[
> [Bindable]
> [Embed(source="/ball.swf", symbol="ball_mc")]
> public var swf:Class;
>
> public function debug():void {
> trace("set break point here and inspect swfLoader.content vs
> swfLoaderEmbed");
> swfLoaderEmbed.content["label_txt"].text="Hello World!";
> }
> ]]>
> </mx:Script>
>
> <mx:SWFLoader id="swfLoader" source="ball.swf"/>
> <mx:SWFLoader id="swfLoaderEmbed" source="{swf}"/>
>
> <mx:Button label="click" click="debug()"/>
>
>
> </mx:Application>
>
> Ball.swf is a simple ball contained in ball_mc in the library, and it
> has a text field in that object of the name label_txt
>
> How do I work in the symbol=xxx aspect of the embed into the SWFLoader
> that is loading dynamically? This library could potentially be very
> large and I'd rather not embed the whole thing up front
>
>
>