I have to access a function in child swf from parent swf. This child
swf gets loaded into a canvas object in parent.swf. Everything works
fine but I'm unable to call any function that was in child.swf.
My code is

Code:

    var swf1:SWFLoader = new SWFLoader();
    swf1.source = "CHILD.swf";
    can.addchild(swf1);

I read on google and then I tried this in parent.swf's code

Code:

    var myrequest:URLRequest = new URLRequest("CHILD.swf");
    var myloader:Loader = new Loader();
    myloader.load(myrequest);
    canvas.addchild(myloader);

Now this one throws up a runtime error TypeError: Error #1034: Type
Coercion failed: cannot convert flash.display::loa...@5934b01 to
mx.core.IUIComponent.

I also tried this
Code:

    var myrequest:URLRequest = new URLRequest("CHILD.swf");
    var myloader:Loader = new Loader();
    myloader.load(myrequest);

     var uic:UIComponent = new UIComponent();
     uic.addChild(myloader);
     canvas.addChild(uic);

But in this case my swf does not show up at all and there are no
runtime errors too!

How do I resolve this error and how do I then access the function in
child.swf?

PLEASE HELP GUYS.....

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to