Archive for the ‘Flex’ Category

Embedding a Flex Facebook application in an IFrame

I started, like a lot of people following the excellent tutorial:
Create your first Facebook application with Flex
Sure enough, you are able to create an application in Flex that opens a popup window to login to Facebook and add your new Facebook application. You can then access your photos, friends, profile info, etc. and do what you will.

The obvious next step is to embed the application right in Facebook, like most Facebook apps. So, on to the next tutorial:
Deploy your first Flex application on Facebook

The only problem, is that it doesn’t work. The application will be embedded in Facebook, but will still open up that annoying popup window to add the application to the user profile.

The reason being is that if the logged in user has not already added the application, then the variables passed to the SWF by Facebook does not include the session key, and other information needed to create a WebSession directly. From looking through the FacebookSessionUtil code, I believe that the popup window is the result on this code trying to open a JSSession instead of a WebSession.

The solution that I have found is to handle the application approval through the Facebook PHP Client Library.
What you need to do is: Read the rest of this entry »

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.
Get Adobe Flash player