Skip to main content
Inspiring
October 18, 2016
Question

Down load swf from internet with script in Air for IOS

  • October 18, 2016
  • 0 replies
  • 196 views

Dear Friends,

Greetings! iam trying to down load asset swf from internet and saving in IPAD with the help of Air for IOS. I loading that locally saved swf for my app. iam using the following code, its downloading and loading fine. Its working fine in computer (Windows), when I pack and install in IPAD, it loading (swf) only animation and images not script. I don't know why script Is not working.. it is running like a loop.

import flash.display.Loader;
import flash.net.URLLoader;
import flash.filesystem.*;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.system.LoaderContext;

downloadFile("http://www.examplesite.com/test.swf");

//---------------------------------Downloading files - Starts------------------------------------------------
function downloadFile(file_location): void {
var urlLoader: URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, download_completed);
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load(new URLRequest(file_location));
}

function download_completed(event: Event): void {
var data: ByteArray = event.target.data;
copy_files(data, "test.swf");
}

function copy_files(data_val, path) {
var fileStream: FileStream = new FileStream();
txt.text = "something copied...";
fileStream.open(File.applicationStorageDirectory.resolvePath(path), FileMode.WRITE);
fileStream.writeBytes(data_val, 0, data_val.length);
fileStream.close();
down_data();
txt.text =" something copied... " + File.applicationStorageDirectory.resolvePath(path).exists;
//---------------------------------Downloading files - Ends------------------------------------------------
menu1_les1.addEventListener(MouseEvent.CLICK, m1click);
function m1click(event: MouseEvent) {
req.url = "app-storage:/test.swf";
ldr.load(req, lc);
addChild(ldr);
}

Please help me to solve this issue friends...

Thanks in advance,

Syed Abdul Rahim

This topic has been closed for replies.