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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:30:54+00:00 2026-06-10T08:30:54+00:00

import flash.filesystem.*; /// Change the line below to point to your mp3 online var

  • 0
import flash.filesystem.*;
/// Change the line below to point to your mp3 online
var urlString:String = "http://edvizenor.com/upload/php/files/trust.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.

HERE ARE THE LINES I NEED HELP WITH:

var file:File = File.userDirectory.resolvePath("Yahoo.mp3");// WORKS
var file:File = File.applicationDirectory.resolvePath("Yahoo.mp3"); // NO WORK

I need to get THIS SECOND LINE to save to the directory it is stored in. Any ideas what I am doing wrong?

    var fileStream:FileStream = new FileStream();
    fileStream.open(file, FileMode.WRITE);
    fileStream.writeBytes(fileData, 0, fileData.length);
    fileStream.close();
    trace("The file is written.");
}
  • 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-10T08:30:56+00:00Added an answer on June 10, 2026 at 8:30 am

    To save In application directory.
    Use

    var file:File = File.userDirectory.resolvePath("Yahoo.mp3");// WORKS
    var file:File = File.applicationStorageDirectory.resolvePath("Yahoo.mp3"); // It will work
    
    
    var fileStream:FileStream = new FileStream();
    fileStream.open(file, FileMode.WRITE);
    fileStream.writeBytes(fileData, 0, fileData.length);
    fileStream.close();
    trace("The file is written.");
    

    }

    Because application directory is the package directory of your application.

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

Sidebar

Related Questions

I have a code as below import flash.media.Sound; import flash.media.SoundChannel; flash.system.Security.allowDomain(*); var request:URLRequest =
I have a timer script: import flash.utils.Timer; import flash.events.TimerEvent; var secs:Number = 30;//second var
I am trying to use http://code.google.com/p/as3svgrendererlib/ in my flash cs 5.5 project to import
AS3 Code: import flash.utils.Dictionary; var num1:Number = Number.NaN; var num2:Number = Math.sqrt(-1); var dic:Dictionary
Actionscript: System.security.allowDomain(http:// + _root.tdomain + /); import flash.net.FileReferenceList; import flash.net.FileReference; import flash.external.ExternalInterface; import flash.external.*;
import flash.display.Sprite; var bin:Sprite = new Sprite(); var cir:Sprite = new Sprite(); cir.graphics.beginFill(0x00ff00,1); cir.graphics.drawCircle(0,0,30);
package { import com.greensock.TweenLite; import flash.display.Sprite; public class TweenTest extends Sprite { private var
This is my layout: package layouts{ import mx.core.ILayoutElement; import mx.core.IVisualElement; import spark.layouts.supportClasses.LayoutBase; import flash.geom.Point;
this is my code. package core { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.geom.Point; public
import flash.display.Shape; import flash.display.Graphics; stage.addEventListener(Event.ENTER_FRAME, startAnim); function startAnim(e:Event):void { var shape1:Shape = new Shape();

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.