9 thoughts on “Advanced ActionScript 3 with Design Patterns Book is Out

  1. mike

    hi there i just bought this book, its really great i just have a few questions.

    working through the command patterns example i found that there was reference to a button extending from BasicButton, and that we have to load in external files, i found this a little frustrating because i dont know what this basic button is, shouldnt all the code needed for a chapter be in the chapter? if not why have external dependancies?

    many thanks for a great tome

  2. Tony

    Hey Danny,

    i finally purchased the book and I read and did most of the examples in the book. My only concern is that when I completed the very exhaustive Chapter 10 Commands game example, I was left with a:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at proximity.data::GameboardData$iinit()
    at proximity.data::GameboardData$/getInstance()
    at Proximity$iinit()

    I found this to be very frustrating for I actually took the time (thinking it would improve my skills so why not) to do the long chapter, just to be shut down at the end. I cant seem to get any help anywhere. This was my last resort, please help if you can!


  3. Joey


    It sounds as though you may have inadvertently omitted a line of code or mistyped something. The error you are getting is exactly what it says it is…you have a null object for which you are trying to access a property. It is one of the most common errors when working with ActionScript, and it is usually among the simplest to correct. I’d recommend you debug your application, and that will likely break on the exact line of code where there error is occurring. Then you should be able to see why the object is null and correct it.


  4. Tony

    Thanks for the response Danny! Yea I’ve done some searches on google and it says the same thing.

    Here is a snippet of my Main class where i feel the error is occurring:

    CommandFactory.type = CommandFactory.NORMAL;
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    var gameboardData:GameboardData = GameboardData.getInstance();
    gameboardData.columns = 20;

    Here is the snippet of the Singleton GetBoardData class:

    public static function getInstance():GameboardData {
    if(GameboardData._instance == null) {
    GameboardData._instance = new GameboardData(new SingletonEnforcer());
    return GameboardData._instance;

    After looking at it for a bit, I believe the issue is when the Main class instantiates the gameboardData class and is passed back a null from the Singleton class. Not sure how to fix this. Its the first time in the book i’ve seen a Singleton referenced that way. Any suggestions? Thanks

  5. Danny

    Actually, that was Joey earlier. Could you please ru nthe app in debug mode and let us know what line the error is happening on? From the snippets you provided I don’t see anything wrong.

    Have you read the singleton chapter yet? This explains the usage of the SingletonEnforcer.

  6. Tony

    Hey pardon me fellas for the wrong name reference. To have any one of you two giants assist me is a true blessing. So, i debugged the application and discovered that in my GameboardData class, _newGamePiece wasn’t being set, so the class was returning null. I looked back in the book to see if i mistakenly omitted that line out but i don’t see _newGamePiece being set in the book either. I see a _newGamePiece getter but not a setter. Not sure how I would fix that. Here are the properties and getter/setter for GameboardData:

    protected var _pieces:Array;
    protected var _rows:uint;
    protected var _columns:uint;
    protected var _newGamePiece:PieceData;

    static private var _instance:GameboardData;

    public function set rows(value:uint):void {
    _rows = value;
    public function set columns(value:uint):void {
    _columns = value;
    public function get newGamePiece():PieceData {
    return _newGamePiece;
    public function GameboardData(enforcer:SingletonEnforcer) {
    _rows = 10;
    _columns = 10;
    _newGamePiece.radius = 40;
    _iterator = GamePlayers.getInstance().iterator();

  7. Tony

    I also noticed that the public function getProximityPieces(piece:PieceData) in GameboardData, isn’t being called from anywhere. Any idea what class should be calling this function? Thanks

  8. Tony

    Did some debugging and fixed my issues. It was all about the debugging! I now feel like the wizard of oz!! I am so happy. This book is God sent. Thanks for the help guys!


  9. Tony

    Hello Danny

    I am using the Template and Factory example from your book and can’t for the life of me get a button object to display. In the Football field class I’ve added a button like so:

    package com.peachpit.aas3wdp.factoryexample {
    import com.peachpit.aas3wdp.controls.BasicButton;
    public class FootballField implements IField {
    public function drawField():void{
    var _login:BasicButton = new BasicButton(“login”);
    trace(“Drawing the Football Field”);

    However, when instantiated from the main class, only “Drawing the Football Field” appears. I’m probably overlooking something, but this piece is critical for getting the State pattern accomplished. Please help. Thanks


Leave a Reply

Your email address will not be published. Required fields are marked *