Hi Frank,

Ah! That's what I needed. I didn't know the existence of getDefinitionByName.

getDefinitionByName("fl.motion.easing." + this._easeClassName)[_easeFuncName]; did the job.

Thanks a lot.

Dimitrios



----- Original Message ----- From: "Frank Pepermans" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Monday, August 27, 2007 12:20 PM
Subject: RE: [Flashcoders] AS3 Dynamic class reference


In order to get a dynamic reference to a class, use this :

getDefinitionByName("fl.motion.easing."+_easeClassName).easeIn;

The compiler will need to include the easing class, so you could include
this :

import fl.motion.easing.SomeClass;

private const _someClass:SomeClass;

... and repeat for each possible easing class


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Dimitrios Bendilas
Sent: 27 August 2007 10:44
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] AS3 Dynamic class reference

Hello,

I need to dynamically get a reference of a Class and I'm not able to do
so.

I think an example will illustrate my point better:

------------------------------------------------------------------------
----------------
package com.zefxis.solarwind2.animations {

import fl.motion.easing.*;

public class EaseFunctions {

private var _easeClassName:String;
private var _easeFuncName:String;

private static var easeDependencies = [Back,
            Bounce,
            Elastic,
            Linear,
            Cubic,
            Quadratic,
            Circular,
            Exponential,
            Sine,
            Quintic,
            Quartic];

public function EaseFunctions() {
}

public function getEasingFunction(functionName:String):Function {
 var tmp:Array = functionName.split(".");
 this._easeClassName = tmp[0];
 this._easeFuncName = tmp[1];

 //trace(this._easeClassName, this._easeFuncName);
 var easeFunc:Function =
fl.motion.easing[this._easeClassName]["easeIn"];
// ************************


 return easeFunc;
}
}

}
------------------------------------------------------------------------
----------------

What I want to do is pass a parameter like "Cubic.easeIn" so that
EaseFunctions parses that into Cubic.easeIn.
The code above produces a compile error: "1120: Access of undefined
property
fl.". Any clues?
(it used to work in AS2)

Thank you,

Dimitrios



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to