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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:22:40+00:00 2026-06-10T12:22:40+00:00

I have a simple button that plays a small MP3 file, looping it 30

  • 0

I have a simple button that plays a small MP3 file, looping it 30 times. The MP3 is streamed from a server (urlMP3).

I can see on my Galaxy S2 that it accesses the server for each of the 30 loops. Is it downloading the MP3 each time it loops or downloading once and playing from the phone’s memory?

//Button 'audioYes' to play audio loop x 30
var soundLoop:Sound = new Sound();
var soundChannel:SoundChannel;
var soundLoopUrl:URLRequest = new URLRequest(urlMP3);

audioYes.addEventListener(MouseEvent.CLICK, f2_MouseClickHandler);

function f2_MouseClickHandler(event:MouseEvent):void {
    soundLoop.load(soundLoopUrl);
    soundLoop.play(0, 30);
}

If it is downloading each time, what would be a good way to download it once and then play? Thanks for your help.

Edit: Sep 1 2012
I’ve created a simple flash file and added the following provided by @Rytis. I’m getting an error from the last line, this.mySound.play “Error #1009: Cannot access a property or method of a null object reference.” What do I do with that?

import flash.media.Sound;
import flash.net.URLLoader;
import flash.display.Loader;

var mySound:Sound = new Sound();
var myurlLoader:URLLoader = new URLLoader();

myurlLoader.addEventListener(Event.COMPLETE, this.onSoundLoadComplete)
myurlLoader.load(new URLRequest("01.mp3"))

function onSoundLoadComplete(event:Event):void{
this.mySound = URLLoader(event.target).data as Sound;
this.mySound.play(0,30);
}
  • 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-10T12:22:42+00:00Added an answer on June 10, 2026 at 12:22 pm

    Short answer – download sound and store it to variable before playing it.

    Example:

    package {
        import flash.events.Event;
        import flash.media.Sound;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
    
    public class SoundLoadTest {
    
        protected var sound     : Sound;
    
        public function SoundLoadTest () {
    
            var urlLoader : URLLoader = new URLLoader();
            urlLoader.addEventListener( Event.COMPLETE, this.onSoundLoadComplete )
            urlLoader.load( new URLRequest( "path/to/sound.file" ) )
    
        }
    
        protected function onSoundLoadComplete ( event : Event) : void {
    
            // save loaded sound to a class field
            this.sound = URLLoader( event.target ).data as Sound;
    
            // start playing sound
            this.sound.play( 0, 30 );
    
        }
    
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Button control that contains an Image object as its content.
This is probably a basic html/css question... I have a simple one-button form that
I have a simple query tied to a command button that shows a summary
I currently have a simple form that when you click the save button will
I'm now testing GKPeerPickerController. I have a simple app that just have a button
i have a simple UIButton that, once clicked, plays a 1 second sound. i
Ok I have made a simple radio app that streams music from my university
I have made a simple play/pause button that works in conjunction with the audio
I have a simple application that starts with a splash screen activity that plays
I have a simple table that prints our the list of videos and plays

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.