Help! Text display randomly each time I click using ActionScript 3.

Hi! I am doing a school project using Adobe Flash ActionScript 3. Here is a picture of what I'm working on:

Screen shot 2010-09-18 at 7.49.34 PM.png

I have a layer of text box on the top of the bubble of conversation. Initially it is empty, then I click on Hello Kitty and a random sentence appears in the text box of the chart that I created. However, when I click on him once again she won't tell another random phrase. I don't know what I'm doing wrong. Here's the code. Please, take a look at it and let me know what I can do about it! Thank you!


var myPhrases:Array = new Array(); HELLO KITTY PHRASES TO TALK ABOUT A BUBBLE

myPhrases [0] = ' my name is Hello Kitty!';

myPhrases [1] = "How are you today?"

myPhrases [2] = "smile!" It's a beautiful day! « ;

myPhrases [3] = "I want to be your friend!"

myPhrases [4] = ' you have a big smile! "

myPhrases [5] = "I love flowers & rainbows.";

myPhrases [6] = "what is your name?"

myPhrases [7] = 'We are going to find Dora and go on an adventure!';

myPhrases [8] = "Mmmmeeeeoooowww!"


var i:int=Math.floor(myPhrases.length*Math.random()); SENTENCE AT RANDOM

var value = myPhrases [i];


HKITTY_mc.addEventListener (MouseEvent.CLICK, onClick); EXPRESSION OF CHANGE WHEN YOU CLICK ON HELLO KITTY (IT DOES NOT!)


function onClick(event:MouseEvent):void {}

stop();

ILOVEMYTEXTBOX.text = value;

}


If you simply copy these two lines of code in the service, he'll take care of things...

function onClick(event:MouseEvent):void {}

var i:int=Math.floor(myPhrases.length*Math.random()); RANDOM NUMBER

var value = myPhrases [i];

ILOVEMYTEXTBOX.text = value;

}

which you could shorten to...

function onClick(event:MouseEvent):void {}

ILOVEMYTEXTBOX.text = myPhrases [Math.floor (myPhrases.length * Math.random ())];

}

and you should be able to remove the double post, you have to do this

Tags: Adobe Animate

Similar Questions

  • Each time after clicking the icon of user account on windows xp to change a password is crashes with this error message: Microsoft (R) HTML Application host has encountered a problem and needs to close.

    Each time after clicking the icon of user account on windows xp to change a password is crashes with this error message: Microsoft (R) HTML Application host has encountered a problem and needs to close.

    There is a Microsoft Knowledge base article which sets up a few steps to perform in the computer in order to solve the problem you are experiencing, read the article that you find on the link I am mentioning below and see if it helps the measures mentioned:

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

  • Each time I click on a folder, search companion will appear. I am interested in DISABLING research or travel companion down on the pop-up menu, or at least, put it further down in the context menu. How can I do this? My computer not used to do this.

    Each time I click on a folder, search companion will appear. I am interested in DISABLING research or travel companion down on the pop-up menu, or at least, put it further down in the context menu. How can I do this? My computer not used to do this.

    Doug Knox fix - http://www.dougknox.com/xp/scripts_desc/xp_folder_open.htm
    Search Companion starts if you double-click a folder or computer drive - http://windowsxp.mvps.org/searchwindow.htm MS - MVP - Elephant Boy - Don ' t Panic!

  • My Canon MX700 has suddenly stopped printing unless I turn it on and turn it on again each time. I use a new Windows 7

    My Canon MX700 has suddenly stopped printing unless I turn it on and turn it on again each time.  I use a new Windows 7.  Any ideas?

    Thank you, schasof

    Hello

    Maybe you can use "System Restore":

    http://Windows.Microsoft.com/en-us/Windows7/products/features/system-restore

    and the date when to use your printer worked OK.

    LC

  • iMac spinning Rainbow wheel appears each time I click on something and running extremely slow

    My iMac (27 inch, mid 2011) is gel/loading every time I click on something. This occurs on the simplest tasks such as the opening of the finder window, open system preferences, right-click on desktop etc.

    It happened all of a sudden a few days ago and I have not updated recently... I noticed this occurring has started after I opened the Photos Agent app for the first time and imported more than 1000 images/videos of my iPhone6. Could this be the cause of the problem?

    Memory is 4 GB and it has worked very well so far. I checked disk utility and you have no error. Activity monitor looks great too.

    Most important - looking the best way to backup or clone the HDD that I have a very important job out there. What is the best way to do it? I have a Macbook Pro, as well as with 100 GB free on it. Can I use it to help somehow?

    If someone could help me out that would be great!

    Mac form:

    OS X Yosemite 10.10.3

    Processor: 3.1 GHz Intel Core i5

    4 GB OF RAM

    More than 500 GB free 1 t

    iMac, OS X Yosemite (10.10.3)

    Here are my results of EtreCheck (sorry for the bad pictures but I was unable to open the browser to copy paste)

    1. the present proceedings is a diagnostic test. It doesn't change anything for the better or worse and therefore, by itself, will not solve the problem. But with the help of the results of the tests, the solution may take a few minutes, instead of hours or days.

    The test works on OS X 10.7 ("Lion") and later versions. I do not recommend running it on older versions of Mac OS X. It will do no harm, but it will not do not much good.

    Do not be put off by the complexity of these instructions. The process is much less complicated than the description. You make the tasks more complicated with the computer all the time.

    2. If you have already a current backup backup all data before doing anything else. The backup is needed on the general principle, not because of what anyone in the test procedure. Backup is always a must, and when you encounter any kind of problems with the computer, you can be more than the usual loss of data, if you follow these instructions or risk not.

    There are ways to back up a computer that is not fully functional. Ask if you need advice.

    3 here is instructions to run a UNIX shell script, a type of program. As I wrote above, it doesn't change anything. It does not send or receive data over the network. There is no to generate a report on the State of the computer human readable. This report goes nowhere unless you choose to share it. If you prefer, you can act on it yourself without disclosing the contents for me or someone else.

    You should ask yourself if you can believe me, and if it is safe to run a program at the request of a foreign national. In general, no, he's not sure, and I encourage it.

    In this case, however, there are ways for you to decide if the program is safe without having to trust me. First of all, you can read it. Unlike an application that download you and click to start, it is transparent, so any person with the required competence can check what it does.

    You may not be able to understand the script yourself. But variations of it have been posted on this site of thousands of times over a period of years. The site is hosted by Apple, which does not allow it to be used to distribute harmful software. One of the million registered users to have read the script and set off the alarm if it was dangerous. Then I wouldn't be here now, and you would not be reading this message. See, e.g., this discussion.

    Another indication that the test is safe in this threadand this onecan be found, for example, where the comment in which I suggested it was recommended by one of the specialists of the communityApple, as explained here.

    However, if you cannot satisfy yourself that these instructions are safe, do not follow them. Ask other solutions.

    4. here is a general summary of what you need to do, if you decide to go forward:

    ☞ Copy a particular line of text to the Clipboard.

    ☞ Paste into the window to another application.

    ☞ Wait for the test to run. It usually takes a few minutes.

    ☞ Stick the results, which will be copied automatically, in a response on this page.

    These are not specific instructions; just a glimpse. The details are in parts 7 and 8 of this comment. The sequence is: copy, paste, wait and paste it again. You don't need to copy a second time.

    5. try to test in conditions that replicate the problem, to the extent possible. For example, if the computer is slow intermittently, run the test during a downturn.

    You may have started up in safe mode. If the system is now in safe mode and works pretty well in normal mode to test run, restart as usual before running it. If you can test only in safe mode, this.

    6. If you have more than one user and a user is affected by the problem, and the user is not an administrator, and then run the test twice: once under the affected user and one administrator. The results can be different. The user that is created automatically on a new computer, when you start it for the first time is an administrator. If you are unable to log in as an administrator, verify that the user concerned. More personal Mac have only one user, and in this case this section does not apply. Don't log in as root.

    7 load the linked web page (the site "Pastebin.") The title of the page is 'Diagnostic Test'. Under the title is a text box, headed by three small icons. The right one represents a Clipboard. Click on this icon to select the text, then copy to the Clipboard of your computer by pressing Control-C key combination.

    If the text is not highlighted when you click the icon, select it in triple - click anywhere inside the box. Do not select the whole page, just the text in the box.

    8. start the Terminal application integrated in one of the following ways:

    ☞ Enter the first letters of his name in a Spotlight search. Select from the results (it should be at the top).

    ☞ In the Finder, select go utilities ▹ of menu bar or press the combination of keys shift-command-U. The application is in the folder that opens.

    ☞ Open LaunchPad and start typing the name.

    Click anywhere in the Terminal window to activate it. Paste from the Clipboard into the window by pressing Command + V, then press return. The text that you pasted should disappear immediately.

    9. If you see an error message in the Terminal as "Syntax error" or "Event not found", enter

    exec bash

    and press return. Then paste the script again.

    10. If you logged in as an administrator, you will be prompted for your login password. Nothing displayed when you type. You won't see the usual points instead of the characters typed. Make sure that caps lock is turned off. Type carefully, and then press return. You can get a warning to be careful. If you make three unsuccessful attempts to enter the password, the test is still running, but it will produce less information. If you do not know the password, or if you prefer not to enter, just press back three times at the password prompt. Yet once again, the script will run.

    If the test takes much longer that usual to run because the computer is very slow, you can be prompted for your password a second time. The permission you grant by entering it will expire automatically after five minutes.

    If you are not logged as an administrator, you will be prompted for a password. The test will run. It just will not do anything that requires administrator privileges.

    11. the test may take a few minutes to run, depending on the number of files you have and the speed of the computer. A computer that is abnormally slow may take more time to run the test. During execution, a series of lines is displayed in the Terminal window like this:

    [Process started]
            Part 1 of 4 done at … sec        …        Part 4 of 4 done at … sec
            The test results are on the Clipboard.
            Please close this window.
    [Process completed]

    The intervals between the parties will not be exactly the same, but they give an approximate indication of progress.

    Wait for the final "Process complete" message. If you don't see it in about 15 minutes, the test probably won't be all within a reasonable time. In this case, press the Ctrl + C key combination or the point command to stop it. Then go to the next step. You will have incomplete results, but still something. If you close the window of the Terminal, while the test is still running, the partial results will not be saved and you have to start over.

    12. when the test is finished, or if you have stopped it because it was taking too long, leaving the Terminal. The results have been saved to the Clipboard automatically. They do not appear in the Terminal window. Please do not copy from there. All you have to do is start a response to this comment and then paste it again by pressing Command-V.

    At the top of the results, there will be a line that begins with the words «Start time.» If you do not see, but rather to see a mass of gibberish, you don't expect the "Completed" message is displayed in the Terminal window. Please wait and try again.

    If personal information, such as your name or e-mail address, appear in the results, make anonymous before posting. Usually it will be not necessary.

    13. in the validation of the results, you see an error message on the web page: "you have included content in your post that is not allowed", or "the message contains invalid characters." It's a bug in the software which manages this website. Thanks for posting the results of the tests on Pastebin, then post here a link to the page you created.

    If you have an account on Pastebin, please do not select private in exposure menu to paste on the page, because no one else that you will be able to see it.

    14. This is a public forum and others can give you advice based on the results of the test. They speak for themselves, not for me. The test itself is harmless, but what're told you to do maybe not. For others who choose to run it, I do not recommend that you view the results of test on this Web site unless I ask.

    ______________________________________________________________

    Copyright © 2014, 2015 by Linc Davis. As the sole author of this work (including the "Test of diagnosis" referenced), I reserve all rights except as provided in the terms of use agreement for the site of Apple support communities ("CSA"). ASC readers can copy for their personal use. The whole nor any part can be redistributed.

  • my windows Installer keeps on pop - lying upwards each time I click on the microsoft office 2007 home and student... and do pop - ing for others... is what is happening? any solution?

    Windows® Installer. V 4.5.6002.18005
    msiexec/option [optional parameter]
    Installation options
    Installs or configures a product
    /a
    Administrative installation - installs a product on the network
    /j [/t ] [/g ]
    Publishes a product - m for all users, allows the current user
    Uninstalls the product
    Display options
    / quiet
    Quiet mode, no user interaction
    / passive
    Automatic mode - only progress bar
    / q [n | b | r | f]
    Sets the user interface level
    n no user interface
    b Basic UI
    r reduced UI
    f-full UI (default)
    / Help
    Help information
    Restart options
    /norestart
    Do not restart after the installation is complete
    /promptrestart
    Prompts the user to restart if necessary
    /forcerestart
    Always restarts the computer after installation
    Logging options
    / l [I | w | e | a | r | u | c | m | o | p | v | x | + |. | *]
    i status messages
    w warnings recoverable
    e-all error messages
    a startup of actions
    r registers of the specific action of the
    u user requests
    c initial UI parameters
    m out-of-memory or fatal exit information
    o disk out-of-space messages
    p - Terminal properties
    v performance
    x extra debugging information
    + - Add to the existing log file
    ! -Flush each line in the log
    * - Log all information, except the x and v options
    / log
    Equivalent of / l *.
    Update options
    / Update [; Update2.msp]
    Apply updates
    / uninstall [; Update2.msp] / package
    Remove the updates of a product
    Repair options
    /f [p | e | c | m | s | o | d | a | u: v]
    Repairs a product
    p only if the file is missing
    o If the file is missing or an earlier version is installed (by default)
    e If the file is missing or an equal or higher version is installed
    d if the file is missing or a different version is installed
    c If the file is missing or checksum does not match the calculated value
    has all the files to reinstall the forces
    u all (default) user-specific registry entries
    m all requirements (by default) computer-specific registry entries
    s all (default) shortcuts
    v-runs from source and recaches local package
    Setting public properties
    [PROPERTY = PropertyValue]
    Consult the SDK Windows® install to get additional documentation on the
    command line syntax.
    Copyright © Microsoft Corporation. All rights reserved.
    Portions of this software are based in part on the work of the Independent JPEG Group.

    Hi Ruben Ganesh.

    1. When do you have the problem started?

    2. did you of recent changes on the system?

    You can read the following article and try Method 2, 3 and 4A proposed to solve the problems of Windows install.

    How to troubleshoot issues that may occur when you install, uninstall, or upgrade one program on a Windows computer

    Hope this information is useful.

  • Why a new tab coming upwards each time I click on firefox?

    Suddenly 2 days ago, when he clicks on my Firefox icon, it brings to the top of my home page but then immediately appear a new tab with a lot of unwanted application on it, I have to close to my home page. How to keep doing this? I don't want to see all the apps.

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance).

    • Do NOT click on the reset button on the startup window Mode without failure.

    You can check the target line in the shortcut to the Firefox desktop (right click: properties) to make sure that nothing is added after the path to the Firefox program.

    Make a check of malware with several malware scanning of programs on the Windows computer.

    Please scan with all programs, because each program detects a different malicious program.

    All of these programs have free versions.

    Make sure that you update each program to get the latest version of their databases before scanning.

    Alternatively, you can write a check for an infection rootkit TDSSKiller.

    See also:

  • Adobe Community Help update files fails each time after startup

    Hello

    I for example go to the "Support Center for Photoshop" in the menu in the application Adobe Community Help starts up and says theres news, I want to download that. It seems to start the dl fine, then an error "16882" (if I remember it's good).

    Why? We have very fast very internet broadband and I use a 2011 27 "iMac with max Gig RAM installed.

    Advice it would be appreciated.

    Thank you!

    Seems Adobe Air or Cummunity help went from cprrupt. To follow the suggestions below:

    Step 1: Uninstall utilities adobe air and re - install the latest adobe AIR of 'http://get.adobe.com/air/otherversions/'.

    Step 2: Follow "http://kb2.adobe.com/cps/842/cpsid_84215.html" and re-install the community help Air application.

    Step 3: Restart the machine and launch adobe Community Help and try to install all the updates and check if it works very well.

    Hope that helps!

    Arpit

  • Vertical scrolling got the reset each time that I use Ultra Nav to scroll vertically

    I have a really weird behaviour UltraNav on my new refub T410 2537-XH4 (2537-DB5 before refub). I hope that someone here may know how to solve.

    Step 1: I go to control panel-> mouse-> tab control wheel-> Schölling Vertical-> select "one screen at a time"-> click on the OK"" button.

    Step 2: open a long web page and use UltraNav to scroll upwards or downwards.

    Then I go back to the position of the mouse in step 1 and now the setting in the tab of the wheel is reset to scroll one line at a time. I repeated several times, and as soon as I use UltraNav, it resets this return.

    I have Windows 7 Ultimate 64 bit, updated with all latest drivers and system ThinkAdvantage v4.

    Any ideas?


  • Use 6 s more: iPhone battery is not displayed and the time standby and use are the same, even I do not use it

    Hello. I just bought an Iphone 6s MORE and just updated to iOS 9.2 and I had this problem with applications that consume my battery is to say the list of applications that drain the battery does NOT appear when I click on settings > battery. And also I meet another problem that is my standby and usage time appeared at the same time even if I SLEEP there during the entire period. Someone of you this problem? If yes kindly share here how you can solve the problem

    Force restart the phone now sleep and home for 10 seconds, button until the Apple logo comes back again.

    You won't lose data, but which can cure some problems after installing new software.

    The same use and waiting time is a sign for some applications, always running in the background, even when the phone is in standby. Restart will force close those apps.

    The list of applications appears only when you used some applications for some time.

  • HELP - Animate plant all the time when I use to define an action of JS {}

    Can someone help me - animated adobe (normal version and the Version of animate CC) crashes if I try to set a JS Action on {} button.

    I´am with the new iMac Version 3.2 GhZ Core i5 processor, the last OS X MAVERICKS set to date as the 10.9.

    Hope that 4 useful news

    solong

    > Ralphsen

    Hello elaine.

    Meanwhile a member of the staff has solved the problem - I had a problem of crash with adobe as muse and the trick to this bug - fix also works

    for edge to animate. I´am so happy that it is it - great work from your service team, thank you very much ;-)

    I copy the answer below--wish you a good time and certainly a merry x - mas

    > Ralphsen

    Looking at the initial crash log, I expect that the accident was caused by the code to:

    de.danholt.FritzCMPlugin

    If you remove or disable if this third party plugin (which tries to provide or modify the context menu, menu right aka, behavior) accidents will disappear.

  • Play random symbols when you click on the button

    First of all, I apologize for not be able to use answers that have already been presented in response to questions similar to this, but none of the positions I have pored over seem to cover what I'm after (unless it's a matter of my failure understand the concept... which may well be the case! Haha!)

    Anyway, I have a dozen of symbols animated on stage and I would like a chance to play each time users click on a button.

    Advice, or guidance to any Tuts out there, are very welcome.

    Cheers in advance

    Frannie x

    Here's something a little more concise that can help or otherwise be of interest:

    var childSymbols = sym.getChildSymbols ();

    var r = Math.floor ((Math.random () * 4));

    childSymbols [r] .play ();

    Add this code to your click handler. Only minor changes are needed if the instances of the button and the symbol are not at the same level of symbol.

    HTH,

    Joe

  • To make the text inside inputText disappear at the click

    Hello
    I use jdev 11.1.1.6. How to make the text inside inputText disappear at the click using af:clientListener?

    Hello
    Use clickEvent.getSource ().setValue(""); instead of clickEvent.getSource ().setSubmittedValue("");
    Following the code works for me

    
    
      
        
      
      
        function onClick(clickEvent) {
           // clickEvent.getSource().setSubmittedValue('');
            clickEvent.getSource().setValue("");
        }
      
    
    
  • I think that my safari is infected with the virus, he on redirect keeps me from another Web site each time that I click my mouse or press a key on my keyboard... Help!

    I think that my safari (Yosemite) is infected by the virus, he on redirect keeps me from another Web site each time that I click of my mouse or press a key on my keyboard... Help!

    I can't seem to download the print screen, here, anyway, it starts the LINK share appears every time it redirect:

    -"ps4ux.com/click? h = Ax722bagzrmWM3RP_5wPSvP63fG7dqaJCNo55LiVexxUaivPBxSeS7A3C2V4-bO...» »-

    middle part is hidden by «...» »

    the last part is:

    -"ttp: 3% a % 2F % www.apple.com%2F 2F & rt = 46 & date_sid = 50fc88582b4e8512b3e35e56351a22a3" in a new tab.

    Run etrecheck to go to etrecheck.com and see what is running under the hood.

  • ADE 7 every time I click on t for text, it says that it has stopped working. Help

    ADE 7 every time I click on t for text, he said that he stopped working help

    What is ADE?

Maybe you are looking for