If you’re wanting to develop a facebook app then there is loads of helpful stuff out there to get you going. Specifically I’d start here if you’re interested http://www.adobe.com/devnet/facebook.html.
But what they don’t tell you is how to debug your app without you having to FTP your files each time you change something. (If your facebook app is based on AIR and not a web app, then this doesn’t matter).
- Firstly log into facebook and go to your app settings, it will probably look like the below. What you are looking for is the ‘website with facebook login’. This is used by facebook when your app logs in ( you’d never have guess that! ). Anyway if this doesn’t match the url of where your app is deployed then you will NOT be able to log in.
Change it to your local URL, in my case I’ve made it http://localhost/facebookLoginTest/index.html
The important bit is the localhost as my actual app isn’t run from index.html but when I set up the app on facebook I just put that in.
Now that your app can login you will now be able to debug, but the default settings in Flashbuilder don’t output your files to your localhost. So this is the second part to getting everything to work.
I’ve highlighted the two bits you need to change which is inside your projects properties (right click and select ‘Flex Build Path’).
Change the output folder to push your output files to the folder inside your webserver. I use XAMPP to setup my webserver etc
Also update the output folder URL, once changed when you hit debug it will load whatever URL is in that box + the html page. So as you can see I’ve changed my output folder URL to http://localhost/facebookLoginTest/ which when I run/debug my app gives me http://localhost/facebookLoginTest/FacebookTestApp.html?debug=true
Ever had a project where your client has some kind of odd/unusual caching issue with their servers that you have absoulutly zero control over?
Well if you have (which I have had) then the following swc file may help you to diagnose the problem. Its a very simple swc file that you can place inside your code and pass it a version number. Next time you build your app and deploy it to your clients servers you can type ‘version’ then whatever number you gave inside your code will appear inside an Alert box.
This has helped me sooooo many times, as after deploying some code, if they (client) appear to be seeing something different to what I’m seeing then I can get them to type ‘version’ and if it’s the old version number I have to tell them to clear their cache & wait for their internal servers to refresh (again I/they have no control over this), then a few hours later they will have the correct version.
So it just helps when you roll out a minor update and you say its fixed, then they come back and say that they can’t see the changes, you can then show that its the internal hardware and that they just have to wait to get the new swf.
As a little extra feature on the version SWC I’ve given it the ability to listen to your own functions should you wish. It works by listening to the keypress event on the stage (so their is nothing visual to worry about). By default the version number is shown by typing ‘version’ when the app has focus. If you wished it to do something else on a certain word or set of key presses (a-z, 0-9) then you would do the following:
//There is a addKeyListenerFunction and a removeKeyListenerFunction
//remove listener by passing in the word that you where listening for
Click here for runnable demo, right click for source code. (just make sure app has focus for it to work)
If you’re interested in file size, using the above example with and without the version SWC changed the file size by just under 3K (3057 bytes).
The version SWC is case insensitive, so if you ask it to listen to HELLOWORLD, this is the same as helloworld.
Get the SWC file here.