Highlighted

Loding swfs into main app

New Here ,
Oct 19, 2016

Copy link to clipboard

Copied

Hi all,

I've having a big problem with one of my apps.

'I have one main app that supposed to load a lot of external swfs(around 40-50) with code in all, I tried to add them in the package but Flash Animate hangs when I try to compile.(If I reduce it to around 10 it works). To get around this I made a zip with all the externals and made some functions for dowloading that zip an unpacking them to the application folder but then I get the "Uncompiled Actionscript"-error instead.

Please does someone know of a way to solve this without starting to migrate my swfs to a smaller amount of files?

Best regards

/magnus

TOPICS
Development

Views

445

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Loding swfs into main app

New Here ,
Oct 19, 2016

Copy link to clipboard

Copied

Hi all,

I've having a big problem with one of my apps.

'I have one main app that supposed to load a lot of external swfs(around 40-50) with code in all, I tried to add them in the package but Flash Animate hangs when I try to compile.(If I reduce it to around 10 it works). To get around this I made a zip with all the externals and made some functions for dowloading that zip an unpacking them to the application folder but then I get the "Uncompiled Actionscript"-error instead.

Please does someone know of a way to solve this without starting to migrate my swfs to a smaller amount of files?

Best regards

/magnus

TOPICS
Development

Views

446

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 19, 2016 0
Adobe Employee ,
Oct 19, 2016

Copy link to clipboard

Copied

Hi Magnus,

Could you please help us further with below queries:

1. Your application is designed for, which platform (iOS or Android)

2. It will be very helpful for us if you can provide a sample code snippet through which you are downloading the zip and unpacking them to the application folder.

If your application is iOS specific there are certain points that need to be addressed at the time of development for such application:

- Please specify exceptions to the default behavior by adding keys to InfoAdditions tag of application descriptor of your app.

- Please refer to below blogs on loading external swf for AIR apps on iOS:

https://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air-apps-on-i...

Packaging and loading multiple SWFs in AIR apps on iOS

Thanks,

Adobe AIR Team

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 19, 2016 0
New Here ,
Oct 19, 2016

Copy link to clipboard

Copied

Hi and thanks for your time!

Zipp functionality works great, everything loads fine and I can read the "library"-xml inside without problem, it's when I load the first swf the problem from the unzipped folder i get this error "Uncompiled Actionscript"(some things are hardcoded here just to see that all linkages are working )

The code for zip functionality:

-- code  --

//// ---------------------------------------

//// -------------Download zip  --------------

//// ---------------------------------------

var _urlReq;

var _urlStream;

var _fileData;

var _file

var _writeFileStream

var zipName;

downLoadFile("http://bluwall.se/sfi/bostad.zip","bostad.zip")

function downLoadFile(_url,_name){

  zipName = _name;

  _urlReq = new URLRequest(_url);

  _urlStream = new URLStream();

  _urlStream.addEventListener(flash.events.ProgressEvent.PROGRESS, progressHandler, false, 0, true);

  _urlStream.addEventListener(Event.COMPLETE, saveFileToDisc);                      

  _urlStream.addEventListener(flash.events.IOErrorEvent.IO_ERROR, errorHandler, false, 0, true);

  _urlStream.load(_urlReq);

}

function progressHandler(e:ProgressEvent):void {

  trace("Downloadprogress: " + Math.round(100 * (e.bytesLoaded / e.bytesTotal)));

}

function errorHandler(evt:flash.events.IOErrorEvent):void {

  trace("Error: " + evt.text);

}

var fileData:ByteArray = new ByteArray();

var fileName:String;

var fileLocal:File;

function saveFileToDisc(event:Event):void 

    { 

  trace("SaveFileToDisk");

        _urlStream.readBytes (fileData, 0, _urlStream.bytesAvailable); 

        resolveFile(); 

    }

function resolveFile():void {

  trace("resolveFile_1");

  fileLocal = File.applicationStorageDirectory.resolvePath(zipName); 

  var fileStream:FileStream = new FileStream(); 

  fileStream.addEventListener(Event.CLOSE, fileSaved); 

  fileStream.openAsync(fileLocal, FileMode.WRITE); 

  fileStream.writeBytes(fileData, 0, fileData.length); 

  fileStream.close();

}

function outputProgressHandler(event:OutputProgressEvent):void{

    if (event.bytesPending == 0){

        trace("File is completely written");

    }

}

function filestreamErrorHandler(evt:flash.events.IOErrorEvent):void {

  trace("SaveError: " + evt.text);

}

function fileSaved(closeEvent:Event):void {

  trace("File saved");

  unZipFolder();

}

var _ex:ZipManager = new ZipManager();

_ex.addEventListener(ZipManagerEvent.START, onStart);

_ex.addEventListener(ZipManagerEvent.ERROR, onError);

_ex.addEventListener(ZipManagerEvent.PROGRESS, onProgress);

_ex.addEventListener(ZipManagerEvent.COMPLETED, onComplete);

     function onStart(e:ZipManagerEvent):void

     {

             trace("zip process started...");

     }

   

     function onError(e:ZipManagerEvent):void

     {

             trace("zip process ERROR: " + e.param.msg);

     }

    

     function onProgress(e:ZipManagerEvent):void

     {

             trace("zip Progress = " + e.param.perc + "%");

     }

    

     function onComplete(e:ZipManagerEvent):void

     {

             trace("zip process finished");

             unzippingDone();

     }

     function unZipFolder(){

         trace("try to unzip!!-->"+zipName)

          _ex.unzip(File.applicationStorageDirectory.resolvePath(zipName), File.applicationStorageDirectory.resolvePath("bostad"));

     }

     var directory;

     function unzippingDone(){

      

      directory = File.applicationStorageDirectory.resolvePath("bostad/bostad");

       var list:Array = directory.getDirectoryListing();

       trace("Number of files:"+list.length)

       for (var i:uint = 0; i < list.length; i++) {

            trace("-->File:"+list.nativePath);

       }

       getXml("bostad/bostad/parts.xml");

}

//----------------------------------------------------------

//  --- loading files from application folder, this function gets called everytime I like to open one of the downloaded swfs

//----------------------------------------------------------

     function startLoad(_u)

     {

            trace("---U----"+_u)

            var url2:File = File.applicationStorageDirectory.resolvePath("bostad/bostad/"+_u);

            var mRequest:URLRequest = new URLRequest(snd_url2.url);

            txt_title.text=_u;

            mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);

            mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);

            mLoader.contentLoaderInfo.addEventListener(Event.INIT, onInitHandler);

            var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

            mLoader.load(mRequest,lc);

     }

     function onCompleteHandler(loadEvent:Event)

     {

          var m = new MovieClip();

          m.addChild(loadEvent.currentTarget.content);

          kap_holder.addChild(m);

          loadedClip=m;

          kap_holder.visible=true;

          kap_holder.alpha=0;

          TweenLite.to(kap_holder, .3, {alpha:1});

          mc_loaderbar.visible=false;

     }

-- code end -------

I've looked att the examples you provided links for but don't really follow, as I understand I should add stripped version of all my swf to the package and the upload the zip with unstripped versions to my server and then excange the one in the package on runtime? If so the I still have the problem with to many files in the package and Flash won't compile.

Best regards and big thanks for the help!

/magnus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 19, 2016 0
New Here ,
Oct 19, 2016

Copy link to clipboard

Copied

Hi again,

it's designed to work on both ios and android.

/magnus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 19, 2016 0
Adobe Employee ,
Oct 20, 2016

Copy link to clipboard

Copied

Hi Magnus,

Are you using the below tag in your app.xml?

<iPhone>

  .

  .

  <externalSwfs>assets/SampleSWFInfoFile.txt</externalSwfs>

  .

  .

</iPhone>

Screen Shot 2016-10-20 at 3.36.55 PM.png

Thanks,

Adobe AIR Team

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 20, 2016 0
m_wallon LATEST
New Here ,
Oct 24, 2016

Copy link to clipboard

Copied

Hi,

I'm sorry for my late replay. I tried to do as suggested, but when I try to compile that it ask for those files that I have added to the textfile. So that would meen that I have to add all my swfs to the package anyway? Feels like I'm missing something here.

Best regards

/magnus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 24, 2016 0