On 3/1/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I am able to create an effect to apply to alerts when I define the effect
> in MXML, but it does not work when I try to create it the effect and apply
> it in actionscript.
>
> Can anyone tell me why this does not work?:
> StyleManager.getStyleDeclaration( "Alert" ).setStyle(
> "creationCompleteEffect", alertEffect );
The MXML compiler does a bit more than that. You can look at it
yourself by using the -keep-generated-actionscript compiler switch.
But here's the additional stuff:
import mx.core.mx_internal;
var acs:CSSStyleDeclaration = StyleManager.getStyleDeclaration("Alert");
if (!acs.mx_internal::effects)
acs.mx_internal::effects = [];
acs.mx_internal::effects.push("creationCompleteEffect");
I don't know why there isn't a straighforward way of registering an
effect, but you could use this hack if you really must.
Manish