1 Reply Latest reply on Sep 29, 2008 4:57 PM by ntsiii

    Evaulating Variables

    D-D-Diderot
      I have a very simple, 4 State, page. Each State is called Pie, Bar, Line, and Grid. Each has ONE child with a canvas tag having the same ID as the state. Exampe Attached.
      All I want to be able to do it print the appropriate state by evaulating the 'currentState' to know which chart (canvas id) to print as in: printChart.addObject(currentState);
      In coldfusion I would have used Evaulate("currentState"). It's obviously not cold fusion but it's what I know. I am sure there should be an easy way to accomplish the same.
      thanks for much for any input.
      Best,
      Kevin C.
        • 1. Re: Evaulating Variables
          ntsiii Level 3
          I don't like states and don't do much printing, but it sounds like you need bracket notation.

          To get a reference to any runtime component with an id, you do:
          parent["myIdValue"]

          So if you nave a canvas in the main app with an id="Bar" you can do:
          var sId:String = "Bar";
          var myCanvas:Canvas = this[sId]; //"Bar is a child/prpperty of the main app, 'this'
          Alert.show(myCanvas.whatever.)

          Tracy