Access Variable from a dynamic name

Hello,
I have a the following example variable in a script defined
as such:
mcDrg05OriginalX = mcDrg05._x;
I wish to access this variable data within a button script,
but dynamically by assembling the actual variable name:
newName = holdName[landingCount];
relocateIDx = (newName + "OriginalX");
newName accesses the original name from an array, and
relocateIDx assembles the full variable name to be
mcDrg05OriginalX. Now I wish to access the original numerical value
from that variable name, but how?
I tried:
_root[newName]._x = (relocateIDx);
_root[newName]._x = [relocateIDx];
maybe the answer is out there.
Thanks in advance.

Never Mind. I should of searched before.
If I use:
relocateIDx = eval(newName + "OriginalX");
this now gives the original number
Thanks

Similar Messages

  • Accessing variable from another JSP

    Friends,
    say, I have a Test1.jsp which has a variable "input". Is it possible to access this variable from other jsp "Test2.jsp"?
    any ideas?
    Thanks
    Hari V

    hi hari,
    there are essentially 3 ways of doing it....
    1).Usage of Hidden Values
    2).Using Cookies
    3).Storing attribute value within the scope of request/session/appln
    The choice is all urs....???
    Regards,
    RAHUL

  • Problem accessing variables from java file to JSP page

    Hello Everyone,
    I have small problem accessing my method variables from my java bean file to a JSP page. can some please take a look and tell me why I can't populate my JSP page, I've been trying all day to get this done!!!
    This is my Java file
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public String string_gameID;
    public int string_card1;
    public String readDetail_topLayer;
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
    try { 
                 while((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t", true);
                   while  (tokenizer_topLayer.hasMoreTokens())
                        string_gameID = tokenizer_topLayer.nextToken();
         catch(IOException e)
                    System.out.println(e.getMessage());
         Thanks KT

    ......How are you declaring the class in your JSP? ... are you instantiating it as a bean using the useBean tag, or just instantiating it in your code like normal.
    Maybe you could post the relevant JSP code too?
    Hello again,
    Only the last string is populating after the file has be tokenized. What I'll like to accomplish is passing the very first string in the file. I did not get too far in the JSP file setup because the code is still in it's testing stage, but any help will be highly appreciated.
    Here is the JSP code
    <%@page import="dev.*" %>
    <%@page session="true" language="java" import="java.io.*" %>
    <jsp:useBean id="wagerhist" scope="request" class="dev.RoundDetail2" />
    <html>
    <head>
    <title>Round Detail</title>
    <body>
      <table width="530" bordercolor="#000000" valign="top">
        <tr>
              <td align="left"  width="19%">Game ID<%=wagerhist.string_gameID%></td>
              <td align="left"  width="30%">  </td>
              <td align="left"  width="20%">card1</td>
              <td align="left"  width="31%">  </td>
            </tr>
      </table>
    </body>
    </html>

  • Creating a variable with a dynamic name

    I read a XML which has a unknown number of
    TextFormat-Definitions.
    I used Arrays to hold the data. Every time the TextFormat
    should be used, I overwrite a temporary one with the data i hold in
    the array and then I apply this format to the specific text.
    Now I want to optimise this and create TextFormats at once
    which can be applied when needed, without all the conversion.
    The best way I can think of is by having
    dynamic names for the
    TextFormats for the user to call.
    I can't use the way I did in AS2:
    var ["TF_"+string]:TextFormat = new TextFormat(x,y,z);
    How is the
    right Syntax in ActionScript3.0?

    Yeah, the Application class is no longer dynamic, so you can
    just add members on the fly.
    You could create an "associative array" (object), and store
    the formats in that, keyed by 'string". Associative arrays are like
    hash tables and are efficient at looking up values by key.
    I have heard of but not used Dictionary objects.
    Tracy

  • How to access a variable from a dynamically included JSP page

    I have a jsp (say main.jsp) using the following in its code :
    <jsp:include page="menu.jsp" flush="true" />
    I have a variable in menu.jsp which I would like to use in my main.jsp.
    How do I get the value of the variable defined in menu.jsp ?
    I called this variable in menu.jsp, Public, but this didnot help me use the value of that variable in main.jsp
    Any help is highly appreciated.. thnks a lot

    I do notice the variable var1 has the value populated - in menu.jsp - (from View -->
    Source in the browser) but for some reason not able to use it in main.jspI'm not quite sure of the way your jsps are structured from your code snippet but I think there is something to be aware of here that may be part of your problem, namely the difference between the include directive and the include action.
    You are currently using the include action, this treats the included resource as a dynamic object - i.e. a request is sent to that resource and the resulting response is included in your page. So when you think of what there is no java variable actually included - you'll just get the resulting HTML that is generated by menu.jsp
    The include directive, as in <%@include file=�menu.jsp � %>, on the other hand treats the resource as a static object. This means the actual bytes in the included resource are inserted into the including jsp and then the result of that is compiled and processed, effectively you are cutting and pasting the menu.jsp into your calling jsp. In this case the variable would be available to the calling jsp.
    However this approach does bring other difficulties that may break your current code, you'll just have to try it and see what happens.
    Hope that's relevant to your problem,
    Matt

  • How to change SSIS variables from DM Dynamic Script

    All,
    I'm using BPC 5.1 SP8 on top of SQL 2005. I have some SSIS variables defined in my SSIS transformation that I would like to change using Data Manager Dynamic Script.
    How can this be accomplished?
    Thanks
    Paulo

    The most flexible way I know, is to set up your MODIFYSCRIPT parameter similar to the following. The prompts allow the user to key in anything they want (not necessarily base-member IDs) which you can then pass to the variables in the
    PROMPT(RADIOBUTTON,%MODE%,"Select mode of operation:",,{"Door number one","Door number two"},{"DOOR_ONE","DOOR_TWO"})
    PROMPT(TEXT,%Entity%,"Select an entity",,"")
    PROMPT(TEXT,%Color%,"Select a color",,"")
    GLOBAL(DB_NAME,%APPSET%)
    GLOBAL(DB_SERVER,%SQLSERVER%)
    GLOBAL(COLOR,%Color%)
    GLOBAL(USERID,%TRIMMEDUSER%)
    GLOBAL(TRANSTYPE,%MODE%)
    GLOBAL(COMPANYCODE,%Entity%)
    Then in the DTSX package there are variables for DB_NAME, DB_SERVER, COLOR, etc. Note that these names must be ALLCAPS or things don't work. Pass them on to your connection manager (to ease the transport from one environment to another), or wherever else you need them in the package.
    I believe there's also a way to pass through the filtered, validated list of member IDs, but I don't have an example of that.

  • Passing variables from a dynamically created textinput in AS2?

    Hey everyone,
    I have a contact form in my flash file with name/email/message fields which a user can fill out and then click send, which passes these to a php script which then emails the information that they entered. This works fine when the text inputs are manually placed on the stage and all the information is passed to the php script and emailed to me. I am just updating it so the textinputs are created via AS2 so that I can style them more easily etc. This is fine however when created via script they no longer get passed to my php file. I am creating the textinput using the following code (which works fine):
    var my_fmt:TextFormat = new TextFormat();
    my_fmt.bold = false;
    my_fmt.font = "Arial";
    my_fmt.color = inputcol;
    contact_form.createTextField("contact_name", getNextHighestDepth(),112.6, 27, 174, 20);
    contact_form.contact_name.wordWrap = true;
    contact_form.contact_name.multiline = false;
    contact_form.contact_name.border = true;
    contact_form.contact_name.borderColor = inputcol;
    contact_form.contact_name.type = "input";
    contact_form.contact_name.setNewTextFormat(my_fmt);
    contact_form.contact_name.text = "";
    FYI I am creating this outside the movieclip containing the form (called contact_form) and then adding it into that mc specifically because I thought this may be necessary as doing it within the mc itself (using this.createTextField....) didn't work, however both seem to have the same effect.
    I am then doing various checks on the input box contents (to make sure it's not empty etc), this also works fine and gives me the relevant error if it is empty so it's accessing it correctly. I then use the following code to submit the variables and check_status checks the success/failure of the php script and alerts the user accordingly:
    loadVariables("http://www.makeaportfolio.com/send_email.php?flashmo=" + random(1000), this, "POST");
    message_status.text = "sending....";
    var interval_id = setInterval(check_status, 400);
    This works fine however does not pick up the value of the dynamically created text input (however does pick up all the text inputs that are manually added to the stage). I am rather confused as to why it's not picking this up and am not sure how I set it to do so, i would be immensely grateful if someone could point me in the right direction?
    Thanks so much for your help as ever,
    Dave

    Hi kglad,
    I'm sorry but i still don't understand what you mean? They are all text inputs which are defined in AS2 (you can see the code in my first post), the values (inputtext.text) are surely set by the user when they enter information into the input boxes. Accessing these works fine within my flash file, they just don't get passed to my php file. I got round this by manually creating duplicate textinputs on the stage for each dynamically created textinput which are all hidden, then assigning the values of the dynamically created inputs to the manually created inputs before loading the php file. This works fine as it picks up the manually placed inputs as local. I assume it's something to do with the scope of the dynamically created inputs but I cannot work out how you would ensure they would be picked up as even when you explicitly create them within the relevant mc it doesn't pick them up. As I say i've managed to get it working in a rather convoluted way which is good but would be most interested to understand why the other method doesn't work.
    Thanks so much for your help,
    Dave

  • How to access variables from other class

        public boolean inIn(Person p)
            if  (name == p.name && natInsceNo == p.natInsceNo && dateOfBirth == p.dateOfBirth)
                 return true;
            else
                 return false;
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phello,
    here am trying to compare the existing object with another object.
    could you please tell me how to access the variables of other class because i meet this error?
    name cannot be resolved!
    thank you!

    public class Person
        protected String name; 
        protected char gender;      //protected attributes are visible in the subclass
        protected int dateOfBirth;
        protected String address;
        protected String natInsceNo;
        protected String phoneNo;
        protected static int counter;//class variable
    //Constractor Starts, (returns a new object, may set an object's initial state)
    public Person(String nme,String addr, char sex, int howOld, String ins,String phone)
        dateOfBirth = howOld;
        gender = sex;
        name = nme;
        address = addr;
        natInsceNo = ins;
        phoneNo = phone;
        counter++;
    public class Store
        //Declaration of variables
        private Person[] list;
        private int count;
        private int maxSize;
    //constructor starts
        public Store(int max)
             list = new Person[max];//size array with parameters
             maxSize = max;
             count = 0;
        }//end of store
    //constructor ends
    //accessor starts  
        public boolean inIn(Person p)
           return (name == p.name && address == p.address && natInsceNo == p.natInsceNo);
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phope it helps now!

  • Accessing variables from Child window from the parent window

    Hi All,
    I am in the process of integration of payment gateway, here I am opening payment gateway page as a new window, and after payment is done then I need access one variable which is hidden variable ...any ideas

    Have a hidden field/js variable in the parent page. Add a Javascript function in parent page which would take a value as parameter and set in the parent page hidden field/js variable. In the child window, you can invoke the method from script block as window.opener.setValue(document.getElementById('CHILD_WINDOW_HIDDEN_FIELD_ID').value)
    For Javascript related questions, please visit Javascript forums.

  • Accessing variable from another class

    Say I want to access String ABC from class XYZ from my main class. I have already created the object for the class I just don't know the syntax for accessing the variable.
    This is just an example. I figured this is just a problem of finding the right syntax so I didn't bother creating a compiling code.
    public class test{
    public static void main(String[]args){
         XYZ xyz = new XYZ ();
         String a = abc.XYZ(); // this is where i want to directly access the variable abc. i know this isn't correct and it's what im trying to find out how to do.
    public class XYZ{
         String abc = "hi";
    }Edited by: aznprdgy on Nov 3, 2009 2:13 PM

    No, that isn't possible.
    abc is said to be a local variable. And it's only useable within method().
    It's part of the job of the class Xyz to control the access to its state. As an example:
    public class Test {
        public static void main(String[] args) {
            Xyz xyz = new Xyz()
            String a = xyz.getSpecialValue();
    public class Xyz {
        private String a;
        public String getSpecialValue() {
            return a;
        public void method() {
            a = "hi";
    }Note that a won't be reference to the string "hi" until after method() has been called.

  • Accessing  variables from one layer.

    Hi all,
    I am new to falsh so please help. I have defined some
    variable at one layer say click origin and destination and i want
    to access that varibale on click event of a button.
    how to access that variable on another layer.
    Thanks in advance.

    'layers' are not referred to and cannot be referred to in
    action-script.
    have a look here

  • Best way to access variables from actionCommand

    Say I have a method which reads some data from a file, then stores it in a string. I have a button in this method with an ActionListener defined as follows:
                    btnOk.addActionListener(new ActionListener() {
                       public void actionPerformed(ActionEvent e) {
                           otherMethod();
                    });Now I need to pass the value of my string to this other method. What's the best way of doing this? Currently I have it declared at the top of the class but it seems a bit messy. I know I could declare the string final, but I need to set it conditionally depending on another variable, so I'd need to declare it before I initialize it's value. If it's declared final this won't work. Is the method I'm using now the usual way of doing this?

    Echilon wrote:
    Say I have a method which reads some data from a file, then stores it in a string. I have a button in this method with an ActionListener defined as follows:It's not great practice for a GUI event listener to call something that does file I/O. It'll lead to a sluggish interface, since I/O is slow.
    A better solution is to invoke code that will cause the I/O to happen in a different thread. I think that Swing actually has built-in support for that, but I don't use Swing much so I don't know.
    Now I need to pass the value of my string to this other method. What's the best way of doing this? Currently I have it declared at the top of the class but it seems a bit messy. I know I could declare the string final, but I need to set it conditionally depending on another variable, so I'd need to declare it before I initialize it's value.That doesn't necessarily mean that you can't declare it final. Final just means that once you assign it, you can't change it. You can still set its initial value conditionally.
    I agree that it's messy to use fields for no other purpose than to pass values between methods.

  • Reading a session variable from a dynamic action

    I have a select list on a page and a button next to the select list. The button calls a dynamic action which opens a page and sends the value in the select list. The page is not submitted. The DA has a step with a dummy PL/SQL block that submits the select list item. Then the page is called with the select list in the URL.
    The value is not being sent. If I go into edit mode then run the page again then the correct value is sent.
    When I look at session in Administration the select list is in session and set properly but is not sent unless the page is submitted.
    Why if it is in session is it not being passed correctly? What does submitting the page do other than update session?

    Hi,
    could you share the exception trace ?
    Frank

  • Accessing variables from a symbol?

    Hey there guys, sorry I'm not much of a coder and am a designer but here's my issue.
    I have a character who is a student who is going to enter a chemistry lab, but before he does, the user has a choice to put on a coat and goggles on the character, so when the goggles are chosen the gogglesVar == false, etc and then when you click on the door the character will walk through the door and then get to this code (which is inside a symbol)
    if( sym.getComposition().getStage().gogglesVar == false ){
    sym.play("goggles");
    if( sym.getComposition().getStage().coatVar == false ){
    sym.play("coat");
    }else{
    sym.play("noCoatNoGoggles");
    but no matter what i choose the code always goes to sym.play("noCoatNoGoggles");
    is that because it's in a symbol and doesn't see the gogglesVar == false anymore?
    Hope that makes sense, and thanks in advance.
    Ross.

    Thanks resdesign,
    yes you are correct, they are labels, but within the character's symbol timeline, I guess an image would help show what I want to do, so here it is...
    So the user can click on the coat, goggles or door. And here's what I want: if the user just clicks on the door then the character walks through the door and runs out on fire and his eyes melting (ie label  "noCoatNoGoggles"), if they click on the goggles only, then he walks through and runs out on fire (ie label  "goggles"), and if they click on the coat only, then he walks through and runs out with his eyes melting (ie label  "coat"). If the character clicks on both the coat and goggles, then the character walks through the door and the screen fades and goes to another scene.
    So at the moment I have the goggles and coat change to false when you click on them, and then when the character walks through the door it should then check to see what each variable is set at and then jump to the appropriate frame label and thus the appropriate animation. But unforunately it's not working.
    Unfortunately I dont think the code you gave me will work for what I'm after too because where do I place the false statement for the coat and goggles?
    I hope that explains what I'm trying to do better.

  • How to access variables from other classe through getter ?

    Hi !
    I have 10 classes
    Cau_1.java containing char Cau_1_Answer;
    Cau_2.java... Cau_2_Answer;
    Cau_10.java... Cau_10_Answer;
    and another class Resume_grammar.java with char[] AnswerList = new Char[10] used to hold cau_1_Answer, Cau_2_Answer...Cau_10_Answer.
    but I don't success to get them.
    In Cau_1.java, I do :
    private static char Cau_1_Answer;
    static char getCau_1_Answer() {
              return Cau_1_Answer;
         static void setCau_1_Answer(char cau_1_Answer) {
              Cau_1_Answer = cau_1_Answer;
    if (a.isChecked()) {Cau_1_grammar.setCau_1_Answer('a');}
    if (b.isChecked()) {Cau_1_grammar.setCau_1_Answer('b');}
    if (c.isChecked()) {Cau_1_grammar.setCau_1_Answer('c');}
    if (d.isChecked()) {Cau_1_grammar.setCau_1_Answer('d');}
    Cau_2, Cau_3...are the same way.
    in Resume_grammar.java :
         static char[] AnswerList = new char[10];     
    AnswerList[0] = Cau_1_grammar.getCau_1_Answer();
    AnswerList[9] = Cau_10_grammar.getCau_10_Answer();
    When I make AnswerList display, all is null (nothing displayed).
    Please help ! What I do wrong ?
    Thank you !

    Johnny.vn wrote:
    Cau_1 is Question_1 (Vietnamese).
    I am developing a academic test application with many question and finally display the result of the test.
    Thank you.Back to the original question: why do you need to define different classes for different questions? Do they really behave differently in a way that can't be captured by a single class?

Maybe you are looking for

  • Problem with decimal in Japan currency

    Hi Gurus, I have a problem with Japan currency that when When i take the printout of  document with JPY 5,168,277 it is wrongly printing as 51,682.77 but in document  display it is showing correclty as 5,168,277.  But when i check this in BSEG  table

  • Has this ever been done before?

    Main report with numberous subreports but most of the subreports are using very similar or the same parameter prompts. How to combine all these prompts into just 4 parameters.. of the numerous prompts 4 were identified as the same. any suggestions?

  • Individual invoice payment

    I have a vendor with individual Payment option ticked in vendor master. That pays all open items indivisually. However the problem is that whenever we have a credit memo posted to the same vendor, Automatic Payment Program directly pays the open invo

  • Problem running through IDEs in Linux.

    I have a really weird issue. I'm a beginner and i work with simple .java files. I'm using Linux at the moment and i can compile my source and run file using java 1.5 from the terminal. I have a couple IDEs installed as well that i would like to use.

  • How to add custom information, when Information button "I" is clicked

    Hi All, I have developed a custom collective search help, Now i need to display custom information to the all elementary search help's when  Information Button "i" is clicked. thanks in advance