Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:36:39+00:00 2026-06-14T22:36:39+00:00

when using Air+AS3 for Android, how do I download a png from aserver? Also,

  • 0

when using Air+AS3 for Android, how do I download a png from aserver?

Also, where do I store it so that it later can be used without downloading again?

Regards
Mirza

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:36:39+00:00Added an answer on June 14, 2026 at 10:36 pm
    1. Better store your file in ApplicationStoragePath so that you can avoid some security (access denied) problem.
    2. Make sure writeBytesToFile() need to specify file path with file name extension as well (like “images/first.png”)

      private function download(url:String):void
      {
          var urlRequest:URLRequest = new URLRequest();
          urlRequest.url = url;
      
          var urlStream:URLStream = new URLStream();
          urlStream.addEventListener(Event.COMPLETE,onDownload_CompleteHandler);
          urlStream.addEventListener(IOErrorEvent.IO_ERROR, onDownload_IOErrorHandler);
          urlStream.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS,onDownload_ResponseStatusHandler);
          urlStream.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onDownload_SecurityHandler);   
          urlStream.load(urlRequest); 
      }
      
      protected function onDownload_CompleteHandler(event:Event):void
      {
          var urlStream:URLStream = event.currentTarget as URLStream;
          var outBytes:ByteArray = new ByteArray;         
          urlStream.readBytes(outBytes,0,urlStream.bytesAvailable);           
          writeBytesToFile(outBytes);
      }   
      
      
      private function writeBytesToFile(outBytes:ByteArray):void
      {
          var fileToWrite:File = File.applicationStorageDirectory.resolvePath("path/to/store/filenamewithextension");//Where you want store 
      
          var fileStream:FileStream = new FileStream();  
          fileStream.addEventListener(Event.CLOSE, onFileStream_CloseHandler);
          fileStream.addEventListener(IOErrorEvent.IO_ERROR,onFileStream_IOErrorHandler);
          fileStream.openAsync(fileToWrite, FileMode.WRITE);  
          fileStream.writeBytes(outBytes, 0, outBytes.length);
          fileStream.close();
      }
      
      protected function onFileStream_CloseHandler(event:Event = null):void
      {
          trace("File successfully downloaded ");                 
      }
      
      protected function onFileStream_IOErrorHandler(event:IOErrorEvent):void
      {
          trace("File can't downloaded file doesn't exist ");
      }
      
      protected function onDownload_SecurityHandler(event:SecurityErrorEvent):void
      {
          logger.error("onDownload_SecurityHandler :: " + event.text);            
      }
      
      protected function onDownload_ResponseStatusHandler(event:HTTPStatusEvent):void
      {
          trace("onDownload_ResponseStatusHandler :: " + event.status);
      }
      
      protected function onDownload_IOErrorHandler(event:IOErrorEvent):void
      {
          trace("onDownload_IOErrorHandler :: " + event.text);            
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using AS3 Air for Android, What code can I use to list all or
In AIR/AS3 Flex Mobile for Android project. How can I capture an image of
I have a simple game that I am building in as3/air using flash develop,
Can i upload videos to youtube using an as3 based Adobe Air application, record
I am using as3 air and testing on an android. I need to able
I have an iOS app that's using AS3 and AIR. I have external swfs
50 RANDOM QUOTES Looking to create an AS3 air for android app that loops
Using AIR for Android , is it possible to call from Flex into an
My Flash (AS3/AIR) application is currently using a slightly unusual architecture (for a Flash
I am deploying a desktop application using AIR, and I would like to store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.