I actually just figured out a possible solution. Jsut thoguht I'd share it
. By having the component just dispatch events with the entered names then
I don't have to worry about all the converting to functions etc
just use:
private function checkForEvents(){
trace("checking");
var itr:Iterator=videoEvents.getIterator();
while(itr.hasNext()){
var videoEvent=itr.next();
var method=videoEvent.methodToCall;
dispatchEvent({type:method});
trace(videoEvent.methodToCall);
}
}
and then :
import mx.data.binding.ObjectDumper;
trace(ObjectDumper.toString(red.videoEvents));
red.addEventListener("testing2", testListener);
function testListener(){
trace("testlistcaught");
}
red.addEventListener("testing",test1Listener);
function test1Listener(){
trace("testing one is caught");
}
On 3/31/06, Manuel Saint-Victor <[EMAIL PROTECTED]> wrote:
>
> I have a component that has a collection property that holds some events.
> My goal is for the user to be able to fill out the panel with two params
> for each event: eventTime and method to call.
> I've gotten to that part but what I'm trying to do now is convert these
> user entered stings into functions to be called by my component.
>
> for example - the user could add a value of 1000:squeak into the
> params dialog and at 1000 I would call the squeak method.
>
> Here's what I have tried so far- to no avail.
>
> private function checkForEvents(){
> trace("checking");
> var itr:Iterator=videoEvents.getIterator();
> while(itr.hasNext()){
> var videoEvent=itr.next();
> var method:Function=Function(videoEvent.methodTocall );
> method.call();
> trace(videoEvent.methodToCall);
> }
>
> }
>
> If anybody could help me with this it would be greatly appreciated.
>
> Mani
>
>
_______________________________________________
[email protected]
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