开发者

Flash / ActionScript : Component's properties inheritance

I'm having headaches thanks 开发者_如何学Pythonto Flash CS4 and ActionScript 2. I'd like to create some kind of component's properties inheritance to create generic behaviors in my component. Imagine I work a lot with textfield based components (counters, animated text... and so on), I'd like my artist to custom these components without being scared by the "update" button. Today, when component's code is updated, my artist has to update every flas using these components, and all of them are re-set to original look (if he had customed font color, or font size by duplicating the component instance, everything is set back to the current look of component).

That's why I'd like to know if there is a way for a component to inherit some of its properties and behaviors from another component class ?

Ideas ?

Thank you.


The solution seems obvious...

Here is the class defining the generic behavior adding access to _value (kikooPropertie) propertie

[InspectableList("_value")]
class GenericBehavior 
{
[Inspectable(name="kikooPropertie", type="Number" )]
public var _value:Number;

public function GenericBehavior()
{
}
}

And here is the way to add this behavior via inheritance to a component.

[InspectableList("_value", "_blah")] //don't forget to ask access to _value propertie
                            //in order to use its behavior defined in GenericBehavior   
class MyComponent extends GenericBehavior  
{
[Inspectable(name="blahPropertie", type="String" )]
public var _blah:String;

public function GenericBehavior()
{
}
}

Anyway, sorry for my question but I hope it could help someone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜