Author Archive

Quick tip: How to restore toolbar and controls in Firefox

I right-mouse-clicked and removed the menu bar and all of the toolbars in Firefox a couple of weeks ago and could not find any obvious way of restoring them.  If you remove all of these toolbars and controls then the menu that appears on right mouse click is no longer accessible!

My quick fix at the time was to install Google Chrome, which I have grown to like but I needed to use HTTP Fox for something today and a quick search revealed the solution to restoring the toobars.  You basically launch Firefox in safemode from the commandline with this command:

"C:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode

A dialog will then appear providing the option to reset toolbars and controls.

Update:

An even quicker tip is to toggle the visibility of the menu bar by pressing the ALT key! (tip from Tony Smith)

Posted by admin on June 25th, 2010 1 Comment

Add haXe to your toolset

haXe is an amazing project.  I've been looking at it recently as an option for producing swfs that potentially perform better than ones produced with similar code written in AS3.  Even more interesting, however, is the ability to target more than one platform with the same code base.  There are several target platforms but the one that captures my attention at this moment is the Javascript target and the fact that existing Haxe libraries such as Physaxe can be used with the HTML5 Canvas element.

The Physaxe library contains a custom type called JsCanvas that acts as a wrapper for the Canvas element and it's 2d drawing context.  JsCanvas shares the same method names as the graphics property belonging to display objects in Actionscript.  Compiler conditionals are then used in another class called FlashDraw to determine whether or not a member variable will be of type flash.display.Graphics or phx.JsCanvas.

It's worth checking out.

Posted by admin on June 3rd, 2010 1 Comment

FDT Flixel Templates

I'm familiarising myself with the features of FDT now that I have a copy and came across some useful templates here.  Decided to try making some myself for some of the Flixel classes;

  • create a subclass of FlxGame with a frame metatag for specifying a preloader
  • create a basic menu state with some basic presets added
  • create a subclass of FlxPreloader
  • create a subclass of FlxState that overrides create and update
  • create a subclass of FlxSprite that overrides update, hurt, kill and reset

Download here

You can add it to FDT by going to:

Preferences/FDT/editor/Templates - Import

Posted by admin on March 17th, 2010 No Comments

PureMVC notes

Here are notes that I wrote down during Javier Julio's PureMVC talk at FITC Amsterdam a couple of weeks ago.  I intend to use pureMVC and they'll be a useful reference when the time arrives.  If I have glaringly misconstrued anything please let me know :-)

The Proxy and Mediator

  • The Proxy typically sends notifications
  • The Mediator receives notifications and can also send notifications
  • The Proxy is located in the Model and is a natural location for domain logic, something that tends to be wrongfully be placed in Commands
  • The Mediator performs the key task of separating the View and Model (which is the responsibility of the Controller in Cairngorm)
  • The Mediator and Proxy have a similar setup
  • Methods to override in the Mediator include;
    • listNotificationInterest(),
    • handleNotification()

About Commands:

  • Since service interaction occurs in the Proxy (located in the Model), commands in the Controller are limited to things like; startup, shutdown.
  • A Command is used when you want to do multiple things in response to a notification.
  • Mediators can directly call methods on the Proxy instead of sending a notification.  You don't have to create a Command for everything.
  • Method to override in Command
    • execute()

The Facade

  • Facade is where you retrieve, register and remove actors.
  • The Proxies, Mediators and Commands all have access to the Facade.
  • Some of the methods to override in Facade:
    • retrieveProxy(proxy)
    • registerMediator(mediator)
    • registerCommand(command)

Update:

Javier got in touch with me and kindly pointed out a couple of things that I had got wrong and also offered some encouragement.  These are a few points he made (I've made the amendments to my notes above):

"The Proxy contains controller-like code but is actually in the Model part of the architecture"

Javier - I'm not sure where you picked up this one but definitely not the case, or at least not for the Proxy. You'll find that the Mediator already acts like a controller and that can trip people up about the framework. The reason for this is that the Mediator already does the key job of separating the View Component from the Model (e.g. a or many Proxy class) thus you don't really have a huge need for commands, in fact very little. This is expected and because the Mediator essentially acts like a controller.

"...Controller are limited to things like; startup, shutdown, database calls."

Javier - I could be misunderstanding database calls here as you could mean that a Proxy that makes a call to the server to fetch data from a database but was triggered by a command. Or say an AIR app that can interact with SQLite. But things like that you want to avoid having in the Command and move into the Proxy. This is one of the big differences between PureMVC and other frameworks because by moving service interaction into the model we can achieve portability and reusability.

"Mediators can directly call methods on the Proxy instead of sending a notification sometimes.  You don't have to create a Command for everything."

Javier - Cliff Hall, the creator of PureMVC, and others, especially myself couldn't be more proud. :) You learned probably one of the most important things to take away from the presentation. A lot of people get this wrong. I use the word "wrong" as Cliff has stated very good reasons why this is not only acceptable in the framework but pushed for you to do. Don't create a command class for an action that only ever happens in one place, you are just doing more work and adding more bloat.

Posted by admin on March 11th, 2010 1 Comment

Referencing an iPhone App’s UIApplicationDelegate from a nested view

It is useful to know that you can reference the top level of your application from anywhere since it is a Singleton.  This enables access to the application delegate as follows:

[[UIApplication sharedApplication] delegate];

This can be useful if you want declare your model at the top level of your app and need to reference it from other places.  In this case you would need to cast the delegate reference:

StemStopwatchAppDelegate* ref =
(StemStopwatchAppDelegate*) [[UIApplication sharedApplication] delegate];

I have also found it necessary to reference UIApplicationDelegate in a view with a UITabBarController when I wanted to use a UIActionSheet (a bit like a popup dialog).  This ensured that the actionsheet had focus and not the tabbar underneath when it was invoked:

[actionSheet showInView:ref.window];

Posted by admin on January 29th, 2010 No Comments