2 Replies Latest reply on Dec 3, 2009 12:50 PM by Flex harUI

    TypeError: Error #1034 with an Embedded image

    DCAKen Level 1

      I have an embedded image in a popup window that is giving me a problem. When I try to set an image's source to it, I get the error "TypeError: Error #1034: Type Coercion failed: cannot convert gov.noaa.nos.windows::DataPopup_legendMPA@16b5cee1 to flash.display.DisplayObject."


      [Embed(source="gov/noaa/nos/assets/Images/MPA.png", mimeType="application/octet-stream")] [Bindable] public var legendMPA:Class;


      <mx:Image id="MPALegend" source="{legendMPA}" visible="{chkMPA.selected}"/> //this fails

      <mx:Image id="MPALegend" source="gov/noaa/nos/assets/Images/MPA.png" visible="{chkMPA.selected}"/> //this works


      However, I can use that embedded image in another script with no error:


      var legendImage:Class;


      myPDF.addImageStream(new popData.legendMPA as ByteArray, w + 74, legendY); //this is using the AlivePDF swc


      Why does the embedded image throw an error?