Archive

Archive for the ‘Actionscript’ Category

Installing debug FlashPlayer for Firefox on Ubuntu 10.10

July 20th, 2011 No comments

This is more of an aide-mémoire for me than a public guide. If it is helpful for other people then I am happy to make it available. If anyone has any comments or suggestion please contact me.

. . .

  • First install the ‘Adobe Flash Player plug-in’, through the ‘Software Centre’ (alternatively it can be done from the command line if you like)…
  • Download the Debug Flash Player:
$ cd ~/Downloads/
$ wget http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_plugin_debug.tar.gz
  • Extract the files:
$ tar -xzvf flashplayer_10_plugin_debug.tar.gz
  • Copy ‘libflashplayer.so’ to the Flex SDK folder:
$ sudo mv libflashplayer.so /opt/flex/runtimes/libflashplayer.debug.so
  • Update alternatives reference:
$ sudo update-alternatives --install /usr/lib/flashplugin-installer/libflashplayer.so firefox-flashplugin /opt/flex/runtimes/libflashplayer.debug.so 60
  • (optional) Check alternatives reference:
$ update-alternatives --display firefox-flashplugin
firefox-flashplugin - auto mode
  link currently points to /opt/flex/runtimes/libflashplayer.debug.so
/opt/flex/runtimes/libflashplayer.debug.so - priority 60
/usr/lib/flashplugin-installer/libflashplayer.so - priority 50
Current 'best' version is '/opt/flex/runtimes/libflashplayer.debug.so'.
  • Restart Firefox and type ‘about:plugins’ into the address bar to check the plug-in is loaded.
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Parse Boolean value from String…

July 10th, 2009 No comments

One of the small niggles I have with AS3 is the way it parses boolean values from strings. It first tries to convert the string value to a number, then to a boolean (there is a long explanation which I will not go into at this point)… To maintain sanity I have written a very simple function to handle it for me:

static public function parseBoolean(str:String):Boolean
{
    switch(str.toLowerCase())
    {
        // Check for true values
        case "1":
        case "true":
        case "yes":
        return true;

        // Check for false values
        case "0":
        case "false":
        case "no":
        return false;

        // If all else fails cast string
        default:
        return Boolean(str);
    }
}
VN:F [1.9.22_1171]
Rating: 6.5/10 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

String.IsNullOrEmpty

May 15th, 2009 No comments

Having a .NET background I frequently used the String.IsNullOrEmpty() method. However after starting with ActionScript I have noticed that this (and a few other) functionalities are missing. So here is my version:

public static function IsNullOrEmpty(value:String):Boolean
{
    // Check if string is 'empty'
    if (value == "")
    {
        return true;
    }

    // Check if string is 'null'
    if (value == null)
    {
        return true;
    }
 
    // Not 'empty' or 'null', it must be ok!
    return false;
}
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)