Archived entries for

Extending
EventDispatcher in
Flex Builder 3

Ok, so was working on an AS project in Flex Builder 3, and wanted to write a class that extended EventDispatcher. My class was going to receive an XML and dispatch an event when it had transformed the XML into an array of value objects. Since this class wasn’t going to be on the display list, i thought that extending the EventDispatcher class was a good idea.

I created a new actionScript class in Flex Builder and told it to extend the EventDispatcher. When I looked at the auto generated code in the file there, I scratched my head. This is what it looked like:


   package com.example {

      import flash.events.EventDispatcher;
      import flash.events.IEventDispatcher;

      public class Example extends EventDispatcher {

         public function Example(target:IEventDispatcher=null) {
            super(target);
         }

      }
   }

I was wondering what the target in the constructor was. After some quick research i learned that you only use the EventDispatcher constructor when you have to implement the IEventDispatcher, because you are already extending another class. Therefore i changed my class to look like this instead:


   package com.example {

      import flash.events.EventDispatcher;

      public class Example extends EventDispatcher {

         public function Example() {

         }

      }
   }

This wouldn’t have been an issue if i had just written it in TextMate, but because i used Flex Builders auto generating code, i had to investigate what was happening.

Popularity: 4% [?]

My first post!

Well, here we are, my first post. I have been thinking about setting up my own web/blog page for a long time now, and I’m very happy to have finally done so. There is an expression saying “a good designer never has time to make his own presentation”, but alas, i managed to have the time. =)

The point of this site is going to be a presentation of my work, tutorials, learning experiences  and presenting things that intrigue me in the fields of design, actionscripting  an so on. But first i will have to set up the rest of the page. Firstly I’ll be writing more about myself in the “About” page, then ill start populating my portfolio page. So… “High ho Silver…. away!!”

Popularity: 4% [?]