0 Replies Latest reply on Jun 1, 2013 7:09 AM by SourceSkyBoxer

    Flex 4.6.1: Fzip + SWFLoader, Loader or ModuleLoader = ZipLoader??

    SourceSkyBoxer Level 1

      Hey Folks,

       

      i have big problem with resized container.

       

      I have tested before without compressed swf files ( only *.swf goes SWFLoader = It works fine... SWFLoader works resized and scalabled mode. GOOD!

       

      I have got an awesome idea with zip file - if i pack any swfs into zip file.

      I have written:

       

      MainApp.mxml:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                 xmlns:s="library://ns.adobe.com/flex/spark" 
                                 xmlns:mx="library://ns.adobe.com/flex/mx"
                                 creationComplete="initApp()">
              
              <fx:Script>
                      <![CDATA[
                              import deng.fzip.FZip;
                              import deng.fzip.FZipFile;
                              
                              import mdm.Application;
                              
                              import flash.system.LoaderContext;
                              
                              private var zip:FZip = new FZip();
                              private var zipfile:URLRequest;
                              
                              private function initApp():void {
                                      //mdm.Application.init();
                                      
                                      zipfile = new URLRequest(/*mdm.Application.path+*/"module.zip");
                                      zip.addEventListener(Event.COMPLETE, onComplete);
                                      zip.load(zipfile);
                              }
                              
                              private function onComplete(e:Event):void
                              {
                                      try
                                      {
                                              var file:FZipFile = zip.getFileAt(0);
                                              file.filename = "SubApp.swf";
                                              var myLoader:Loader = new Loader();
                                              myLoader.loadBytes(file.content);
                                              
                                              var context:LoaderContext = new LoaderContext();
                                              context.allowCodeImport = true;
                                              contentLoader.loaderContext = context;                 
                                              contentLoader.addChild(myLoader);
                                      }catch (error:Error){
                                              /*      Error Message  */
                                      }
                                      
                              }
                      ]]>
              </fx:Script>
              <mx:SWFLoader id="contentLoader" left="0" top="0" width="100%" height="100%" autoLoad="true"/>             
      </s:Application>
      
      

       

      And SubApp.mxml:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                 xmlns:s="library://ns.adobe.com/flex/spark"
                                 xmlns:mx="library://ns.adobe.com/flex/mx">
              <s:layout>
                      <s:VerticalLayout paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" verticalAlign="middle" horizontalAlign="left"/>
              </s:layout>
              <s:Label text="label one"/>
              <s:TextInput width="100%"/>
              <s:Label text="label two"/>
              <s:TextArea width="100%" height="100%"/>
      </s:Application>
      
      

       

      Compiled and pack into module.zip!

      Look more pictures:

      http://my.funpic.de/show-photo/742149-PIC.png

       

      Flash Player loads swf from zip.

      http://my.funpic.de/show-photo/742151-PIC.png

      It works fine....

       

      But i am shying because swfLoader won't resize and rescale? Oh no...

      http://my.funpic.de/show-photo/742495-PIC.png

       

      Why does it happen? Container was happen...

       

      How do i fix with resizing and scaling mode

       

      Thanks,

       

      regards,

       

      Jens-Peter