Tuesday, July 24, 2007

My first feel of Adobe Flash CS3

Today i got a chance to get a feel of the latest version of flash - Adobe Flash CS3. It took a lot of time to install the application compared to flash 8. Once done i was really eager to use it.

- The first thing i noticed is the "TOOLBOX" in which all the tools are single lined, which can be toggled to the old way (double lined).

- Then i noticed the way all the panels are arranged. It was amazing. The panels can be grouped with or separated from each other (fig fl9.1)

- The coolest feature i see in this release is that you can skin the components in no time. Just double click on the component, the EDIT mode of that component movieclip will be opened up and you will see all the UI of the component for all the states. So you can directly change the skin from here.

- Then i thought i should do a sample application. So i placed a button component on the stage and added the AS 3.0. I added the following snippet

import flash.events.MouseEvent;
clickme_btn.addEventListener(MouseEvent.CLICK,clickHandler);
function clickHandler(event:MouseEvent):void{trace("You clicked me");}

When i run the application my attention turned to the output panel and compile errors panel, which is being combined with properties,filters,parameters panel.
- Then i thought of checking how the compiler errors are thrown, i made a syntax error at

clickme_btn.adEventListener(MouseEvent.CLICK,clickHandler);

To my surprise the button component which was placed on the stage collapsed (fig fl9.2). This is the first bug i came across in Flash CS3.

- The compiler errors was good to watch. This kind of interface will not be new for flex developers. The error thrown is now more specific. For the above code i got an error

1061: Call to a possibly undefined method adEventListener through a reference with static type fl.controls:Button

And at the bottom of the panel you will see a "Go to source" button which will take you to the line of the code where you made the mistake. This will add more value for the developers while debugging the application.

fig fl9.1 fig fl9.2

This is just my first feel of Flash CS3. The support of AS3.0 will be a gift for flash developers who turned to flex. Is Flash CS3 the straight competitor for Flex 3 :). Now it will be a tough time for Silverlight. Lets wait n watch

Sunday, July 15, 2007

I turned into a component developer

Now i am a component developer :). It took two years for me get into this. I was never intrested in doing this. But today i was forced(requested) to create a component, and it was a good one.
Now i firmly believe that a good Actionscript programmer should be able to develop components. Developing a component actually increases the programming skill. A good component has its own requirements.
1. It should be loosely coupled. The member variables and methods has to be encapsulated. Not all the varialbes can be exposed. The developer has to identify the right set of variables for exposing

2. The component should be re-usable at any point of time.

3. Should use getters and setters option. The member variables in the component should not be direct exposed. It has to be exposed through the get and set keywords
eg:
private var _age:Number
private function set age(val:Number):void
{
_age = val;
}
private function get age(val:Number):void
{
return _age;
}

The above code is self explanatory. Instead of exposing the variable _age directly, we are using setters and getters for variable age which directly affets _age.

4. A good component should allow the user to capture the changes that is happening in it. This can be achieved through Event metatag and dispatchEvent method.
To dispatch an event use dispatchEvent(new Event("click"));
If you are trying to dispatch a custom event you should use metatag
eg:
[Event(name="modified",type="flash.event.Event")]

5. If you are developing a flash component, it should allow the user to customize through component inspector

These are the main services a component should provide.
To get more information about the component development check here