How to stop a sound and emit a sound signal according to the values of text?

I have a text field and a button. When the button is clicked it displays 100 or 0 (vice versa). The value in the text field is saved and when the user opens the application upwards, the text field displays the last number (100 or 0). This is the code:

import flash.events.MouseEvent;
import flash.media.SoundChannel;
import flash.ui.Mouse;

var saveDataObject:SharedObject;
var currentScore:Number; 
options_mc.sound_btn.addEventListener(MouseEvent.CLICK, mute);


init();
function mute(event:MouseEvent)
{

if(currentScore == 100)
{
currentScore = 0
options_mc.onoff_txt.text = String(currentScore);

}
else if(currentScore == 0)
{
currentScore = 100
options_mc.onoff_txt.text = String(currentScore);
}
saveData();
}
function init():void
{

saveDataObject = SharedObject.getLocal("test");
currentScore = 100;




if (saveDataObject.data.savedScore == null)
{

    saveDataObject.data.savedScore = currentScore;
}
else
{

    loadData();
}


}

function saveData():void
{
saveDataObject.data.savedScore = currentScore;

saveDataObject.flush();

}

function loadData():void
{
    currentScore = saveDataObject.data.savedScore;

    if (options_mc.onoff_txt) options_mc.onoff_txt.text=String(currentScore);
}

On a different layer in the timeline panel, I have a sound that lights up. I want the sound turns on if the value of the onoff_txt is equal to 100, and I want the sound to stop playing or not playing when the value is 0.

The code failing that I came up with is the following: CheckSound();

function CheckSound():void
{
if(options_mc.onoff_txt.text == "100")
{
tchannel
= theme.play(0,9999);
}
else if(options_mc.onoff_txt.text == "0")
{
tchannel
.stop();
}
}

It does not at all, the sound comes not now or anything like that!

If you call any function, the function will not work.  You must call this function whenever the program changes the values in the TextField.  What happens when the program starts and when you click the button, then work to call this function in the sections of the code.

Tags: Adobe Animate

Similar Questions

  • My adobe will open and say "install updates" but it stops at 5% and told to try to connect to the server. It won't go past that. I tried to update through the view, but it still does the same thing.

    My adobe will open and say "install updates" but it stops at 5% and told to try to connect to the server. It won't go past that. I tried to update through the view, but it still does the same thing. I tried to reinstall, but it usually because of my other apps I have. How can I fix it?

    Hi crystal,

    Please see the following link for assistance on this issue;

    https://helpx.Adobe.com/creative-cloud/kb/download-update-errors.html

    Concerning

    Harsha

  • After the upgrade to v9.0 my address window and search window change size according to the length of the address. How to keep the search engine the same size?

    Search bar and address bar change size according to the length of the URL. How to keep my search bar the same size?

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • We have configured replication vsphere in our environment and when replication is triggered according to the OFR start us below the questions on the virtual machines that are configured for replication

    Question: We have configured replication vsphere in our environment and when replication is triggered according to the OFR start us below the questions on the virtual machines that are configured for replication.

    Version for esxi: Patch 5.1 level 7

    Virtual center of version 5.1

    Source of storage - IBM v7000

    Destination storage - Hitachi


    Questions:
    Events of breach RPO
    Consolidation for the VM disk failure
    Delta abandoned events
    Time change events
    NTFS error and warning (event ID: 137, 57)
    RDP disconnect and ping does matter
    Standby error
    Volsnap error
    Stop the server and offline issue
    Install vmtools emits automatically

    well, in this case, we need to disable the standby of the end of the replication.

    So that everything in triggering replication does not trigger the snapshot of the suspension.

    Then test the if you get these errors.

  • How to automatically complete a transitional according to the value of another attribute when attribute line is questioned in the VO?

    Hello world

    The task seems simple enough, but I have not found a way to populate an attribute transitional according to the value of another attribute when the line is queried. What is the best way to achieve this?

    Thank you.

    James

    Use VORowImpl, if you have any transient attributes defined in the view object, whose value is derived from other attributes of the line, you can override the GET method and add logic there

    Please note that this class represents a row in the results collection in a display object.

  • How to stop to iMessage and FaceTime on iMac from iPhone / iPad

    Hi all

    I can't figure out how to stop to get FaceTime and iMessages on my iMac, when people send to my iPhone or iPad.    I figured out stop to happen between my iPhone and iPad.    I when in preferences on FaceTime and iMessage on my iMac and not addresses but they don't entirely uncheck/disable.   There may be something in the settings of the iPad and iPhone to stop going to the iMac?    I watched the setting on these devices and saw nothing, but I am a fool with this stuff and I could have overlooked a fix.

    Concerning

    Steve

    Open system preferences > Notifications click on FaceTime and Messages and disable what you do not want.

  • How to stop a sound instantly

    It is true that I don't have the latest tools DPS. Currently using v25. For some reason, my Adobe Application Manager does not easily update my InDesign tools. In order to do that, I need to quit the program, run the disc utilities, repair permissions, zap the p - RAM, kill a chicken, my office twice... counterclockwise circle, restart the computer, it will update maybe...

    So my question is this: when I play a video or sound then it to go to another page, the sound continues. I've been using workaround ol ' auto play a sound file empty very brief on the next page so it silenced anything else who played previously. Is there a better, more elegant solution with the latest versions that would validate the putting to death of poultry?

    Audio and video will continue to play until the page is outside our window of caching. That's how we designed to work.

    Neil

  • by turning on the computer the sound wav plays always the value by default even if I changed my diet and renamed it

    When you turn on the computer default wav sound still plays even if I changed the system and renamed it

    Hello

    1. which version of the windows operating system is installed in the computer?

    2. have you made any changes to the computer?

    Method 1:

    If you use windows vista and windows 7, I suggest you perform the clean boot and check.

    Place the computer in a clean boot state, then check if it helps. You can start Windows by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

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

    Note: After troubleshooting, make sure the computer to start as usual as mentioned in step 7 in the above article.

    Method 2:

    I also suggest you to see link and check.

    Change the sounds of the computer

    http://Windows.Microsoft.com/en-us/Windows7/change-computer-sounds

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-computer-sounds

  • How s/n know when and what account perform a function using the database link?

    Dear,

    My application of the CIM team asked DBA to create new function and run it. Function must use the database link for remote database data. So I need to create a new database to their licensing link. Cause we guess we'll experience the performance issue after the user performs this function, or another question and errors may occur. So we want to know when and who use this feature that connects to a remote database through the new database connection in advance. And I also need to know when and which connect to the remote database using this new database link. We have no idea to get this information?  Can anyone recommend how do? Thank you very much.

    Best reqards, Otis.

    Check what business purpose, it will solve.  If the function is so safe, why everyone will use. Only admin people should access.

    All of these additional controls of this kind must be avoided as much as possible to improve the overall performance of the application.

    Still if you need, see the database audit mechanism, specifically designed for this type of activity.

    Kind regards

    Harman

  • How to add radio buttons and drop-down menus to forms of the muse

    I want to put a contact form on my site that I am building in muse of adobe but it leaves me not to add drop-down menus or boxes option in my forms, so would like to know how I can get the widget of forms to make me add these fields, I would like to me also can have different fields displayed on a form based on the value selected in a drop-down list and also to send data submitted to an e-mail address which is determined by the value of field drop-down list.

    can someone help me to implement these things?

    Alternatively, you can go with Andrew widget:

    https://creative.Adobe.com/addons/products/3124#.VEO37Mlsiks

    Here's the demo:

    https://widgets.Mu/se/FormsPlus/demo/

    Thank you

    Sanjit

  • How can I close Safaricloudhistory and Safarinotification when you are prompted during the uninstallation of cs5

    I'm trying to uninstall my CD of Creative Suite CS5 version.  I now have the cloud of CS6 version.  Once I'm on uninstall section I'm prompted to close the following applications: "Safaricloudhistory and Safarinotification" neither of which I am able to find nearby and therefore unable to continue my uninstall.

    Help, please.

    Thank you

    J

    The steps in the Correct link and applies to Yosemite as well.

    Launch the activity monitor of Applications > utilities.

    Or Finder > go > utilities.


    Once the activity monitor is running, check for Safari process and force them to leave the same.

    When you click X button marked, it will encourage Quit option and force him to leave. Click the option to force out.

  • How to stop kill CFQUERYPARAM requests search results & bots legitimate exploration of the site?

    Some time ago I converted most of the queries to use cfqueryaparam to guard against injection attacks, among other things.  However I have noticed recently a slew of errors generated precisely cfqueryparam where a user clicks on a URL from a result of search engine defined or when a bot robot visit on the site.


    The function in question is a request directly in a CFC with the crash of two param check before they get against data CFARGUMENT types


    < cfargument "editionID" type = name = 'digital' required = "no" default = index '0' = "Specifying the ID of the edition in most cases returns a back problem" >

    < cfargument "publicationID" type = name = "numeric" required = "yes" >


    < cfquery >
    SELECT *.
    A articles
    INNER JOIN sections s on s.sectionID = a.sectionID
    INNER JOIN edition e on a.editionID = e.editionID
    INNER JOIN publications p on e.publicationID = p.publicationID
    WHERE p.publicationID = < cfqueryparam cfsqltype = "cf_sql_integer" value = "#arguments.publicationID #" > AND e.editionID = < cfqueryparam cfsqltype = "cf_sql_integer" value = "#arguments.editionID #" > < / cfif >
    ORDER BY a.isLead desc, a.leadPosition, a.sectionID
    < / cfquery >

    ---

    By looking at the error reports, the query string is it exactly as it should be (for example, query: action = 3 & articleID = 1756 & editionID = 176 - publication id is defined in the scope of the request; article ID is used as a filter), but the CF is unable to validate '176' as a whole, and all else fails.

    I remove the cfqueryparam and the exact same link that did not work, the fact.

    Any idea would be appreciated,

    Jason.

    Is the value of the field '176' mistakes or "176 [with trailing whitespace here]?"  It is probably what the question.

    It is interesting that is it going OK as a digital, but is not seen as an int.  Not that digital-online integer, necessarily, of course.

    What you give isValid ("integer", arguments.editionID)?

    --

    Adam

  • How to check if the value of text is in a view accessor? How can I check for validation?

    Hi Experts ADF,

    JDeveloper 12.1.1.3.0

    I have a VO with a Segment1 column. And I have an accessor in my VO as SegmentVA which contains all the numbers.

    So in the user interface, I'm having a Segment1 as an inputText. The user should then enter values in inputText.  How can I check to validate that the value you enter must be valid within the ViewAccessor.

    Thank you

    Animesh

    You can use a declarative approach and define the Validation rule on EO attribute.

    Or you can create the method in your ViewObjectImpl class, expose this method as a customer interface, create custom for your input field validator and invoke the VO method from there.

    Dario

  • How to filter records in a main query of RDF based on the values of the calculated fields

    Hello

    I'm working on a report of RDF, where I have my main request which has four fields.

    (1) the unique id for the field

    (2) numerical value 1

    (3) numeric value 2

    (4) numeric value 3

    I added a CF_Total of calculated field.

    The main query returns all the records, but I want to only show that these fields for which the CF_Total has a particular value.

    Can anyone help me about how to proceed.

    Concerning

    Hawker

    Hello Hawker,

    This is an example, how you can filter based on the formula column. I don't know exactly where you would use. And other related issues.

    Give the idea and example how you can start.

    Thank you

    Hamid

  • read the values of an array element and by sending a digital output to a designated channel according to the value read from the table

    Hello world

    could someone help me before I get out of my hair. Here's my problem.

    I read 3 values of an array of 3 elements i.e. 1,2,3. These values are then compared to a constant value, example if the first element of the array is 1 and it meets the comparison condition can send a digital camera of output for that channel on data acquisition

    I want to be able to send a value from a table to its corresponding comparison and then on its designated channel on the acquisition of data, the whole point of this is due to the fact the table element will not always read the value 1,2,3 for example could be 2,3,1

    Here's one the vi I have so far

    If someone could help it would be much appreciated

    all the best

    brand

    Take time to explore the many examples included with LabVIEW that cover the basics.

    -Indexing table

    -reading a spreadsheet file

Maybe you are looking for

  • HP pavilion 15-p107ne: wireless adapter

    Hello I have hp pavilion 15-p107ne and im having a problem with wifi adpter I have this model ( 1x11b/g/n Wireless LAN PCI Express Half Mini Card Adapter ) and its bad to find networks and connection. 1. is the problem of the adapter 2. can I replace

  • Satellite A200 - Crackle sound comes from the HARD drive

    Hello I have the Satellite A200. When I start my laptop the patter comes from the hard drive.Someone knows something about it? Thank youVikas

  • Telephone fax line

    AT & T provides services to my home/office I have an individual line business with 2 numbers, one for voice and one for fax. The two lines are differentiated by separate and distinct rigns. The fax is unable to make the difference between the two cau

  • How to restore files and data that has been deleted?

    How to restore the link folder and accessories programs in sp2 of vista start menu Henry

  • Question about reinstalling Windows Vista Basic on a netbook.

    Hello Microsoft forums... Can someone guide me please a guide on reinstalling Vista Basic on a netbook?  I have no support discs, only USB ports, as on most netbooks.  Is it possible to make a player flash or something to that extent? Thank you very