In a replay of his questions and...

Here is the code for a simple game that has music that starts as soon as the game scene is reached... third stage. There are 4 buttons related to music, volume up, lower the volume, stop music and play music.

As I said, the music plays automatically at the beginning of the game, I want. The top to the bottom and stop the volume work. The problems are.

First of all, if you stop the music the play button does not start the music again.

Second, none of the sound buttons work on a replay.

Would it be useful to have a link to the game? I'll load and put a link in a few minutes.

I'm stuck. I'm new to actionScript. I take a class and this is my last. I look forward to the day when Action

I appreciate your help!

Thank you

Michelle

var bool:Boolean

var score: number = 0;


var flag: Number = 1;


var myTimer:Timer = new Timer (1000);


var soundReq:URLRequest = new URLRequest ("music.mp3");


var sound: Sound = new Sound();


var soundControl:SoundChannel = new SoundChannel();


var volumeControl:SoundTransform = new SoundTransform();


var flag2:Number = 1;


count_txt. Text = "0";


myTimer.addEventListener ("timer", timedFunction);


insect_btn. Visible = false;


timer_txt. Text = "20";

function disappear(e:MouseEvent):void
{

If (timer_txt.text is "0")
{
launch_btn. RemoveEventListener (MouseEvent.CLICK, target);
insect_btn. RemoveEventListener (MouseEvent.Click, disappear);
}
on the other
{
insect_btn. Visible = false;
count_txt. Text = String(++score);
}
}


function target(e:MouseEvent):void
{
if(flag==1)
{
myTimer.start ();
flag = 0;
}
insect_btn.x = Math.random () * 625;
insect_btn.y = Math.random () * 475;
insect_btn. Visible = true;
}


function timedFunction(e:TimerEvent)
{
var tc: int = 20 - myTimer.currentCount;
timer_txt. Text = tc.toString ();
If (myTimer.currentCount > 19)
{
insect_btn. RemoveEventListener (MouseEvent.Click, disappear);
launch_btn. RemoveEventListener (MouseEvent.CLICK, target);
MyEventArgs;
gotoAndPlay ("done_frame");
}
}


function playAgain(evt:MouseEvent):void
{
gotoAndPlay ("play_frame");
}

{if(!bool)}
bool = true;
Sound.load() (soundReq);
soundControl = sound.play().
}

function playSound(event:MouseEvent):void
{
If (Flag2 == 0)
{
soundControl = sound.play().
Flag2 = 1;
}

}


function stopSound(event:MouseEvent):void
{
soundControl.stop ();
flag = 0;
}


function increaseVolume(event:MouseEvent):void
{
volumeControl.volume +=. 5;
soundControl.soundTransform = volumeControl;
}


function decreaseVolume(event:MouseEvent):void
{
volumeControl.volume-=. 5;
If (volumeControl.volume > = 0)
soundControl.soundTransform = volumeControl;
on the other
volumeControl.volume = 0;

}

insect_btn.addEventListener (MouseEvent.Click, disappear);
launch_btn.addEventListener (MouseEvent.CLICK, target);


btn_play.addEventListener (MouseEvent.CLICK, playSound);
btn_stop.addEventListener (MouseEvent.CLICK, stopSound);


btn_up.addEventListener (MouseEvent.CLICK, increaseVolume);
btn_down.addEventListener (MouseEvent.CLICK, decreaseVolume);

There may not be anything wrong with this code.  but there are times when you use e.target, it's not what you want.  almost always, you must use e.currentTarget.

in any case, this error message is not because of any code of handleClick3().  You can click on publish the files, settings, flash, permit debugging to see numbers of frame and the line of code that causes your invalid sound.  This will allow you to focus on the problematic code.

Tags: Adobe Animate

Similar Questions

  • Seen with his questions and planning tasks.

    Hello

    I had problems with my laptop windows 8 recently that required me to restore to factory settings. I was then advised to delete windows every restoration by turning off and then re enabling the system to restore the problem only comes back - I had a potentially unwanted program which was affecting the system files and the registry keys.

    Anyway, I thought that everything was going well until now that I noticed none of my scheduled tasks are underway. So the automatic maintenance would usually always wake up my laptop at 03:00, and recently he was not. Also my scans at the request of mcafee do not take place either.

    Other issues I'm having is with the sound. This works but randomly it will stop working and I have to restart my laptop. Ive checked my drivers audio and everything seems to be ok, so I'm puzzled as to why this is happening.

    I also had a question that was that I deleted all the old done restore points mean that I won't be able to restore the factory settings or remains the default restore point.

    Thank you

    Hello

    Thanks for the quick response.

    What is the brand and model of the computer?

    You try to use the device in a clean boot state and see if this helps because, put your system to the State clean boot helps you determine if third party applications or startup items are causing the problem. You must follow the steps in the article mentioned below to perform a clean boot. See the link to perform the clean boot.

    How to perform a clean boot in Windows

    http://support.Microsoft.com/kb/929135

    Note: See "How do I reset the computer to start normally after a boot minimum troubleshooting" to prepare the computer to start as usual after a repair .

    Also for questions related to the sound, you can see the article mentioned below and see if that helps.

    No sound in Windows

    http://Windows.Microsoft.com/en-us/Windows/no-sound-help#no-sound=Windows-8&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

    Tips for solving common audio problems

    (Also applicable to Windows 8)

    http://Windows.Microsoft.com/en-us/Windows/tips-fixing-common-sound-problems#tips-fixing-common-sound-problems=Windows-7

    I hope this helps. Otherwise, feel free to write us again and we will be happy to help you.

    Thank you

  • AE sudden drop, his question and ghost image rendering performance.

    Hi, I'm under CC2015 last, AE on a computer 64 bit Windows 10 Pro with the following specifications:

    Proc: Intel Core I7 - 5930K (3, 5 GHz, not overclocked)

    RAM: 32 GB

    GPU: AMD over-pants W7100 8 GB of DDR5 RAM memory

    Each driver is up-to-date.

    I experienced these problems since yesterday without reason at all (no new updates or new software any newly installed)

    It started with a composition Dynamics first sent link (CC2015, later) EI, mixture of several sources (mxf DnxHD, mp4, mp3)

    • The first problem is that whenever I tried to make to my comp in AE, even forcing activation of the sound on the export, the rendered file contains a VOID soundtrack.

    It occurred when the default rendering in a NON-DESTRUCTIVE (Animation codec). AVI file.

    I tried to normalize my sources in first each of them exporting to DnxHD. The mp3 and the MXF files track into an AIFF file with no effect.

    When I switched to a NON-DESTRUCTIVE (codec Animation) . MOV file, the sound was present and functional, but it's just a workaround, not a solution.

    • Second problem is that there was a significant decrease in performance I tested by the rendering on a FullHD 5' computer with a single solid layer in it. The rendering is 5 minutes of erratic progression.
    • The third problem is that no matter what codec or the container used in the render queue I always end up with a file in which whenever it was supposed to show the bottom of the comp, I have an image of 'Phantom' of one of my layers appearing.

    Even during the passage of each layer, this image is the display constantly through the comp.

    It disappears only when clean the cache, but comes back with each rendition. Even if the layer source of this image is not present in the COMP.

    This image is displaying in first when using the model of dynamic links.

    Here's what it looks like when I open AE.

    Note that the model is empty and yet, there is a ghost image.

    AE.PNG

    Cleaning the cache, restart several times, has no effect.

    Last thing I will try is to re - install After effects but I have little hope that it will solve anything.

    What should I do now?

    EDIT: I have now if she has something to do with the new preview, but when I go to any computer, image is not updated in the comp Panel. (caps lock is off of course)

    I have used no third party plugin on this project.

    As expected, AE re-installing has not effect.

    There is a bug in 13.5.1 AE where it is not sound unless he renders a MOV file (or make you through Adobe Media Encoder instead of the queue of EI). The value is fixed in the update of the following month.

    Your ghost image is probably something a bit twisted with your cache. Try to import the project into a new project.

    In CC 2015 (version AE 13.5.x), the preview is not displayed during a rendering. In my view, that this feature is back in the update of the following month. See what Adobe post about things not yet present in the new architecture of CC 2015 http://adobe.ly/1cXyVHV

    If you are having too many problems with CC 2015, could install CC 2014 next to her and to use that to update the following month. http://blogs.adobe.com/adobecare/2015/06/16/how-to-find-and-install-previous-version-of-ad obe-apps-in-cc-2015 /

  • someone got my account and my password and security question and now I can't sign that could make the change

    Someone emailed me saying that his hotmail and my account will be closed within 48 hours if I do not send my info.  So I sent the information which is my name and my password, then an hour later, one of my friends called and said that someone sent him my address e-mail saying I'm stuck in London and I need more $ 2,000 that I will refund.

    I tried to connect to my email and my password does not work.  I tried to reset my password, but my security question is does not work either.  Please let me know what to do.  Thank you

    Hello

    HotMail has its own Forums, so you can ask your questions there.

    Windows Live Solution Center - HotMail - HotMail Forums Solutions
    http://windowslivehelp.com/

    Hotmail - Forums
    http://windowslivehelp.com/forums.aspx?ProductID=1

    Hotmail - Solutions
    http://windowslivehelp.com/solutions.aspx?ProductID=1

    How to contact Windows Live Hotmail Support
    http://email.about.com/od/hotmailtips/Qt/et_hotmail_supp.htm

    Windows Live Hotmail Top issues and Support information
    http://support.Microsoft.com/kb/316659/en-us

    Compromised account - access unauthorized account - how to recover your account
    http://windowslivehelp.com/solution.aspx?SolutionID=6ea0c7b3-1473-4176-b03f-145b951dcb41

    Hotmail hacked? Take these steps
    http://blogs.msdn.com/b/securitytipstalk/archive/2010/07/07/Hotmail-hacked-take-these-steps.aspx

    I hope this helps.

  • Despite his uniform and fixed on my form of task settings, I get thickness variable and facing interiors of the curves. I really wish it was just smooth and uniform. Any ideas?

    Despite his uniform and fixed on my form of task settings, I get thickness variable and facing interiors of the curves. I really wish it was just smooth and uniform. Any ideas?

    This question cannot be resolved when you use the brush with an effect.

    It cannot be solved with the form of the task.

    Try just drawing on larger scale, maybe then it won't happen.

  • If you ask the question and then choose a solution, the thread will be closed or still can you ask more details?

    If you ask the question and then choose a solution, the thread will be closed or still can you ask more details?
    (sometimes, someone answers my question, and I want to mark it as the solution and am not yet quite ready for the thread be closed...)

    If you still experience this issue, you can return to this thread.
    But, you must clear the flag solved .

  • Can I set up another iTunes account if forget my security question and answer

    I forgot my security questions and answers. When I first set up my account.

    When I try to buy whatever it is on iTunes now on my iPhone 4S. Something appears on the screen.

    Responds to say I need to get to safety. I don't remember my Email of relief. I can set one another that i tunes account.

    You need to reset your security questions...

    Follow the instructions here > https://support.apple.com/en-us/HT201485

    If you use another Apple ID iTunes for all of your content from the original Apple ID will be deleted.

  • Hi our friend has an old e-mail address on his old phone and e-mail account is now closed he should drop his photos and has a new email address, how he retrieve it please

    Hi our friend has an old e-mail address on his old phone and e-mail account is now closed he should drop his photos and has a new email address, how he retrieve it please

    Even if the e-mail account is closed the Apple is still valid. If he has forgotten the password, see: If you forgot your Apple ID - Apple Support password

    What follows has instructions on how to change the e-mail address he serves his Apple ID: change your Apple - Apple Support ID

  • I forgot security question and reject E-mail

    Hi all

    I want to know if I forgot security question and reject the e-mail of my Apple ID, what I can do to fix this?

    Please help, thanks.

    If you don't remember the answers to your security questions and you don't have an e-mail address of help, go here, select your region and contact Apple and ask for their assistance.

    Contact Apple for assistance with the security of the Apple ID - Apple Support accounts

  • Apple ID forgotten security question and answer

    Hi all

    I'm having a problem answering my Security Questions that I forgot my security questions and I'm unable to edit these sections security and Apple ID devices:

    1 password

    2 rescue Email

    3. security issues

    4 two-step verification

    5. the devices

    I found only one way to contact the Apple Support for Apple ID via CALL (I am from Lahore, Pakistan/Asia)

    Contact Apple support

    00800 01001, then 800 361 0479

    06:00 to 15:00 (Monday to Friday)

    When I call it says ' call center is currently closed and you can go online to: http://support.apple.com/asia' but, here, is the only option that is once again make appeal to the above said the phone number that is closed when I make calls within the given time / days.

    I'm in trouble with this for a year. Is in any way get fix this problem please let me know your thoughts:

    Thank you

    What happens when you click Reset security questions?

  • I forgot the answer to my security question, I tried to update these answers, but to update them also, I must first answers old issue of security which I forgot how can I update and change my security question and the answers?

    I forgot the answer to my security question, I tried to update these answers, but to update them also, I must first answers old issue of security which I forgot how can I update and change my security question and the answers

    ?

    You must ask security team account Apple to reset your security questions. To contact them, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.

    (143315)

  • I forgot the security questions and it won't let me put rescue email

    HI, I forgot my security questions and it won't let me put a rescue emai. What should I do?

    You must ask security team account Apple to reset your security questions. To contact them, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.

    (143279)

  • I signed in, got confirmation and now do not know how to get back to see my question and and

    Where can I go to see my question and answers. I have received confirmation email but couldn't find the site to go to

    So mark your thread as "Resolved" If you please. And this one as well.
    Thank you.

  • I've forgotten the answer to my security questions and I don't have a spare email. How am I supposed to get the answers from th?

    I tried to buy an app and I don't remember my security questions and I don't have a spare email and I don't know how to find the answers to my questions

    You must ask security team account Apple to reset your security questions. To contact them, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.

    (142655)

  • I've forgotten the answers to my security questions and missed attempts. What to do next? Please help me!

    Hey I got an iPad 2 Air in December 2014 and then define security issues. Just got an iPhone 6 recently and tried to update my profile of security which asked me to answer audit questions. Responses to the I forgot even if I wrote em down somewhere, but unfortunately can not find them. As a result, I missed attempts to answer the questions and now I'm in a limbo as I can't change my apple account details.

    Anyone know how to get around this problem? Other than calling the hotline of the ap? I would be very grateful.

    This is the error I keep ge

    You need to contact Apple and have them verify your identity.

    (141736)

Maybe you are looking for

  • How to find device on my ipad2 code?

    Hey community.  I deleted the YouTube app in my ipad2 because he was in a loop from one day to the next.  I am now trying to recover from the App Store and that's where my monstrous problem begins.  Google have a few only questions, no problem, but r

  • HP 650: Upgrade HP 650 display

  • Email Sign-In problem

    Hi, this is the only place where I could run. I'm unable to access my email. I used to open it, and then suddenly - my browser reports a script error (I checked it by clicking on the Java Script error message) - I'm not a programmer, so I don't under

  • DVD disc drive tray keeps opening and closing constantly

    FOR WINDOWS VISTA HOME PREMIUM EDITION DVD CD ROM DRIVE TRAY KEEPS OPENING AND CLOSING CONTINUOUSLY - GET COMPUTER TO READ DISCS AT ALL - OTHER ASPECTS OF THE COMPUTER RUN FINE - DIAGNOSIS SAY THAT HE DIDN'T THERE HAS NO PROBLEM WITH ANYTHING. IN DEV

  • HP Mini 110___Password verification failed fatal error... System CNU9455ZFM?

    I have a BIOS passowrd ive forgotten on my HP Mini110... I tried to reset the CMOS and its always ask for the password. Can anyone help please? error Chech password has no fatal error... System CNU9455ZFM