Archive for January, 2010
Monthly open source donation: SQLite Manager for Firefox
This month’s donation of $10 goes to a great tool for managing SQLite databases. I was looking for something comparable to phpMyAdmin or MySQL Workbench and found this tool. I thought there would be more tools around, but this was the only one I found. Now I can happily manage databases used in AIR applications.
Flex custom preloader does not center
All our projects use the same preloader. Like many people, we based our preloader on Jesse Warden’s tutorial.
Recently, it started doing funny by not centering. Google-ing around gave some hints, but none of them worked for me. Here is my solution.
Hide the preloader (line 6):
public override function set preloader(p:Sprite):void
{
_preloader = p;
p.addEventListener( ProgressEvent.PROGRESS , onSWFDownloadProgress );
p.addEventListener( FlexEvent.INIT_COMPLETE , onFlexInitComplete);
p.visible = false;
}
Use the ’stage’ property (see blog jaap kooiker). And unhide the preloader if we get a valid value for the stage width:
private function centerPreloader():void
{
if ((stage.stageWidth > 0) && (_preloader)) {
x = (stage.stageWidth / 2) - (clip.width / 2);
y = (stage.stageHeight / 2) - (clip.height / 2);
_preloader.visible = true;
}
}
Center the preloader on each progress event:
private function onSWFDownloadProgress( event:ProgressEvent ):void
{
centerPreloader();
updateProgressBar(event.bytesLoaded/event.bytesTotal);
}
Flex does not render all characters due to embedded characters in preloader
It is probably a problem on my machine (Mac OSX 10.5), but if I use Arial as a font, I get incomplete rendering of strings. Text with fontWeight set to normal renders okay, but it only renders a few characters when fontWeight is set to bold.
global {
fontFamily: Arial;
}
It will only show the characters ‘aegknrsvw’. If I use Verdana, there is no problem.
Update 24 feb 2010:
I found out what caused the problem. In our Flash preloader, we embed some Arial characters:

And these embedded characters were exactly the only characters that were rendered correctly by the application. Once I removed the embedded characters, everything worked fine.