Marcos Placona Blog

Programming, technology and the taming of the web.

Category: Adobe (page 1 of 8)

All my rumblings and discoveries about Adobe

Background colour in a label control in AS3

Reading time: 1 – 2 minutes

This is just a quick example of how to add a background colour to a label control in AS3.

Most people don’t know, but the label component has a TextField inside of it. What that means is that you can basically use all of the available methods within the TextField in a label. Here’s an example of how to add a background colour to a label.

import fl.controls.Label;
// If you were doing Playbook development
// import qnx.ui.text.Label;
var lblName:Label = new Label();
lblName.textField.background = true;
lblName.textField.backgroundColor = 0xFFFFFF;

And that’s it. You now have a label with a white background. Seems pretty simple, but what is cool here, is the fact that your label can have pretty much the same behaviour as a text field, and you can modify it as you would in a text field.

SQLite databases and mobile applications – A caveat

Reading time: 2 – 4 minutes

As some of you might have noticed, I have been building some mobile applications lately on my spare time specifically for the Blackberry Playbook. They are mainly built in Adobe Air using Actionscript 3 and Blackberry’s Tablet SDK.

On my latest application, I have found the need for a database, as it needs to store lots of user input data. The first option that comes to mind is SQLite, as it’s very simple to integrate, and has native support.

I will show here an integration example, and focus on a caveat I found while trying to use it on a real device.

For starters, here are the classes you need to import on your main class:

import flash.filesystem.File;

I then create a method to initialize my database connection:

private var dbConnection:SQLConnection = new SQLConnection;
private function initDB():void{
	var embededSessionDB:File = File.applicationDirectory.resolvePath("assets/db.sqlite");
	var writeSessionDB:File = File.applicationStorageDirectory.resolvePath("assets/db.sqlite");
	// If a writable DB doesn't exist, we then copy it into the app folder so it's writteable
	if (!writeSessionDB.exists) {
	var dbFile:File = writeSessionDB;;

What is important to mention here, is that most people (myself being one of them) will be completely tempted to skip the bit where it copies the local file (coming from the application itself) into the local storage. Funnily enough, if you skip this step, when you test it locally, it will all work wonderfully, but when you deploy it into a real device (or even a simulator) nothing happens at all.

After some research, I found out that you need to be using the database from the local storage, and just like this is that you will have read and write permissions.

After getting that small “detour” out of the way, I can go on and write my first query against that database.

private function getWords(intTabID:int):Array{
	var stmt:SQLStatement = new SQLStatement();
	stmt.sqlConnection = dbConnection;
	stmt.text = "SELECT key, word FROM WORDS WHERE category_id = (:wordID)";
	stmt.parameters[':wordID'] = intTabID;
	var result:Array = stmt.getResult().data;
	return result;

And this will return a nice array with all my data from the SQLite database.

Quick tip on Flash Builder and application internationalization

Reading time: 1 – 2 minutes

I’m building a new Blackberry Playbook app, and when starting to work with internationalization, I got stuck with a bug that wouldn’t go away. I’m pretty sure this won’t just affect just this kind of application, but anything that is built using Flash Builder and requires resource bundle files.

It’s a pretty common standard to name resource bundle files as *.properties, but it turns out Flash Builder ignores *.properties files when packaging, and you end up with an error like:

It actually took me quite a long time to figure that one out, since I was pretty sure the files were in the correct location. Changing the file extension to .prop did the trick, and now Flash Builder will package them successfully.

I believe there must be another way in Flash builder settings to make it not ignore *.properties files, but for the time being, simply renaming its extension will do.

Hope that helps someone in the future searching for this error.

Adobe Flash Player 10.2 beta

Reading time: < 1 minute

Ok, I know I’m late on this, but I just thought I’d register here that Adobe Flash Player 10.2 has just been released on the Adobe Labs this week.

A few of it’s key features are:

  • Stage Video hardware acceleration
  • Internet Explorer 9 hardware accelerated rendering support
  • Native custom mouse cursors
  • Support for full screen mode with multiple monitors

Continue reading

Object-Oriented Programming in ColdFusion

Reading time: 1 – 2 minutes

I know it must be pretty old news by now that Matt Gifford has written a book called Object-Oriented Programming in ColdFusion.

I’ve been approached by the folks at Packt last week and asked to read it and write a review about the book.

I’m still waiting for it to be delivered, but will be writing the review as soon as I’m done with the book. In the meantime, you can have a sneak peek of the sample chapter or buy the book directly.

Older posts