4 Replies Latest reply on Jul 8, 2008 1:19 AM by amitc17

    Problem Dynamically Creating Listener

    Gregory Lafrance Level 6
      I can dynamically create a UI from XML, but I can't get the clickHandler to work.

      Can someone please help me to get this to work? Thanks !!!
        • 1. Problem Dynamically Creating Listener
          VarioPegged Level 2
          Greg, I don't know of a way to interpret a string value and execute it as code in ActionScript. What you could try is to create additional attributes within the XML document that identify the component name, property to be changed, and value. To get this to work, one has to write some seriously brittle code. Is this just an exercise or may I ask what the purpose of it is?

          TS
          • 2. Re: Problem Dynamically Creating Listener
            *gsb* Level 1
            That is cleaner than my example, so I Will not add mine.
            But you might also try the 'apply' method of the Function class as well.
            You can also write a string2function method (I had an AS2 one) or you might try to use a SOAP like convention to encode/decode your string functions.

            The short answer is you need the 'eval' function back. :)

            • 3. Re: Problem Dynamically Creating Listener
              Gregory Lafrance Level 6
              VarioPegged, I was replying to someone elses post and this was the only thing I couldn't get to work. They were creating a UI from an XML file, so I can't claim knowledge of why they were doing this, or if it is desirable, but thanks for your guys posts.
              • 4. Re: Problem Dynamically Creating Listener
                amitc17
                Thanks guys. I am interested in building UI components depending on data in database, probably Greg is referring to my earlier post. The possible business requirement here could be say if I have certain number of dimensions in my data warehouse, I will show values from those dimensions in combo boxes but I also need to know how many combo boxes I need to create. This is a very general requirement for any reporting tool.

                Thanks,
                Amit