Archive for December, 2009
Using a Custom Cursor in Flex with CSS
Dec 16th
If you want to use a custom busyCursor animation in your Flex applications, you don’t need to do anything fancy… All you have to do is define one, solitary property in your CSS file:
CursorManager { /* You can use PNGs, SWFs or JPEGs */ busyCursor: Embed(source="path/to/your/resource"); }
To invoke the busy cursor, use the following line:
CursorManager.setBusyCursor();
…or you could set the showBusyCursor to true in your HTTPService or RemoteObject instances.
Converting GIF to SWF using Flash CS4
Dec 16th
A typical ballache… You want to use one of the cool loaders from http://ajaxload.info/ in your Flash/Flex apps, but it only generates a GIF file… So you’ll scour the net for a GIF2SWF application and you’ll undoubtedly come across a few, but you don’t have to look any further than Flash CS4 – surprisingly!
All you have to do is open a GIF file in Flash CS4 and it’ll automatically pull it apart and convert it to frames, which can then be converted to a SWF file
Hope it helps you at some point!
AMFPHP Genie v0.2
Dec 13th
AMFPHP Genie (0.2) is a simple tool to help you get shit done using Flex and AMFPHP.
Check out http://dannykopping.co.za/amfphp-genie/ for more information!
How's This For a Christmas Reading List?
Dec 13th
I decided to splurge a bit of loot on some new books (which i hope i’ll have time to ever read) with the money from a few invoices clearing over the past couple of weeks.
Here’s what I ordered… There are some great books here which i hope you’ll consider looking at:
- Breaking the Spell: Religion as a Natural Phenomenon by Daniel C Dennett
- The Age of Spiritual Machines by Ray Kurzweil
- Consciousness Explained by Daniel C Dennett
- Why People Believe Weird Things by Michael Shermer
- God is not Great – How Religion Poisons Everything by Christopher Hitchens
- Letter to a Christian Nation by Sam Harris
- Phantoms in the Brain – Probing the Mysteries of the Human Mind by V.S. Ramachandran
QuickTip: asSQL Connection Problem with non-localhost hostname
Dec 12th
asSQL is just great. It’s an ActionScript 3.0 library for connecting AIR applications to MySQL databases and it works brilliantly – when it works! Recently i gave it a shot again after an utter failure the last time i tried it… The library seems to be a port of the Java implementation of connecting to MySQL (Connections, Statements, Fields, etc). It takes a little getting used to but it’s an excellent library and i highly recommend it.
Background
My development environment is Windows-based (against my wishes… not enough loot or motivation for a Mac, lack of Adobe software on Linux) but i make up for this by running a virtual Linux installation in my Windows environment and networking the two together. It actually works really well, and the process for setting this up can be found here. To cut a very long and boring story short, essentially i cannot use localhost as your server when using this architecture since i have my LAMPP stack running on my Linux environment, so my “local server” can only be accessed using the IP address of the virtual system.
This complicates things a bit when trying to use asSQL to connect to my MySQL installation, because MySQL gets all paranoid and won’t accept connections from a foreign IP address (the IP of my Windows machine on which my AIR app is running)… To get around this, all you have to do is create a new user in MySQL (i used phpMyAdmin), set the user’s hostname to the IP address of your remote system (i’ve explained how to do this below) and you’re ready to rock and roll!
Solution
The first thing you need to do is get the IP address of the remote system…
Windows: Open the command line, type ipconfig
Linux & Mac: Open the terminal, type ifconfig
In this example, my IP address is 192.168.56.1
I’ll be using phpMyAdmin to fix the problem.
- Open phpMyAdmin and click on the Privileges tab.
- Click Add a new User
- Enter any username you like, paste the IP address obtained in the Host field and put in a password
- Under the Database for user panel, leave it at None
- Under the Global privileges, you can Check All
That should sort it out… Remember, this is HIGHLY insecure and should only be used on development environments and NOT production environments.