{"id":7173,"date":"2014-05-27T03:08:59","date_gmt":"2014-05-27T03:08:59","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/display-image-using-bytearray-failed-unhandled-ioerrorevent-texterror-2124loaded-file-is-an-unknown-type-collection-of-common-programming-errors\/"},"modified":"2014-05-27T03:08:59","modified_gmt":"2014-05-27T03:08:59","slug":"display-image-using-bytearray-failed-unhandled-ioerrorevent-texterror-2124loaded-file-is-an-unknown-type-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/display-image-using-bytearray-failed-unhandled-ioerrorevent-texterror-2124loaded-file-is-an-unknown-type-collection-of-common-programming-errors\/","title":{"rendered":"display image using byteArray failed (Unhandled IOErrorEvent:. text=Error #2124:Loaded file is an unknown type)-Collection of common programming errors"},"content":{"rendered":"<p>Problem:can&#8217;t display jpeg image when using the byteArray as <code>source<\/code>.<\/p>\n<p>suppose there is an existing image named &#8220;card&#8221;.. Here is the scenario:<\/p>\n<p>1.get bitmapData: <code>var bitmapData:BitmapData = Bitmap(card.content).bitmapData<\/code><\/p>\n<p>2.get byteArray: <code>var pixels:ByteArray = bitmapData.getPixels(bitmapData.rect)<\/code><\/p>\n<p>3.attach the byteArray to an new Image: <code>var another:Image = new Image(); another.source = pixels.<\/code><\/p>\n<p>(I also tried to use another way, still can&#8217;t work: <code>var loader:Loader = new Loader(); loader.loader(pixels);<\/code>) <strong>loader.loader(pixels) will throw an error!<\/strong> *<em>The error is &#8220;Unhandled IOErrorEvent:. text=Error #2124&#8221;:Loaded file is an unknown type<\/em>*<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem:can&#8217;t display jpeg image when using the byteArray as source. suppose there is an existing image named &#8220;card&#8221;.. Here is the scenario: 1.get bitmapData: var bitmapData:BitmapData = Bitmap(card.content).bitmapData 2.get byteArray: var pixels:ByteArray = bitmapData.getPixels(bitmapData.rect) 3.attach the byteArray to an new Image: var another:Image = new Image(); another.source = pixels. (I also tried to use another [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7173","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7173"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7173\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}