Flex Effects in Actionscript

13 02 2008

Ok, so there are a few things to keep in mind with applying events in ActionScript.

Firstly, when you want to add an effect to a custom component, you need to attach it to an Event. You’ll need the Event and the Effect metatags.

<mx:Metadata>
    //Handle the step event
[
Event(name=“step”, type=“flash.events.Event”)]
[
Effect(name=“stepEffect”, event=“step”)]
</mx:Metadata>

By dispatching the event, you will call the effect also.

Secondly, and which is somewhat unintuitive, is to set an effect with Actionscript, you set it like a style.

myComponent.setStyle(“addedEffect”,getStyle(“stepEffect”));

So, in the example above, we are inside our custom component, passing-on a custom effect to the built-in effect “addedEffect”.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: