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

1 comment:

ganitraad said...

Grand Casino Hotel, Las Vegas, NV - Mapyro
Grand Casino Hotel, Las Vegas, NV. 91351. Map. 1. Map. 김포 출장샵 0. 8. Map. 3. Map. 0. 7. Map. 김해 출장마사지 6. Map. 2. Map. 3. Map. 3. Map. 3. Map. 순천 출장안마 4. 포천 출장안마 Map. 5. Map. 계룡 출장샵