Cross-domain loading module to local application

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Cross-domain loading module to local application

    Crying for help!

    I've spend loads of time trying to solve the problem. Googling doesn't
    give any solutions, so it's time for the experts :)

    I need application running on local machine (swf file on Desktop) to
    download a module from server and display it.

    So far I can download it, set the applicationDomain, but how to
    display it?

    Local app.:
    ================================================== =
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="setup()">
    <mx:Script>
    <![CDATA[
    import mx.events.ModuleEvent;
    import mx.controls.Alert;
    import flash.system.ApplicationDomain;
    import flash.system.Security
    import mx.modules.*;
    import mx.core.UIComponent;
    private var go:String = "http://some.domain/browse.swf";
    public var loader:Loader = new Loader();
    private var uicomp:UIComponent = new UIComponent();
    private var panel:Panel = new Panel();

    public function setup():void {
    Security.allowDomain("some.domain");
    Security.loadPolicyFile("http://some.domain/crossdomain.xml");
    handleGo();
    }

    private function handleGo():void {
    var request:URLRequest = new URLRequest(go);
    var loaderContext:LoaderContext = new LoaderContext();
    loaderContext.applicationDomain = ApplicationDomain.currentDomain;
    loaderContext.checkPolicyFile = true;
    // loaderContext.securityDomain = SecurityDomain.currentDomain; //
    LOCAL SWF files may not set LoaderContext.securityDomain
    loader.contentLoaderInfo.addEventListener(Event.CO MPLETE,
    modComplete);
    loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR,
    def);
    loader.load(request, loaderContext);
    }
    private function modComplete(event:Event):void{
    // Alert.show(loader.contentLoaderInfo.childAllowsPar ent.toString(),
    "ch"); // gives TRUE
    // Alert.show(loader.contentLoaderInfo.parentAllowsCh ild.toString(),
    "p"); // gives TRUE

    // Now if I go with following:

    uicomp.addChild(loader.content);
    panel.addChild(uicomp);
    panel.width = 200;
    panel.height = 200;
    mainCanvas.addChild(panel);

    // It showes only a panel but no module content inside :(

    }

    private function def(event:Event):void{
    Alert.show(event.toString(), event.type);
    }
    ]]>
    </mx:Script>
    <mx:Canvas id="mainCanvas" width="100%" height="100%" />
    </mx:Application>
    ================================================== =

    Remote mod.:
    ================================================== =
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
    percentWidth="100" percentHeight="100">
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%"
    height="100%" backgroundColor="#ffffff">
    <mx:Text text="test text 1"/>
    <mx:Text text="test text 2"/>
    </mx:HBox>
    </mx:Module>
    ================================================== =


    HELP!

    Bzyku Guest

  2. Similar Questions and Discussions

    1. Issues when loading Flash Player from Local Domain
      I have a webcam streaming to Flash Media Server via the Media Encoder. I have published the .swf file with the flash player and...
    2. Cross domain CF access
      'lo all, I'm trying to host my .swf file on one domain, but have the flash remoting call CF on another domain (ie totally separate web servers)....
    3. Cross domain xml loading
      I?m trying to get some xml data loaded into flash across domain. I have the crossdomain.xml file in place and everything works fine in flash player...
    4. Cross domain sessions
      Hi, I'm building a shopping cart system, which is almost complete if it wasn't for this bug (grrr). The site has about 10 domains pointing to it,...
    5. Cross domain webservice
      Hi, We have developed a webservice that retrieves Free/Busy information from the Exchange Server and returns it to the client. The webservice...
  3. #2

    Default Re: Cross-domain loading module to local application

    To all interested with the subject:

    [url]http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=587&threadid=1248635[/url]

    no strait answer at the moment, but I'm not giving up. I'll keep you
    posted.
    B.

    Bzyku Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139