96 methods

Posts by Category: ActionScript

Flex Editor on Ubuntu

I've recently been interested in being able to develop Flex applications in Linux; I'm using Ubuntu. The main obstacle was which text editor to use. I use Aptana Studio to develop Rails applications, such as this very web site, but I'm not sure how to configure Aptana Studio to perform syntax colouring for AS or MXML files.

Well after a bit of Googling this afternoon I've discovered Komodo Edit which comes in flavours for Linux, Windows and Mac. It's also free and supports syntax colouring for ActionScript files and MXML files. Hooray! Was easy to install too.

Posted by Graham Blake on 5th April 2009 at 09:32

Creating a Quick SVN Repository

I've recently started to use TortoiseSVN to handle my configuration control needs on a Flex project that I've started working on at home. The other day I purchased a portable external hard drive, with the intention of using it as a way of sharing my project files between my desktop PC and my laptop. I thought that I could also use the drive to backup my work and that I could locate my SVN repository on there too. I could have simply relocated my existing SVN repository from my local hard drive to the new external drive but I couldn't quickly find out the easiest way to do this. Also, I thought that working out how to create the repository from scratch would be a good reason to write a blog post about how to do so. So here goes.

I carried out the following steps.

1) Created a new folder on my external hard drive, named 'svn_repo'.

2) Right-clicked on this new folder and selected 'Create repository here' from the TortoiseSVN sub-menu

3) Created a new folder structure in a temporary folder on my PC hard drive as follows, where MYPROJECT was the name of my original project's parent folder:

c:\temp\MYPROJECT\branches
c:\temp\MYPROJECT\tags
c:\temp\MYPROJECT\trunk

4) Moved the file contents of my original project folder (MYPROJECT) to the new c:\temp\MYPROJECT\trunk folder (I only files I want checked-in, i.e. all of them in my case, and I didn't copy the MYPROJECT folder itself but the contents).

5) Right-clicked on the new MYPROJECT folder (within c:\temp) and selected 'Import...' from the TortoiseSVN sub-folder. I then typed 'Initial import' into the 'Import mesage' dialogue box.

6) Deleted the c:\temp folder, as it was no longer needed at this point.

7) Created a new MYPROJECT folder where the working copy was to reside, c:\flex\MYPROJECT.

8) Right-clicked on the c:\flex\MYPROJECT folder and selected 'Checkout...' from the TortoiseSVN sub-folder, setting the 'URL of repository' field to 'file:///C:/svn_repo/trunk' and the 'Checkout directory' field to 'C:\flex\MYPROJECT'.

That was it, done. I used version 1.6.1 of TortoiseSVN to achieve this.

Thanks to http://www.shokhirev.com/nikolai/programs/SVN/svn.html

Posted by Graham Blake on 5th April 2009 at 09:32

AS3 Class Constructor Overloading

I discovered yesterday that it’s not possible to implement constructor overloading in ActionScript 3.

Take the following code sample for example. This will give a compilation error because more than one constructor is defined:

public class MyClass {

private var _dataMember:int;
public function MyClass() {
_dataMember = 0;
}
public function MyClass(value:int) {
_dataMember = value;
}
}

To get around this limitation we can define a single constructor but give the parameters of the constructor default values, thus:

public class MyClass {

private var _dataMember:int;

public function MyClass(value:int = 0) {
_dataMember = value;
}
}

Now we can either pass an initial value to the constructor when we declare a new instance of MyClass or pass nothing and have the default value used:

// _dataMember will default to 0:

var example1:MyClass = new MyClass();
// _dataMember will be set to -1:
var example2:MyClass = new MyClass(-1);

More information can be found at:
http://workingwithmrb.blogspot.com/2008/09/darren-on-flex-overloading-constructor.html

Posted by Graham Blake on 5th April 2009 at 09:32

Categories

Feedback

Drop me an email.