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 8419983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:46:00+00:00 2026-06-10T02:46:00+00:00

The Code below downloads an mp3 to your phone from a server using as3

  • 0

The Code below downloads an mp3 to your phone from a server using as3 Air For Android. I want to use these files later in the app so I have the following question:

How can I make it so the files save to a particular folder in the android app rather than a box opening for the user to choose a location?

import flash.net.FileReference;

/// It can be an mp3,jpg, png, etc... just change the url
/// and the extension name. nice huh?
var yourFileLocation = "http://YourWeb.com/YourSong.mp3";
var yourFileName = "YourSong.mp3";

var daFile:FileReference = new FileReference();
daFile.download(new URLRequest(yourFileLocation), yourFileName);

Would also be sweet to monitor this progress, when it starts, stops and progress but I think an eventListener might work with that.

  • 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-10T02:46:02+00:00Added an answer on June 10, 2026 at 2:46 am

    The Following Code downloads an mp3 from a remote url and makes a folder called .007(You can change the name or add many or no folders). Then it saves to that location.

    import flash.filesystem.*;
    /// Change the line below to point to your mp3 online
    var urlString:String = "http://YourWebsite.com/YourSound.mp3";
    var urlReq:URLRequest = new URLRequest(urlString);
    var urlStream:URLStream = new URLStream();
    var fileData:ByteArray = new ByteArray();
    urlStream.addEventListener(Event.COMPLETE, loaded);
    urlStream.load(urlReq);
    
    function loaded(event:Event):void
    {
        urlStream.readBytes(fileData, 0, urlStream.bytesAvailable);
        writeAirFile();
    }
    
    function writeAirFile():void
    { 
        // Change the folder path to whatever you want plus name your mp3
        // If the folder or folders does not exist it will create it.
        var file:File = File.userDirectory.resolvePath(".007/Yahoo.mp3");
        var fileStream:FileStream = new FileStream();
        fileStream.open(file, FileMode.WRITE);
        fileStream.writeBytes(fileData, 0, fileData.length);
        fileStream.close();
        trace("The file is written.");
    }
    

    P.S. REMEMBER TO GRANT THE CORRECT PERMISSIONS USING ANDROID IN THE APP

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to extract some files from a jar-file downloaded using java-webstart. below code
i found the code below in stackoverflow for resumeable file downloads : using System;
I'm using the android DownloadManager API to download files from my school's server. I
I am using the code below to download an Excel file. Once the Response.End()
below is the code to download a txt file from internet approx 9000 lines
I have a java file Test.java (below) which uses Guava's HashMultiMap (downloaded from http://code.google.com/p/guava-libraries/
Code below is used to save PostgreSql database backup from browser in Apache Mono
I'm confused with the code block below because why it downloads the contents of
I need to download an .mp3 audio file from a server to save in
I write a script to force download mp3 files from a site. The code

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.