I got it working with the Application.aplication[data.eventlistener]

Just wondering... what if i wanted to run it from a module?!

Thanks



--- In [email protected], "Rafael Faria"
<[EMAIL PROTECTED]> wrote:
>
> Hello again,
> 
>  I'm a old flash user so this migrate phase to flex is giving me a
> headache sometimes. Hopefully i can get some help from here.
> 
> I'm having a hard time with hierarchy.
> 
> I created a package and i built a massive form package that will be
> built dynamically from a XML.
> 
> The problem is that some of them i will let the user to create
> manually functions to their combobox. What i want is inside the
> package add a listener to execute a function that is global declared
> in the root file.
> 
> for instance:
> 
> in the mxml file i would have
> 
> <mx:Script>
>       <![CDATA[
> public function test():void
> {
> trace('test');
> }
> 
>       ]]>
> </mx:Script>
> 
> 
> in the package i would have
> 
> 
> 
> 
> var combo:ComboBox = new ComboBox();
> .
> .
> .
> 
> if (data.eventlistener) 
> // data.eventlistener is a string with the name of the function like
> "test"
> {
>                                                 
> combo.addEventListener(Event.CHANGE,this[data.eventlistener]);
> }
> 
> if you notice that i put "this[data.eventlistener]". It works if the "
> test"  function is inside the package but it doesnt work if its
> declared in the mxml file.
> 
> if i take the "this" off i say that "test" cannot be converted to a
> function.
> 
> i also tried data.eventlistener as Function
> but it doesnt work either.
> 
> Anyone could help me out? On flash use to be so easy... just
> _root[data.eventlistener].
>


Reply via email to