You would need to make sure any classes that you want to use are compiled into your SWF. If all the classes required are not compiled into the SWF, the following will fail…
var effectClass:Class = getDefinitionByName( org.efflex.mx.viewStackEffects.Fade ) as Class;
var effect:IEffect = IEffect( new effectClass( param0, param1 ) );
Humm.. sorry for the inconvenience, but I don’t understand how I create in runtime.
——————————————
static is working
var effect:org.efflex.mx.viewStackEffects.Fade = new org.efflex.mx.viewStackEffects.Fade();
effect.alphato = 0;
and effect is a type=org.efflex.mx.viewStackEffects.Fade()
—————————————————————–
Dynamic is not working
var eff:String = “org.efflex.mx.viewStackEffects.Fade”;
var effectClass:Class = getDefinitionByName(eff) as Class;
var effect:IEffect = IEffect( new effectClass( param0, param1 ) );
The variable effect is not equal to “org.efflex.mx.viewStackEffects.Fade()”.
I don’t get any error, but I can’t acess the property “alphaTo” (por example) by the class name. Like this:
effect.alphato = 0;
var eff:String = “org.efflex.mx.viewStackEffects.Fade”;
var effectClass:Class = getDefinitionByName(eff) as Class;
var effect:IEffect = IEffect( new effectClass( param0, param1 ) );
i would like to make that effect:org.efflex.mx.viewStackEffects.Fade but the effect is IEffect and I don’t know how IEffect works.
You won’t be able to access specific properties as the instance is typed as IEffect. You could type it as a specific effect, but then it wouldn’t be dynamic.
You should be to set the properties as so
effect[ "alphaTo" ] = 0;
This would throw an error if the class didn’t have the property.
This means that if your switching effects you going to need some kind of switch statement to set the properties (as each effect has diff props), and therefore if you going to have a switch for each diff effect, you might as well just use that switch to create the effect itself instead of using getDefinitionByName.
Hey Tink,
Everyone here loves you blog and we were wondering if you’d like to crosslink with ours: http://labs.byhook.com/
Thanks!
Michael
wei tink,
how are you?
I have some doubts about the efflex and their implementation through actionscript 3.0.
Can you help me, please..?
Thanks a lot for everything.
TinkWorld.addChild(prika)
What can I do for you Prika?
I would like to know how can I make efflex’s transitions dynamically.
I am using a database to store the effects and properties, but I think I can’t use variables in effect’s creation:
For example:
(Static)
var eff1:org.efflex.mx.viewStackEffects.Fade = new org.efflex.mx.viewStackEffects.Fade();
(Dynamic)
var effect:String = “org.efflex.mx.viewStackEffects.Fade”;
var eff1:effect = new effect();
Any ideia?
Thanks
I Prika this is possible
You would need to make sure any classes that you want to use are compiled into your SWF. If all the classes required are not compiled into the SWF, the following will fail…
var effectClass:Class = getDefinitionByName( org.efflex.mx.viewStackEffects.Fade ) as Class;
var effect:IEffect = IEffect( new effectClass( param0, param1 ) );
now you can assign that effect.
Humm.. sorry for the inconvenience, but I don’t understand how I create in runtime.
——————————————
static is working
var effect:org.efflex.mx.viewStackEffects.Fade = new org.efflex.mx.viewStackEffects.Fade();
effect.alphato = 0;
and effect is a type=org.efflex.mx.viewStackEffects.Fade()
—————————————————————–
Dynamic is not working
var eff:String = “org.efflex.mx.viewStackEffects.Fade”;
var effectClass:Class = getDefinitionByName(eff) as Class;
var effect:IEffect = IEffect( new effectClass( param0, param1 ) );
The variable effect is not equal to “org.efflex.mx.viewStackEffects.Fade()”.
How can I create?
Do you get an error?
I don’t get any error, but I can’t acess the property “alphaTo” (por example) by the class name. Like this:
effect.alphato = 0;
var eff:String = “org.efflex.mx.viewStackEffects.Fade”;
var effectClass:Class = getDefinitionByName(eff) as Class;
var effect:IEffect = IEffect( new effectClass( param0, param1 ) );
i would like to make that effect:org.efflex.mx.viewStackEffects.Fade but the effect is IEffect and I don’t know how IEffect works.
You won’t be able to access specific properties as the instance is typed as IEffect. You could type it as a specific effect, but then it wouldn’t be dynamic.
You should be to set the properties as so
effect[ "alphaTo" ] = 0;
This would throw an error if the class didn’t have the property.
This means that if your switching effects you going to need some kind of switch statement to set the properties (as each effect has diff props), and therefore if you going to have a switch for each diff effect, you might as well just use that switch to create the effect itself instead of using getDefinitionByName.
Hi, Tink
Do you have plan to release CubeAway3DTile? I want to use it in my apps but cannot find where it is. Waiting for your response. Thanks.
Do you have plan to release CubeAway3DTile? I want to use it in my apps but cannot find where it is. Waiting for your response. Thanks.
I cannot find anywhere it is . I crazy like it.
Efflex is on a bit of a back burner at the moment due to other projects.