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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:46:40+00:00 2026-06-11T21:46:40+00:00

I made a function which loops the mp3 infinitely until I stop it: private

  • 0

I made a function which loops the mp3 infinitely until I stop it:

private function loopSound(a:Class, lead:Number, trail:Number) {
            var b = new a();
            var sChannel = new SoundChannel();
            var timer:Timer = new Timer(b.length - lead - trail, 1);
            sChannel = b.play(lead);
            timer.addEventListener(TimerEvent.TIMER_COMPLETE, function r(e:TimerEvent) { loopSound(a, lead, trail); } );
            timer.start();
        }

The problem with this function is that it doesn’t loop correctly. Though my calculating is correct(from my view), flash doesn’t calculate the positions correctly. Any idea how to achieve flawless mp3 loop?

  • lead = gap at the beginning in ms (27.375ms in my case)
  • trail = gap at the end in ms (20.278ms in my case)
  • 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-11T21:46:41+00:00Added an answer on June 11, 2026 at 9:46 pm

    Using the TimerEvent to loop will not be accurate enough because the way events are triggered in the Flash Player.

    The easiest way to play a seamless “infinite” loop is to:

    1. Have the sound in .wav format perfectly trimmed from silence at the beginning and end
    2. Import it to Flash’s library and export it for ActionScript (as mp3 for low file size)
    3. Simply create a new instance of the sound and play it using Sound.play() and specify how many times to loop as the second argument (a really large integer pretty much makes it “infinite” for most purposes).

    There are more powerful solutions as well that might be of interest:
    Prefered method for looping sound flash as3

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

Sidebar

Related Questions

I'm working with a class for which the new operator has been made private,
I made a function which displays date on the webpage,, and i uploaded the
Hi have made this function which is made to replicate an error that I
My matlab code does image processing, and I made matlab function which has 2
I have made one function in which I am passing a matrix and returning
I made a Web service in which I have a function to count some
I have a class, in which i declare a static function. I register this
I have made an each statement which iterates through each class item found. At
I have a function which loops an array... whilst it works it seems to
i have big problem with explanation code under, meanwhile i made two loops function

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.