4 Replies Latest reply on Oct 25, 2006 3:53 PM by Newsgroup_User

    How to execute Strings as commands?

    Level 7
      Hi,
      I am triyig to execute the code on a text box...

      i have a text box (text3) with the text: "chr(54)+chr(12)".

      I have a function that is like this:

      function () {
      text1.text = _root[text3.value];
      }

      But it doesnt work.
      It shows undefined on text1 textbox...


      How can i do it??!?!?

      Anyone knows???

      Cheers

      Thanks,









        • 1. Re: How to execute Strings as commands?
          Level 7
          I'm pretty sure there's no value property for text.

          Try: text1.text = _root.text3.text;

          If that's not what you're after, please explain further. You might have a
          look at the eval function.

          --
          Dave -
          Head Developer
          www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          • 2. Re: How to execute Strings as commands?
            Level 7
            Hi,

            I tried your code and that works as i was expecting, but with this other
            code it doesnt...

            comando=eval(_root.text3.text);
            text1.text = _root[comando];

            it says, undefined...
            :(


            Any other ideas???

            Thanks for your interest



            "DMennenoh **AdobeCommunityExpert**" <dave@blurredistinction.com> escribió
            en el mensaje news:eho52p$rap$1@forums.macromedia.com...
            > I'm pretty sure there's no value property for text.
            >
            > Try: text1.text = _root.text3.text;
            >
            > If that's not what you're after, please explain further. You might have a
            > look at the eval function.
            >
            > --
            > Dave -
            > Head Developer
            > www.blurredistinction.com
            > Adobe Community Expert
            > http://www.adobe.com/communities/experts/
            >


            • 3. Re: How to execute Strings as commands?
              NSurveyor Level 2
              I'm not sure if this approach is acceptable... but I am working on a language I call ASML (AS+XML). With the ASMLEval class, you could do something like:

              text1.text = ASMLEval.run(new XML(text3.text).firstChild);

              However, instead of writing "chr(54)+chr(12)", you would write:

              <oper o="+"><call><str>chr</str><arr><num>54</num></arr></call><call><str>chr</str><arr><num>12 </num></arr></call></oper>
              • 4. Re: How to execute Strings as commands?
                Level 7
                The point of doing what i am doing is , I am triying to encrypt strings...


                "NSurveyor" <saif7463@yahoo.com> escribió en el mensaje
                news:ehop0v$m52$1@forums.macromedia.com...
                > I'm not sure if this approach is acceptable... but I am working on a
                > language I
                > call ASML (AS+XML). With the ASMLEval class, you could do something like:
                >
                > text1.text = ASMLEval.run(new XML(text3.text).firstChild);
                >
                > However, instead of writing "chr(54)+chr(12)", you would write:
                >
                > <oper
                > o="+"><call><str>chr</str><arr><num>54</num></arr></call><call><str>chr</str><ar
                > r><num>12</num></arr></call></oper>
                >