Trouble unloading jpeg with unload() or removeChild()

Hi Everyone,
I'm working on a project that is like a jigsaw puzzle.  The use can select from a few different puzzles that have different piece arrangements.  Once the puzzle swf file is loaded, the user can select images from a gallery to place in the pieces to make a custom puzzle where the puzzle piece movie clip that was selected masks the image that was selected.
So the puzzle swf loads fine and I add it to the stage with:
addChild(puzzle);
The jpegs also load and get masked correctly.  When I add the jpeg image, I add it to the puzzle object and the addChild looks like this:
puzzle.addChild(imageJPEGLoader);
imageJPEGLoader.load(new URLRequest(imageJPEGName));
imageJPEGLoader.x = 0;
imageJPEGLoader.y = 0;
imageJPEGLoader.mask = puzzle.maskPiece1_mc;
Where imageJPEGLoader is the loader I use to get the jpeg image.
Everything works great.  However, if the user wants to change the image used, I want to remove the child (right?).
I thought this would work:
puzzle.removeChild(imageJPEGLoader);
but it doesn't.  I get the following error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at puzzle.fla::MainTimeline/getImage()
I think I'm obviously not understanding the parent/child relationship fully.  I thought if imageJPEGLoader was inside puzzle, that the dot syntax would get me to the object I needed.  Everything works fine in this file except for putting a new jpeg on a piece that already had a jpeg masked.
Can someone please point me in the right direction?

Can you show all of the relevant code as it is arranged in your file (functions, etc)?

Similar Messages

  • I have a Nikon D7100 and am having trouble downloading jpegs to my iPad. I get a red exclamation point instead of the green check mark, they dow all show up as thumbnails but won't download

    I'm having trouble downloading jpeg files from my Nikon D7100 to my 3rd gen iPad. I see them come up for download and select download and a red exclamation point shows up in the bottome RH corner of the thumbnail instead of the green check

    Hey freelance698,
    I was able to find two articles that might assist you in troubleshooting the issue:
    iPad: Using the iPad Camera Connection Kit
    http://support.apple.com/kb/HT4101
    iPad: Using iPad Camera Connector with unsupported USB devices
    http://support.apple.com/kb/HT4106
    Hope that helps,
    David

  • TS3276 Having trouble sending jpeg images as attachments in Mac email.....they go thru as images and PC users can't see the SAVE or QUICK LOOK boxes that Mac mail has.  One friend scrolled over the image, right clicked on it and saved as a PNG file.

    Having trouble sending jpeg images as attachments in Mac email.....they go thru as images and PC users can't see the SAVE or QUICK LOOK boxes that Mac mail has.  One friend scrolled over the image, right clicked on it and saved as a PNG file.

    Apple Mail isn't going to change the format of any of your attachments. it isn't going to corrupt them either.
    Exchange is a transport protocol and server. The issue you describe is not related to Exchange.
    There are many different versions of Microsoft Outlook in use and they all have e-mail bugs. Different versions have different bugs. Some Apple Mail hack to get around a bug in Outlook 2003 may cause the same message to be problematic in Outlook 2000. Fix them both and another issue will cause trouble in Outlook 2007. You can't fix this. Apple can't fix this. Microsoft can and has but that is irrelevant if your recipients are using older versions.
    One specific problem is that Apple Mail always sends image attachments inline, as images, not as iconized files. You can change this with Attachment Tamer. Just be aware that use of this software will break other things such as Stationery. E-mail is just a disaster. To date, no one outside of Apple has ever implemented the e-mail standards from 1993. Apple has continually changed its e-mail software to be more compatible with the de-facto standards that Netscape and Microsoft have unilaterally defined and people documented as "standards" after the fact. The e-mail messages that Apple Mail sends are 100% correct and do not violate any of the original standards from 1993 or the Microsoft/Netscape modifications. The problem is entirely bugs and limitations in various versions of Outlook.

  • How to read and write Png and jpeg with  Alpha

    Hi
    I have trouble reading and writeing PNG and JPEGs that have an alpha channel (for transparency).
    Reading works, if i use Toolkit.getImage() method, but works NOT if i use ImageIO.read() method.
    Writing does NOT work using ImageIO.write()method. Instead i got a "java.lang.UnsupportedOperationException: Unsupported write variant!"
    See Test class and commandline output below:
    /****************START*****************************/
    package de.multivisual.bodo.test;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.File;
    import java.net.URL;
    import java.util.Iterator;
    import javax.imageio.*;
    import javax.imageio.metadata.IIOMetadata;
    import javax.imageio.stream.ImageInputStream;
    import javax.imageio.stream.ImageOutputStream;
    public class AlphaChannelTest implements ImageObserver {
      Toolkit toolkit;
      Image img;
      public AlphaChannelTest() {
        super();
        toolkit = Toolkit.getDefaultToolkit();
        URL url =
          AlphaChannelTest.class.getResource(
            "/de/multivisual/bodo/test/" + "alphatest.png");
        img = toolkit.getImage(url);
        try {
          ImageInputStream imageInput =
            ImageIO.createImageInputStream(url.openStream());
          Iterator it = ImageIO.getImageReaders(imageInput);
          ImageReader reader = null;
          while (it.hasNext()) {
            reader = (ImageReader) it.next();
            System.out.println(reader.toString());
          reader.setInput(imageInput);
          ImageReadParam param = reader.getDefaultReadParam();
          BufferedImage bimg = reader.read(0, param);
          SampleModel samMod = bimg.getSampleModel();
          ColorModel colMod =       bimg.getColorModel();
          String[] propNames = bimg.getPropertyNames();
          IIOMetadata meta = reader.getImageMetadata(0);
          System.err.println("\n*****test image that was read using new Jdk 1.4 ImageIO.read() method");
          alphaTest(bimg);
        } catch (Exception e) {
          //e.printStackTrace();
        if (img != null)
          toolkit.prepareImage(img, -1, -1, this);
        try {
          synchronized (this) {
            System.out.println("wait");
            this.wait();
        } catch (Exception e) {
          e.printStackTrace();
        System.out.println("end");
      public void alphaTest(BufferedImage bi) {
        Raster raster = bi.getData();
        float[] sample = null;
        System.out.println("raster :");
        for (int y = 0; y < raster.getHeight(); y++) {
          for (int x = 0; x < raster.getWidth(); x++) {
            sample = raster.getPixel(x, y, sample);
            System.out.print("(");
            for (int i = 0; i < sample.length; i++) {
              System.out.print(":" + sample);
    System.out.print(")");
    System.out.println();
    Raster araster = bi.getAlphaRaster();
    if (araster == null){
         System.err.println("there is no Alpha channel!!!!!!!!!");
         return ;
    } else {
         System.out.println("Alpha channel found !");
    float[] asample = null;
    System.out.println("raster alpha:");
    for (int y = 0; y < araster.getHeight(); y++) {
    for (int x = 0; x < araster.getWidth(); x++) {
    asample = araster.getPixel(x, y, asample);
    for (int i = 0; i < asample.length; i++) {
    System.out.print(" " + asample[i]);
    System.out.println();
    String format ="PNG";
    System.out.println("##########Test Writing using new JDK1.4.1 ImageIO:");
    Iterator writers = ImageIO.getImageWritersByFormatName(format);
    ImageWriter writer = (ImageWriter) writers.next();
    ImageWriteParam param = writer.getDefaultWriteParam();
    ImageTypeSpecifier imTy = param.getDestinationType();
    ImageTypeSpecifier imTySp =
    ImageTypeSpecifier.createFromRenderedImage(bi);
    param.setDestinationType(imTySp);
    File f = new File("c:/tmp/myimage."+format);
    try {
    ImageOutputStream ios = ImageIO.createImageOutputStream(f);
    writer.setOutput(ios);
    writer.writeInsert(0, new IIOImage(bi, null, null), param);
    } catch (Exception e) {
         System.err.println("could not write "+format+" file with alpha channel !");
    e.printStackTrace();
    public boolean imageUpdate(
    Image img,
    int infoflags,
    int x,
    int y,
    int width,
    int height) {
    if ((toolkit.checkImage(img, -1, -1, null)
    & (ImageObserver.HEIGHT | ImageObserver.WIDTH | ImageObserver.ALLBITS))
    == 35) {
    int iw = img.getWidth(this);
    int ih = img.getHeight(this);
    BufferedImage bi = new BufferedImage(iw, ih, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D big = bi.createGraphics();
    big.drawImage(img, 0, 0, this);
    System.err.println("+++++test image that was read using old Toolkti.getImage method");
    alphaTest(bi);
    synchronized (this) {
    this.notifyAll();
    return false;
    return true; // image is not yet completely loaded into memory
    public static void main(String[] args) {
    //     BufferedImage image = new
    // BufferedImage();
    new AlphaChannelTest();
    /*************************END********************/
    The commandline looks like this:
    [i]
    com.sun.imageio.plugins.png.PNGImageReader@d1fa5
    *****test image that was read using new Jdk 1.4 ImageIO.read() method
    raster :
    there is no Alpha channel!!!!!!!!!
    wait
    +++++test image that was read using old Toolkti.getImage method
    raster :
    Alpha channel found !
    raster alpha:
    ##########Test Writing using new JDK1.4.1 ImageIO:
    could not write PNG file with alpha channel !
    java.lang.UnsupportedOperationException: Unsupported write variant!
         at javax.imageio.ImageWriter.unsupported(ImageWriter.java:600)
         at javax.imageio.ImageWriter.writeInsert(ImageWriter.java:973)
         at de.multivisual.bodo.test.AlphaChannelTest.alphaTest(AlphaChannelTest.java:113)
         at de.multivisual.bodo.test.AlphaChannelTest.imageUpdate(AlphaChannelTest.java:135)
         at sun.awt.image.ImageWatched.newInfo(ImageWatched.java:55)
         at sun.awt.image.ImageRepresentation.imageComplete(ImageRepresentation.java:636)
         at sun.awt.image.ImageDecoder.imageComplete(ImageDecoder.java:135)
         at sun.awt.image.PNGImageDecoder.produceImage(PNGImageDecoder.java:511)
         at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:257)
         at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
         at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    end

    in between i found out that the my png and jpeg test images did not have an alpha channel, since the tool i used to create them, did not write the alpha channel to disk.
    if i use png with alpha channel, then the read works correktly with ImageIO.read()
    however the read problem still remains for gifs and the write does not work for gifs and neither for pngs.
    whether jpegs can be read with alphachannel i don't know since i don't have a tool to create jpeg with alpha channel. (at least gimp and corel9 are not able to )
    and it is not possible to write the previous read png with alpha channel back as and jpeg with alpha channel

  • "Save image" button of Camera Raw does not save JPEG with modifications made.

    I am using Bridge CC to process my RAW images and make modifications to some JPEG images as well.  I have no need to further alter images in Photoshop at the moment, so I do all modifications in Camera Raw. After altering my images, I then press the "save image" button at the left bottom corner of Camera Raw and choose the settings to save in JPEG.  However, when I upload these JPEG images to a website or when I email them, the image is uploaded without the modifications I had done!  It seems to me that Camera Raw is saving JPEGs the same way it does for RAW images, in a non-destructive manner, only attaching instructions for the images to be displayed properly on Photoshop. But when I save an image in JPEG, I expect the image to be saved entirely with the modifications I made while still keeping the original RAW file.  What goes on then?  What is Camera Raw doing and how do I get to save a modified image in JPEG with Camera Raw?  Would you please explain?
    Many thanks for your help,
    Beza

    Hi,
    What version of camera raw and operating system are you using?

  • I have a MacBook Air, OS 10.8.5 I am having trouble sending attachments with Mail. Even small (130K) files don't go. It tries to send then gives up. What can I do to fix this?

    I am having trouble send messages with attachments in Mail. Even small attachments (130K) Mail tries to send, then gives up and the message sits in my out box. How can I fix this?

    1. You need an external DVD drive.
    2. There are no Mac OS X applications or other software in the iTunes App Store.
    (116312)

  • McAfee SiteAdvisor is no longer working with my Safari 8.0.  I never had trouble using it with Safari before this latest version.  Has anyone else had this problem?

    McAfee SiteAdvisor is no longer working with my Safari 8.0.  I never had trouble using it with Safari before this latest version.  Has anyone else had this problem?  I contacted McAfee support and they said nobody else is reporting this issue.

    Wow, life is certainly tough for you.
    S***t happens.  That's why there's a warranty.

  • I am have trouble sending email with an attachment?

    I am having trouble sending emails with an attachment.  Does anyone have a solution to this problem?

    Impossible to answer with information provided
    Allan

  • Trouble logging in with my adobe ID

    Hello, I'm useing PE 8 and am having trouble logging on with my adobe ID. I'm getting error 400 and check network connections. I know I have a internet connection. Thanks

    No, adobe never supports any version of PSE after a new one comes out, and it doesn't support the current version much.
    The only updates for PSE 8 are manually installed, so go to help>updates and when the updater tries to run, set it  not to check again. I'm assuming you're using the windows version, so the ACR updates (all the updates there are) are here:
    http://www.adobe.com/support/downloads/product.jsp?product=40&platform=Windows

  • Open untagged JPEG with external editor, then be attached with sRGB profile

    Hi there,
    I wonder why I open untagged JPEG with "external editor" (Photoshop CS) , then the JPEG will be attached with sRGB profile. Of course my color setting on photoshop is "Use the embedded profile".
    I think sRGB is the default RGB space of colorsync utility , because the profile is also sRGB when you check "Add Colorsync Profile" on iPhoto 6.
    Anyway , I want to set up total Adobe RGB workflow , so does anybody know how to change sRGB profile to Adobe RGB profile when opening untagged JPEG directly with external editor?

    Thank you for your reply , Lloyd.
    I am sorry , but I noticed my misunderstanding message.
    As you know , you can change raw and other image files to tiff or psd for external editor. You can select that on the preference. At this situation , if you pass nontagged image file to external editor , then automatically sRGB profile is attached.
    I don't think this is related to export preset for JPEG file.

  • HT204204 Having trouble to connect with bluetooth

    Why i having trouble to connect with bluetooth woth other smartphone? I  have already try to connect with bluetooth beetwen my iphone 4 with iphone 6 ? While my iphone 4 have already upgrade to ios 8

    never mind. I fixed it. After uninstalling and then reinstalling iTunes all start to work. Thanks anyways

  • The "From" column in my Yahoo! e-mail account is blank. I trouble-shot it with them to no avail and they determined it was probably an issue with Firefox. Please help!

    The "From" column in my Yahoo! e-mail account is blank. I trouble-shot it with them to no avail and they determined it was probably an issue with Firefox. Please help it has been like this since Monday! Furthermore, it appears fine when I view my Yahoo! e-mail while using the Google Chrome web browser.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"

  • There are text messages that I'm having trouble deleting.  With some of my text messages, I can swipe to the left and delete ... or press and hold, get more and delete to trash can icon. But there are some where neither will work. Can't delete. Help!

    There are text messages that I'm having trouble deleting.  With some of my text messages, I can swipe to the left and delete ... or press and hold, get more and delete to trash can icon. But there are some where neither will work. Can't delete. Help!

    But once again, I do not want to lose my other texts, app progress, and photos. I could sync the photos but i would still lose the app progress and texts. I would only restore if it was the only option left, but the other space, as already stated, isnt the main concern. The main concern is those 'deleted' texts. If they go, then a good size chunk of the other space goes. I know you CAN delete texts for good. It worked fine before. All i want to know is why its not working for me now, and how to fix it.
    I also know that when you delete texts on your iphone, they get marked for deletion, however they stay on your device (thats why they show up when you search for them.) then when you sync your device with itunes, the texts marked for deletion should disappear. When i synced they didnt disappear. Thats what i need an explanation/solution for. Why the texts marked for deletion didnt get fully deleted after the sync.

  • How to save JPEGs with a clean matte?

    From a cut-out image on a transparent background, I use Save for web specifying a black matte to create a JPEG. The resulting image has compression artefacts within the black matte around the image just the same as if the original image had a black background. I can then apply a mask channel copied from the orignal file to the JPEG and fill the matte with black. Delete the mask and Save and I have a JPEG with a matte free of artefacts.
    Is there a simple way to achieve the same thing and what's the point of the matte option?

    I am currently using .png files with transparent backgrounds and dropshadows. These are significantly larger (2x or 3x) than the equivalent .jpg files so the site loading time is also much longer but, of course, .jpgs don't allow transparency. My sites are in Flash which, via ActionScript, allows me to apply drop shadows at runtime to transparent images. It also allows me to create a transparent bitmap image from a .jpg by setting to transparent all pixels that have the matte colour. Unfortunately, as I described above, not all the pixels in the matte area will retain the matte colour because of the way the JPEG compression is done. As a result, the cut out image created by ActionScript will not have clean edges. I can fix this by the second operation on the .jpg I've described but this process is not easily automated in an Action and one site in particular involves a lot of images!

  • Having trouble accessing internet with new wireless WRT54...

    Having trouble accessing internet with new wireless WRT54G. Used easylink to read existing router BEFSR41 which works great to westell modem provided by Verizon. When connect new router Easylink configures WRT54G but when trying to connect to internet...fails. All lites indicate good. Not using wireless device yet, just the wired ethernet. Router set up as DHCP.
    I keep going back to old router and works great every time. Help! 

    Thanks for response, however I tried setting unit to 192.168.2.1 (leaving DHCP) to no avail. I put my old unit (BEFSR41) back in and I'm back up. I need to sit back and decide which way to go on this. Perhaps it's defective and I should return it.

  • I am having trouble syncing photos with lightroom mobile. Lightroom (on computer) tells me that it's syncing but nothing appears on my I pad. Any comments?

    I am having trouble syncing photos with lightroom mobile. Lightroom (on computer) tells me that it's syncing but nothing appears on my I pad. Any comments?

    however when I try to sync my older ipod with it and upload some new music to it, Itunes keeps telling me that all the previous songs will be erased
    Yes, that's correct. If you don't have the songs that are currently on your iPod also in your new iTunes installation, they will be erased from the iPod if you sync it. Best to start afresh by first transferring all the music on your iPod back to your new computer/iTunes library.
    For iTunes version 7 or later, then you can transfer purchased iTunes store music from the iPod to an authorized computer by using the "file/transfer purchases from iPod" menu. Note that the maximum of 5 authorized computers applies here.
    Find out how to do that here.
    How to copy iTunes purchases from an iPod or iPhone to a computer.
    For all other non purchased content (your own CDs etc), check out the instructions/suggestions here.
    Music from iPod to computer (using option 2). This a manual method using "hidden folders" and although it works, it is a little more involved than other methods.
    Much easier ways are to use one of the many 3rd party programs that copy music from the iPod to the computer.
    One of the most recommended is Yamipod. This is a free program that transfers music from iPod back to the computer. However, it does not transfer playcounts/ratings etc.
    Other free programs are Pod Player, SharePod and Floola.
    If you want to recover just the structure of playlists from the iPod (and not the actual song files themselves), there's iRepo for Windows. which I understand has this feature along with all the standard features for these programs.
    iPodRip also has the feature enabling you to reconstruct playlists.
    There is also CopyTrans. This does preserve ratings/playcounts etc if those are important to you but this program is not free. It also supports video transfer.
    Once all the music is safely back in your new iTunes library, you can sync your iPod as normal.

Maybe you are looking for

  • While executing inpectSelection in asp_command.htm, a JavaScript error occurred.

    While executing inpectSelection in asp_command.htm, a JavaScript error occurred. Error pops up In Dreamweaver CS6. I'm in code view when this happens. Seems to happen only when I try to scroll up or down using scroll bar or keyboard arrow keys. Any h

  • Safari 6 lost audio in HTML5 videos

    I used to be able to play HTML5 videos in Safari without a problem--but as of the past week or so, I get no audio. I did a couple of courses through Coursera this summer and the HTML5 videos worked fine. But now that I've started new courses, I have

  • PL/SQL: ORA-00984: column not allowed here (emp.no)

    I want to insert the value of a portlet form field into a table. Any help ? procedure afterValidation p_block_name in varchar2, p_object_name in varchar2, p_instance in integer, p_event_type in varchar2, p_user_args in varchar2, p_session in out noco

  • Sync mail to rfc scenario

    Hi, I've implemented a simple scenario in which incoming mail msg is "pushed" to R/3 by rfc (i.e., mail to rfc). is it possible to config this scenario so returned answer (from rfc call) will be send back to the original mail sender? Regards Uri

  • How to convert URL to its domain name

    Hi, I need to get the client machine name to track who had logged on to the website. I know how to get the url using the request as : request.getRequestUrl(), but is there a way i use this information to get the domain name for the url? Thanks a lot.