Please how do I unload and hide an external image?

I have been trying for a few hours now just to unload an image but I get an error when I try it which sais ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at tester_fla::MainTimeline/ontester2ButtonClick()
I have 2 buttons on the stage the first one adds the image and is called tester_btn, the second (attempts) to unload and hide the image and is called tester2_btn
My code is as follows:
tester_btn.addEventListener(MouseEvent.CLICK,ontesterButtonClick);
function ontesterButtonClick(event:MouseEvent):void {
var myrequest:URLRequest=new URLRequest ("HomeLogo.png");
var myloader:Loader = new Loader();
myloader.load(myrequest);
myloader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
function imgLoaded(event:Event):void{
addChild(myloader);
tester2_btn.addEventListener(MouseEvent.CLICK,ontester2ButtonClick);
function ontester2ButtonClick(event:MouseEvent):void {
var myrequest:URLRequest=new URLRequest ("HomeLogo.png");
var myloader:Loader = new Loader();
myloader.unload();
stage.removeChild(myloader);
Any help will be much appreciated!

whoa, you're creating a loader that's not accessible outside ontesterButtonClick and you're creating another locally defined loader with the same name that never gets added to the display list in ontester2ButtonClick and your nesting a named function.  all problems.  try:
try:
tester_btn.addEventListener(MouseEvent.CLICK,ontesterButtonClick);
var myloader:Loader = new Loader();
function ontesterButtonClick(event:MouseEvent):void {
     var myrequest:URLRequest=new URLRequest ("image");
     myloader.load(myrequest);
     myloader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
     addChild(myloader);
function imgLoaded(event:Event):void {
          // do whatever
tester2_btn.addEventListener(MouseEvent.CLICK,ontester2ButtonClick);
function ontester2ButtonClick(event:MouseEvent):void {
     var myrequest:URLRequest=new URLRequest ("HomeLogo.png");
     myloader.unload();
     removeChild(myloader);

Similar Messages

  • How can I display and hide toolbar?

    hello!
    Who can tell me, how I can display and hide ERP's toolbar?
    thanks

    it is the default i think you cannot hide the application toolbar.

  • How can I drag and drop an icon/image into a panel??

    Dear Friends:
    How can I drag and drop an icon/image from one panel into another target panel at any position in target panel at my will??
    any good example code available??
    I search for quite a while, cannot find a very good one.
    please help
    Thanks
    Sunny

    [url http://java.sun.com/developer/JDCTechTips/2003/tt0318.html#1]DRAGGING TEXT AND IMAGES WITH SWING

  • How do you crop and save a cropped image

    How do you crop and save a cropped image in PS Touch?

    This forum does not deal with any of the Touch applications.
    Try here:
    http://forums.adobe.com/community/photoshop_touch_for_phone
    or here:
    http://forums.adobe.com/community/creative_cloud_touch_apps/adobe_photoshop_touch

  • How to scale up and scale down a image in java

    i have a problem i want to scale the any image in java
    i mean that what i have to do actually when i scale up the image and scale down the image
    plz reply as soon as possible
    mail me at following address
    [email protected]
    [email protected]
    [email protected]

    Look at Image.getScaledImage(...)

  • PSE-10 how do I import and copy from external hard drive into organizer

    Can I import and copy from external hard drive into organizer? Under Get Photos, I select import  from folders/files but after browsing to the external hard drive the copy option is disabled/greyed out. I there a method to import and copy?

    That would be mounted as an internal drive and hence the corresponding option is not checked during Import.
    Once you import the media form this drive, you can select all and go for File >> Copy/Move files option and copy them wherever you want to.
    Hope this helps
    Thanks
    Andaleeb

  • JS CS3 How can I find -and delete- anchored empty images frames

    I have a script that works fine with text,
    I need the same function, but find and remove anchored empty image frames
    thx
    var myDoc = app.activeDocument
    for(var myCounter = myDoc.textFrames.length-1; myCounter>=0; myCounter--)
    var myFrames = myDoc.textFrames[myCounter]
    if (myDoc.textFrames[myCounter].contents == ""){
    myDoc.textFrames[myCounter].remove()

    I'd do it this way:
    1. Grab the document's allPageItems.
    2. Iterate over it, ignoring text frames.
    3. Check to see: (a) if the parent is a character and (b) if the graphics collection of the page item is empty. If so, delete it.
    Dave

  • How to disable updates and hide set as default browser option in firefox 31.0 for many users,like changing the setttings in any file

    Hi,
    I am trying to disable updates, set as default browser option and import settings from other browers permanently for many users for firefox 31.0.
    can you please help me with that. I know settings are going to prefs.js file in user profile. How can make this permanent for many users.

    Hi gaurav3012,
    Permanent change would be locking preferences: [http://kb.mozillazine.org/Locking_preferences]
    However importing many users profiles to different computers may require a new profile for each user.
    Currently there is an option to import bookmarks from other browsers, but not preferences.
    Update preferences can be read about here: [[Configuration Options for Updates]]
    Firefox ESR is also another version of Firefox that is meant for Enterprise environments [https://www.mozilla.org/en-US/firefox/organizations/] that mostly has their support on their mailing list.

  • Please How can I capture and integrate a single pulse of a DC signal from an external circuit

    Hello everyone
    I am trying to integrate a signal from an external circuit I have built. I want to capture just a single pulse from the signal and integrate it. Please can anyone assist me with how I can perform this?

    The 6008 has no hardware analog trigger, so to capture a single pulse, you will need to trigger in software.  It does have a digital trigger, so if you have a digital way to signal the start of your pulse, it would make your life easier.  You will need to ensure you take enough data to get an entire pulse.  At that point, use one of the trigger VIs to find the start (and possibly end) of your signal.  Take a subset of your data and integrate it (LabVIEW does support integration).
    If you have trouble finding anything, let us know.  Find the trigger and integration VIs using the search feature of the palettes.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • How can I show and hide an image or a decoration on the front panel during execution of the vi?

    Hello,
    I've made a user interface with a little grafic description.
    That description should change depending on user actions, e.g. if the user switches a button, some lines should disappear and some other lines should appear.
    I thought some decorations could be shown and hidden via something like a property node, but that is not possible. Images can also not be hidden during execution of the program.
    Is there any posibility to change a grafic user interface?
    Johannes
    LV 7.1
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    LV_Grafic.JPG ‏21 KB

    Thanks to Tim for drawing what I suggested as option while I had some real work to do.
    There is a trick of overcoming the index problem that was presented/devloped in the forum in the last month's: 
    You can place the decoration inside a cluster, so you can use the lable of the cluster to adress the decoration you want. The data type of the cluster doesn't mather for this, so you will hide the control/indicator. And you colour the cluster transparent (hint: right click with the coloring tool and use space to toggle). 
    Felix 
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • How do I show and hide a popup message by the program

    Hi,
    I've the following problem. Sometime the program must wait to open a seriel port. On slow machines, this could take some seconds.
    During this time I'll display a popup message with the message "please, be patient....".
    After the port is open, the message should be hide by the program.
    JOptionPane could be good, but without a "OK" button. Everthing should be controlled by the program.
    I would implement the Runnable interface for the showing of the popup message.
    Any ideas? Thanks in advance.
    Hans

    You can use a JDialog... this will act like JOptionPane, but you can put on it whatever components you like... so no OK button!
    For example:
    JDialog dialog = new JDialog(parentFrame);
    dialog.add(new JLabel("Please be patient", BorderLayout.CENTER);
    dialog.pack();
    dialog.setLocation(100,100);
    dialog.setVisible(true);
    dialog.setVisible(false);

  • How to play iTunes and music from external hard drive?

    I recently back up all my music from my old computer on to an external hard drive. I have a new computer but don't want to store all the music on the computer's hard drive. I would rather play iTunes and all the music straight off of the hard drive. How do I do this?
    I already downloaded and installed iTunes on my external hard drive and my music is on a separate folder. When I open iTunes it says that I have no music in the library. How do I tell iTunes to use all the music from the external hard drive? I do not want to save anything on my computer's internal hard drive if possible because I do not have enough space.
    Thanks for the help. Also, if I should clarify anything else then please just let me know!

    did you ever find the answer to this question? I have the same problem

  • How can i copy and past music files, Images and Videos to my Apple Iphone?

    I have a new Iphone 4 mobile phone. Any one can  help me  for how can i stote music,videos and images files in My Iphone?
    When i search on internet i saw icloud and itunes. Is there any net connection requered to use icloud or itunes? Without net connect how can i store my files in my apple phone?

    Prabakhar,
    First, please verify that you mean CDDA and not CDA.  CDA is not an audio format.
    CDDA is pretty much the "raw" format of an audio CD.  It is extremely unusual to have it as a separate file.  If you still have the original CD that it came from, re-rip the CD using this document.  (Edit added.  I meant to add the link to this document:  http://support.apple.com/kb/PH12486  )
    Otherwise, a web search will turn up converters that can process a CDDA file, although I have not used them.
    Message was edited by: ed2345

  • How to restore library and iPod from external flash drive

    I had trouble getting my iPod to load new music after I got a new PC. I reinstalled iTunes and the new music loaded but the old music in my library and iPod were deleted. How do I transfer my music from my flash drive back to my library and iPod classic?

    did you ever find the answer to this question? I have the same problem

  • How to put iTunes and library on EXTERNAL hard drive? Having major troubles

    I started importing my entire CD collection about a week ago. Got halfway finished before realizing it wouldn't all fit on my computer's hard drive.
    Bought a Maxtor 100GB external hard drive, moved all library folders there, then reinstalled iTunes on there as well. I used "Ad Folder to Library" to return all the tunes into iTunes library.
    All of that seemed to work just fine, but now I've resumed importing my CDs and they are automatically going right to my computers C drive (the stock internal hard drive) and into "my music folder". Obviously, there is no room there.
    How can I get it so that I import CDs onto the NEW external hard drive, and have iTunes pull them from there? I want ALL my library and music folders in the same place, on the external E drive. Can I do this? If so, how??
    Many thanks to anyone who can help!

    "I want ALL my library and music folders in the same place, on the external E drive. Can I do this? If so, how??"
    If you want to make another drive (direct or portable) on your PC the main music location for iTunes, move all song files there, as well as any future imported music from CDs, here is one method (see the links below):
    You will maintain your playlists, ratings, comments, etc. This will only move your music folders location, NOT your iTunes program files or the Library database files. It is my opinion that programs (i.e. – iTunes) work better when installed on your main hard drive. At the very least, it makes it easier to manage all your programs if they are centrally located on one hard drive (the Windows default standard).
    See these links for some step-by-step info:
    iLounge: Moving your iTunes Library to a New Hard Drive
    MacMuse: iTfW: Move iTunes music/Library to new drive
    iTunes: Moving your iTunes Music folder
    If you are moving the music to an external hard drive or network drive, after the transfer (and to work correctly), the drive must be running prior to your opening iTunes. If not, iTunes will reset the location of your music folder location to the default location (usually: ‘C:\...My Music\iTunes\iTunes Music’). If this happens, you need to manually change the path back to your external location, or future CD ‘Imports’ will be deposited on your internal HD.
    Also make sure that the new drive always loads as the same Drive Letter, otherwise you will lose the references within iTunes.

Maybe you are looking for

  • Imovie 9.0.9 wont open

    I just purchased imovie 11.  It wont launch.  I just got my mac back from best buy with a new harddrive in it.  But I cannot launch imovie.

  • Reversal of TDS IN F-54

    Dear All 1. im making the vendor downpayment at that time TDS is deducting 2.im posting vendor invoice at that time also TDS dedcuting 3.when im clearing the down payment in (f-54) tds is not reversing only the amount is revrsing what could be the pr

  • How to create a new line in TEXT_ITEM in WAD ???

    Hi all, I would like to create an online help on my WAD application. Thus, I'm using TEXT_ITEM to write/display my help but forum text is lost everytime. How can I do something like that in a TEXT_ITEM ? - blablabalabla - blablabalabla At the moment

  • Trader invoice -MIRO

    Dear All,              i have already gone thru the answers on this scenario given in the forum but still not able to find the solution.            i am purchasing v-belt from a trader. at the time of po i donot know on what amount the trader will ch

  • I can't get along with Tomcat and MySQL

    i'm using tomcat 5.5 and wan to connect to mysql database. when trying to run my webapp, the compiler said like the driver(java-connector) is not detected. what should i do now... someone tell me please. and where exactly i should copy the driver(jar