Errors #2044/#2036 loading image in Flex with Loader object
I ran into a situation that had me pulling my hair out a little this weekend and the solution ended up being very simple. I thought I would share in case someone runs into the same situation.
I had some simple code to load an image using the Loader object. Here is a simplified version of the code:
<?xml version=”1.0″ encoding=”utf-8″?><mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”init()”><mx:Script><![CDATA[private var imgLoader:Loader;private function init():void{imgLoader = new Loader();imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoaded);imgLoader.load(new URLRequest(encodeURI(“testImages/test1.jpg”)));}private function imageLoaded(e:Event):void{img1.source = e.currentTarget.content;}]]></mx:Script><mx:Image x=”83″ y=”74″ id=”img1″/></mx:Application>
I added the “testimages” directory to the project with the “test1.jpg” file in that folder and tested it. In worked great. So, I built my release version and uploaded it to my server to test. But on executing it I get the following error message:
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
What the heck? Everything works fine running locally, permissions seem to be ok.
for (i=0; i<15 minutes; i++){scratchHead();mumbleUnderBreath();}
I finally figured out my problem. The “testimages” folder needed to be the “testImages” folder (notice the capitalized ‘I’). It was working fine locally because I am on windows where the paths are case-insensitive. But when I uploaded it to my case-sensitive Linux server, the penguin would not excuse my sloppiness.
So, I renamed the folder and everything worked like a dream. Hope this helps someone.