Highlighted

copy from internet and loading in IPAD.

Participant ,
Oct 03, 2016

Copy link to clipboard

Copied

Dear Friends,

iam using the following code to copy from internet and loading in IPAD.

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.net.FileReference;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import flash.display.Loader;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;

var file_url: String = "";
var lc: LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
var ldr: Loader = new Loader();

DownloadFileMobileAS3();
function DownloadFileMobileAS3() {
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
createLoader();
}
function createLoader(): void {
// TODO Auto-generated method stub
var urlLoader: URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, complete_handler);
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load(new URLRequest("http://www.abc.com/test.swf"));
}

function complete_handler(event: Event): void {
var data: ByteArray = event.target.data;
var fileStream: FileStream = new FileStream();
fileStream.addEventListener(Event.CLOSE, fileWritten);
trace("something copied...");
txt.text = "something copied...";
fileStream.open(new File(File.documentsDirectory.nativePath + "\\test.swf"), FileMode.WRITE);

file_url = File.documentsDirectory.nativePath +"\\test.swf";

fileStream.writeBytes(data, 0, data.length);
fileStream.close();
load_file();
}

function fileWritten(e: Event): void {
trace("File Saved to Desktop");
}

function load_file() {
ldr = new Loader();
var req: URLRequest = new URLRequest(file_url);
ldr.load(req, lc);
//ldr.load(req);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loading_finished);
}

function loading_finished(event: Event) {
trace("loading finished");
addChild(ldr);
}

All are working fine in computers, when I install in IPAD its not working. pls check and answere me if iam missing some....

Thanks and Regards,

Syed Abdul Rahim

TOPICS
Development

Views

228

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

copy from internet and loading in IPAD.

Participant ,
Oct 03, 2016

Copy link to clipboard

Copied

Dear Friends,

iam using the following code to copy from internet and loading in IPAD.

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.net.FileReference;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import flash.display.Loader;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;

var file_url: String = "";
var lc: LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
var ldr: Loader = new Loader();

DownloadFileMobileAS3();
function DownloadFileMobileAS3() {
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
createLoader();
}
function createLoader(): void {
// TODO Auto-generated method stub
var urlLoader: URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, complete_handler);
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load(new URLRequest("http://www.abc.com/test.swf"));
}

function complete_handler(event: Event): void {
var data: ByteArray = event.target.data;
var fileStream: FileStream = new FileStream();
fileStream.addEventListener(Event.CLOSE, fileWritten);
trace("something copied...");
txt.text = "something copied...";
fileStream.open(new File(File.documentsDirectory.nativePath + "\\test.swf"), FileMode.WRITE);

file_url = File.documentsDirectory.nativePath +"\\test.swf";

fileStream.writeBytes(data, 0, data.length);
fileStream.close();
load_file();
}

function fileWritten(e: Event): void {
trace("File Saved to Desktop");
}

function load_file() {
ldr = new Loader();
var req: URLRequest = new URLRequest(file_url);
ldr.load(req, lc);
//ldr.load(req);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loading_finished);
}

function loading_finished(event: Event) {
trace("loading finished");
addChild(ldr);
}

All are working fine in computers, when I install in IPAD its not working. pls check and answere me if iam missing some....

Thanks and Regards,

Syed Abdul Rahim

TOPICS
Development

Views

229

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 03, 2016 0
Adobe Employee ,
Oct 03, 2016

Copy link to clipboard

Copied

Hi Syed,


Request you to please go through Flash Player Help | Release Notes | Flash Player® 20 AIR® 20  and check under iOS SDK upgrade section. Please let us know if modifying your code as per instructions mentioned in release notes works for you.

Thanks,

Ankit

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 03, 2016 0
Participant ,
Oct 03, 2016

Copy link to clipboard

Copied

HI Ankit,

Thanks for your reply. I tried it, but not working same I cannot copy files to my ipad. Is there any way to copy files from internet to ipad and use as asset for our app?

Thanks and Regards,

Syed Abdul Rahim

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 03, 2016 0
Adobe Employee ,
Oct 05, 2016

Copy link to clipboard

Copied

Hi Syed,

Our team is following up  with you via forum thread Re: Download assests from internet in Air for 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 05, 2016 0
Participant ,
Oct 05, 2016

Copy link to clipboard

Copied

HI Ankit,

Thanks a lot... sure I wil try this and tell u...

Thanks and Regards,

Syed Abdul Rahim

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 05, 2016 0