How do I remove a specific instance on click

Hi everyone,
I'm trying to code a little game where instances of objects should get randomly spawned and once you click on them,
they should be "despawned" with a little animation.
I got most things set up but I don't seem to get how to access the instance properly. Here is a code snippet:
function spawnObject()
   var randomNumber1 = Math.ceil(Math.random()*100);
  var randomNumber2 = Math.ceil(Math.random()*100);
  if(randomNumber1>=95 && randomNumber2 >= 90)
  addChild(goldCoin);
  goldCoin.addEventListener(MouseEvent.CLICK, despawnCoin);
  else if (randomNumber1>=95 && randomNumber2 <= 60)
  addChild(copperCoin);
  copperCoin.name.addEventListener(MouseEvent.CLICK, despawnCoin);
function killcoin(e:Event){
//Animation will go here
  removeChild(???);
I don't really know how to remove the Child properly.
Especially since this function can get called often so that there are multiple gold/copper coins on screen for example and I only want to "despawn" the one that I click on.
Do you have any Idea on how to do that?

use:
function spawnObject()
   var randomNumber1 = Math.ceil(Math.random()*100);
  var randomNumber2 = Math.ceil(Math.random()*100);
  if(randomNumber1>=95 && randomNumber2 >= 90)
  addChild(goldCoin);
  goldCoin.addEventListener(MouseEvent.CLICK, despawnCoin);
  else if (randomNumber1>=95 && randomNumber2 <= 60)
  addChild(copperCoin);
  copperCoin.name.addEventListener(MouseEvent.CLICK, despawnCoin);
function killcoin(e:Event){
//Animation will go here
  removeChild(e.currentTarget);

Similar Messages

  • HT4207 how can I remove a specific gmail account from my ipad 4?

    How can I remove a specific Gmail account from my ipad 4?

    Assuming you are not syncing with iCloud and you mean, syncing with iTunes only...(you can only use one or the other for syncing to prevent duplicates)
    iTunes -
    - Open iTunes on your Mac. Connect your iPad. Then click on your iPad (either its name or just "iPad"), then click the info tab (right above the photo of an iPad in the middle). From here you can select sync contacts, then sync groups, and select the groups you want and choose Apply/Sync in the bottom left corner.
    iCloud -
    - With iCloud if you just sign into iCloud in System Preferences and turn on Contacts, it will prompt to merge all of your contacts that are not already syncing with Gmail or Yahoo!, etc. so there really isnt a way to pick and choose as much with that.
    - However if you really want to use iCloud and not iTunes, you could import the contacts that you want into iCloud.com, but you would need to export them from your Contacts App on your Mac and then import them into iCloud (VCard / .VCF is the format you want).
    * Exporting the contacts from your Mac Contacts Application --> http://mac.tutsplus.com/tutorials/app-training/contacts-101-a-beginners-guide-to -contacts-on-os-x/ (further down the page)
    *Importing contacts into iCloud.com - http://support.apple.com/kb/PH3605
    **NOTE - Remember if you do the import into iCloud.com method, DO NOT sign into System Preferences > iCloud, and choose to MERGE contacts. If you do this later, all of your contacts will merge with iCloud and you will have duplicates of this group.
    I hope this isnt too confusing. Have a good night!

  • How do I removing a specific item from an Array?

    Hi there.
    I am having an array of movieclips and when my circle(controlled with the keyboard) hitTests true with one of the movieclips inside that array i want to remove that movieclip from the array so when i hitTest it again it returns false (I hitTest using a "for in" with that array).
    How do i remove a specific item from within an array?
    Can someone help me? Thanks a lot.

    i haven't noticed anyone showing deference because of the points.  in fact, i've seen some people (a minority, to be sure) be just obnoxious about it.  i never encountered that before:  some people feel they have power because they can dole out points.
    but overall i agree with you:  the loss of the list of threads i am participating in, along with the most recent posters name, is a significant drawback of the new forums.  and there's nothing new in these forums that offsets that drawback.
    in addition, i think we've lost way more than 1/2 the older threads.  that's a lot of information that's no longer available.

  • How can we remove a specific hyperlink using Acrobat X Pro ?

    How can we remove a specific hyperlink using Acrobat X Pro ?

    If the link is a real annotation in the file, just switch to the link tool in Acrobat, select it and press Delete.
    The Acrobat Family will, by default, scan all the text in a PDF file and temporarily make any URL or email address into a hotlink. You cannot stop that from happening as it's a preference on the client side; the only solution would be to break the pattern by adding a hairline space next to the colon or the @ symbol.

  • How do I remove this certain instance of Google search from my list of search bars?

    Recently, I decided to try a different search engine in place of Google, which I removed from my list of search engines in the search bar via Manage Search Engines. Dissatisfied with this search engine, I decided to switch back, using an add-on called Add to Search Bar. However, this disables the autocomplete feature for that search engine. I was able to get the autocomplete feature back by restoring the default search engines in the Manage Search Engines menu. However, now I can't remove the instance of Google's search engine which I installed with the add-on. When I remove it, the OK button becomes unresponsive and I'm forced to cancel.
    Add to Search Bar
    https://addons.mozilla.org/en-US/firefox/addon/add-to-search-bar/
    I don't have any trouble deleting other search engines installed by this add-on, other than this Google one.
    The .xml file for this search engine doesn't appear in the searchplugins folder in my profile folder.

    Try to delete search.json file and a possible search.sqlite file in the Firefox Profile Folder.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Unable_to_search_or_add_new_engines

  • How to remove a specific entry from back stack in windows 8.1

    Hi,
    How can i remove a specific back stack entry in windows phone.In windows phone 8 NavigationService.RemoveBackentry() method is used similarly is there any way
    Thanks,
    Punith

    Did you meant Windows Phone 8.1 xaml or silverlight? For silverlight, NavigationService.RemoveBackEntry() is there & for WP8.1 xaml(RT), you can use :
    Frame.BackStack.RemoveAt(Frame.BackStack.Count - 1);
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • How do I remove a font from FM 9

    How can I remove a specific font from FM 9?  I've looked in the system fonts and the font (Adobe Garamond) is not available there.  The problem is when we open up some of our reports this font gets used instead of plain Garamond. While working in Frame this is not a problem but when we go to save the report as PDF the Adboe Garamond sections look horrid.
    So is it possible to remove the Adobe Garamond font and always have plain Garamond used?
    Thanks,
    Brenden

    Fonts can come from a variety of places; first off, could you tell us what printer you have as the Windows' system default printer when you create PDFs.  The best results for creating PDFS come from having it set to "Adobe PDF", so test with that and see what you get.
    Some printers have fonts built into them, so if you have, say, a "Lexmark xxx" printer as the default then the fonts could be from the printer itself.
    Second, look at the settings in Distiller, in the menu Font Locations.
    Third, there's a setting in Distiller fonts dialog about ignoring truetype,  let us know what you have set there.
    Also, it's always a good idea to specify the exact FM version (from Help > About, the "pxxx" numbers) when you post on the forum, in case you haven't updated and there happens to be an issue that is solved by an update.
    Sheila

  • Connect to a specific instance

    Hi all,
    How to connect to a specific instance in RAC, with out using services and load balancing.
    our requirement is such that, the load balancing is of and my application has to connect to a specific instance at runtime.. where i can specify the SID of the instance or Instance number at runtime.
    Is this possible in RAC, if Yes, how should the connect string should look in the tnsnames.ora

    You can also specify services (using dbca it is very easy)
    When you configure your service define it as prefered on instance1 (if you need HA, you can make it available on instance2)
    Then copy the section from the tnsnames.ora file for the service that you just defined.(dbca automatically updates tnsnames, and crs with the new service definition)
    Just remember that services do not restart automatically after a clean shutdown of the environment. (If it was a crash, they will resume their last state) You will need to script a service restart if you want it to be automatic.

  • I am selling my 7th generation iPod nano. How do I remove my user information?

    I am selling my 7th generation iPod nano. How do I remove my user information?

    Click here and follow the instructions.
    (118063)

  • How to remove the entity instances from a decision report

    Please see below the rules and the resulting decision report
    How can I remove, from the decision report, the four lines that say "the persons in the family unit", instance 1, instance 2, instance 3?
    I just can't seem to find a place where the use of silent or invisible will cause the four lines not to appear
    The Rules
    the applicants for income assistance in a family unit have completed (and submitted) to the minister an application for income assistance (part1) form if
    forall(the persons in the family unit, the person satisfies the requirements to complete and submit an application for assistance (part 1) form)
    the person satisfies the requirements to complete and submit an application for assistance (part 1) form if
    all
    the person is an applicant
    s4.1(2)(a)(i)     the person has provided a social insurance number
    s4.1(2)(a)(ii)     the person has provided the information, authorizations, declarations and verifications specified by the minister as required in the application for assistance (part 1) form
    The Decision Report
    EA Regs s4.1(2)(a)(Application - Part1) is satisfied.
    The applicants for income assistance in a family unit have completed (and submitted) to the minister an application for income assistance (part1) form.
    the persons in the family unit
    instance #1
    instance #2
    instance #3
    Abel satisfies the requirements to complete and submit an application for assistance (part 1) form.
    Abel is an applicant.
    Abel satisfies section s4.1(2)(a)(i).
    Abel has provided a social insurance number.
    Abel satisfies section s4.1(2)(a)(ii).
    Abel has provided the information, authorizations, declarations and verifications specified by the minister as required in the application for assistance (part 1) form.
    Edited by: A Gibson on Oct 11, 2010 3:35 PM

    Here are some further details. If images could be attached to this forum then I would have included some screenshots, but this forum only allows text.
    1. Set up regular name substitution (See the sections "Set up substitution" and "Substitute the actual value of a variable for its text" in the OPM Help article "Change the text of an interview question or sentence").
    2. In the Properties file, double-click on the entity. This will open the Edit Entity dialog.
    3. In the Edit Entity dialog, fill in the Identifier field with the variable you're using for the regular name substitution.
    4. Click OK and you're done!
    Cheers,
    Jasmine

  • How to remove a FLVPlayback Instance?

    Hi...after searching everywhere it seems as though the best
    way to avoid multiple problems with playing multiple FLV's in
    sequence is to remove the FLVPlayback instance and then reattach
    one. Problem is....how do you do it...ha!
    I attach it to a mc using the attachMovie method as described
    in the livedocs like so:
    mymainmc.attachMovie("FLVPlayback", "vPlayer", 0,
    {_x:-419.50, _y:-199.60, width:438.4, height:328.8});
    I get it to stop and go away by so:
    mymainmc.vPlayer.stop();
    mymainmc.vPlayer.unloadMovie();
    However I can't attach a new one since if I do a list objects
    debug "vPlayer" is still there. Sorry...was up late troubleshooting
    the other issue and I'm probably not awake yet for this easy
    question.

    boxdoctor,
    > Maybe I should say that it doesn't baffle me that they
    > all work, since I agree with you that it would make the
    > app eventually run really slow, but rather the fact that
    > the original playback instance vPlayer won't load a
    > new FLV content into it...
    I'm sorry to hear you're having trouble with it. :-/ I wish,
    too, I
    could offer something substantial in the way of help. In my
    own FLVPlayback
    experience -- which is admittedly not vast -- I haven't
    encountered your
    issue.
    > but maybe I'm asking too much of it...and indeed you
    > need to remove the FLVplayback and create a new
    > one which is what we're doing here.
    I've run a few tests with the Debugger panel, and the only
    FLVPlayback
    object I see (after a MovieClip.unloadMovie() removal) is the
    Component
    property in the _global object, which is where all AS classes
    go. Try
    followed my Component removal with ...
    delete _global.FLVPlayback;
    ... and ...
    _global.FLVPlayback
    ... neither of which seems to do anything.
    Have you considered this? Create a Library asset (a movie
    clip symbol)
    with an FLVPlayback instance in it, and attach *that* rather
    than attaching
    merely FLVPlayback. When it's time to "hit the reset button,"
    so to speak,
    drop the whole movie clip wrapper and re-attach as desired.
    It may not put
    you any further than you are, but it's easy to try and worth
    the shot.
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • How to remove the PCK instance!

    I want to uninstall and remove all the data so that I install the PCK with a clean system.  How can I remove all the PCK instances and start a fresh installation.
    I am also getting this error after successful PCK installation how can I resolve this error.
    ERROR:
    Application error occurs during processing the request.
      Details:   com.sap.aii.utilxi.prop.api.PropertiesException: Unable to read configuration data (ExchangeProfile/aii.properties)  The ID of this error is
    Exception id: [001B775FEAD200560000002700000AA000044210FC442FFB].
    Thanks
    Sarvesh

    I've found the reason... :-)
    I'm using the designer from Acrobat professional instead of the designer from Adobe LiveCycle.
    I've got Acrobat professionnal 7.0.0 and trying your sample it didn't function.
    Knowing that there was a new version of Acrobat professional (7.0.7)I've installed it, and now your sample function.
    I have to mention that the count method is not listed in the choice menu that appears when you're typing code inside the designer. It means that some functions have to be tryed even if the popup menu of the list of available methods doesn't mention it.. (in this case it's the count method)... :-)
    There are a lot of things like that (for example there is the checkbox problems that are not good managed before Acrobat Reader 7.0.7, and Acrobat professional 7.0.7)
    So I suggest to the developpers that are reading this post to always install the last version of Acrobat Reader, Acrobat Professionnal, Designer, in order that everything goes well with the product.
    gpalmieri

  • Hi, I have a specific website that keeps blocking me from going to website I want to view.  It is called vnebo.pro or mobi. I also have a pc computer with Kaspersky and it blocks it.  How do I remove it or block it from my computer.

    Hi,
    I have a specific website that keeps blocking me from going to website I want to view.  It is called vnebo.pro or mobi. I also have a pc computer with Kaspersky and it blocks it.  How do I remove it or block it from my computer?  It only appears at my home, when I use my mac at other places I don't have a problem.
    Thanks for any help!

    Thank you for the reply. I wanted to wait awhile in order to ensure that this corrected the issue. For a brief while, it did! However, it did not take long before the screen began once again hijacking my home button presses. This occurs even with Firefox removed from default applications ( triple-checked ).
    This never happened before version 35.

  • How do I remove an extra editable region in the head of a specific page?

    I have a single-template website.  My template has the standard two editable regions in the head ("title" and "head").  Somehow, one of my pages ended up with three editable regions in the head - two named "head" as well as title.  My template won't update this page because the editable regions don't match.  How do I remove this extra editable region from the head of the page?  I can't modify it on the page itself, of course, and I can't remove it by modifying the template because it's not part of the template.
    Thanks in advance!

    Your child page would not contain any editable regions if it wasn't attached to a Template.  Perhaps you nested templates which is the wrong thing to do.
    Go to Modify > Templates > Detach from Template.
    Nancy O.

  • How To Remove A Specific Application Name From The "Open With" Dialog

    When you right click on a file you are presented with the "Open With" menu item and you are also presented with a list of applications that could potentially be used to open that file.
    In my case, when I click on a file of type .mov I am presented with the name of an application that I want to remove from the list, because that application ( Miro.app (2.5.2) ) no longer exists on my system.
    What is the best way to remove that application name from the list?

    Ok, but how does one remove some of the applications that are appear in the context menu for a given file type? Is there an asc file which can be edited?
    For example, in my system a PDF can be opened with over 10 applications. I would like to see just the three ones I use: Acrobat, Skim and Preview.
    Thanks in advance.

Maybe you are looking for

  • Setting up SSO between EP and back-end SAP systems

    Can anybody give me some insight about setting up SSO between EP and back-end SAP systems. If possible some links to write up would be great. Thanu

  • Using my external hard disk as storage for itunes

    I am using a Powerbook with 80 GB internal HD and it ist getting quite stuffed with my 30 GB of music. I copied my complete iTunes folder from the PB to my external firewire drive (300 GB) and erased the itunes folder from the internal HD. In setting

  • Trying to install itunes onto a new laptop - stalling

    hi really looking for help here!!! not extremely technical but i'll give it my best go.... i'm trying to install itunes onto a new laptop its a compaq with windows 7. it belongs to a friend and it never had i tunes on it before. i have tried download

  • Changing a document's desktop icon to the cover of the document

    Hey gang, the subject pretty much says it all.  What I mean is, I opened a PDF file, then saved a shortcut to my desktop.  When I did, the shortcut icon was the cover of the document.  Great!  Now it's easier for me to choose which document to read! 

  • Can I revive a cancelled web page?

    Hi, I published a web page of our wedding photo, and finally unpublished it to avoid boring everybody. But now I find that if I republish the album, I have to redo all those meticulous captions with everyone's name! Is there a way to revive the previ