Sorry for the late reply. Modify the example so the SWFLoader line looks
like this:

    <mx:SWFLoader id="myLoader" width="300"
        source="local.swf"
        creationComplete="initNestedAppProps();"/>

This loads the SWF at runtime, rather than embedding it. The example
shuld now work.

Stephen
    

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of pinkmongrel
Sent: Thursday, May 25, 2006 6:45 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] "Embedding Swf files" Help sample broken. Need to
refer to symbols at runtime.

I need to load swf's that include many symbols which I need to reference
dynamically at runtime.

I am able to embed and link to symbols whose name I know at compile time
using:

[Embed(source='shapes.swf', symbol='greenSquare')] [Bindable] public var
imgCls:Class;

I won't know some of my symbol names until runtime.

In the Help page "Embedding SWF files" there is an example of
referencing a symbol by using a string parameter:

The heart of it is:
----
         public var loadedSM:SystemManager;
            [Bindable]
            public var loadedLabel:Label;

            // Initialize variables with information from
            // the loaded application.
            private function initNestedAppProps():void {
                loadedSM = SystemManager(myLoader.content);
                loadedLabel = loadedSM.application["lblOne"];
            }
---
When I run the example I get a type conversion error at this line:
               loadedSM = SystemManager(myLoader.content);
(Droog3 is the project name.)
 ---
TypeError: Error #1034: Type Coercion failed: cannot convert
[EMAIL PROTECTED] to
mx.managers.SystemManager.
        at Droog3/::initNestedAppProps()
        at Droog3/__myLoader_creationComplete()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/set initialized()
        at mx.managers::LayoutManager/::doPhasedInstantiation()
        at mx.core::UIComponent/::callLaterDispatcher2()
        at mx.core::UIComponent/::callLaterDispatcher()
---

Did the example get broken by the move to beta 3? Did type conversion
rules for the SystemManager get more strict?

I'd love any help with this. Again, I need to get at a symbol using a
string parameter, as in the example:

loadedSM.application["lblOne"];

Thanks.







------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
You can search right from your browser? It's easy and it's free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to