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

The Archive Base Latest Questions

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

Is it possible?. I am quite new to ActionScript 3 & have been playing

  • 0

Is it possible?. I am quite new to ActionScript 3 & have been playing around with the slider component. I have set a slider with images,and set a sound to play, so if the value is greater than 0 it would play and if it is greater than 4 it would stop. yet when I export it and it comes up with no errors. I am sure I have to change change the event.value’s to something else rather than numbers. or rather use another event but I am not sure..so I would presume the mp3 would keep playing if you side between those images, not restart on each value it hits. This is what I have


function changeHandler(event:SliderEvent):void { 
        aLoader.source = "pic"+event.value+".jpeg";

}

function music(event:SliderEvent):void {
    var mySound:Sound = new tes1();
    var myChannel:SoundChannel = new SoundChannel();
    mySound.load(new URLRequest("tes1.mp3"));





        if (event.value > 0 || event.value > 4 ){
            myChannel = mySound.play();
        }

        else{
            myChannel.stop();
        }
}
  • 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-14T16:36:17+00:00Added an answer on June 14, 2026 at 4:36 pm

    You are creating a new sound channel at every slider event and, if the value is outside the desired range, stopping that new sound channel. But it wasn’t playing any sound to start with.

    What you probably want is to store the sound channel outside the event handler, and maybe not replay the sound when the value jumps within the range:

    slider.addEventListener(SliderEvent.CHANGE, music);
    
    // Stores the sound channel between slider movements.
    var myChannel:SoundChannel = new SoundChannel();
    var isPlaying:Boolean = false;
    
    function music(event:SliderEvent):void {
        var mySound:Sound = new tes1();
        mySound.load(new URLRequest("tes1.mp3"));  
    
        if (event.value > 0 || event.value > 4) {
    
            // Check if we are already playing the sound and, if yes, do nothing
            if (!isPlaying) {
                myChannel = mySound.play();
                isPlaying = true;
            }
    
        } else {
            myChannel.stop();
            isPlaying = false;
        }
    }
    

    So when the value gets outside the desired range, it stops playing the last sound, and when the value moves within the range, it just continues playing instead of restarting.

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

Sidebar

Related Questions

I am quite new to ant and have been looking at the tasks. I
I am quite new to Xcode coding and I have been using Storyboard for
I am quite new in git, and I have seen that it is possible
I am quite new to web development, and recently, I have been wondering if
It is quite possible that I may not have got the point, but I
I'm quite new to flex/actionscript and I was wondering if there is an equivalent
I'm quite new to asp.net MVC. I'm following the NerdDinner tutorial and have created
I'm quite new to Regex'es, so I was wondering if this is possible? Take
I am quite new to the facebook app thing. I have read a lot
I'm new to actionscript flash 3.0. Anyways, i have written code for one whole

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.