Use a variable name within a function?

here's my function....
myInterval = setInterval (TTMO,15);
function TTMO () {
InstanceNameOfMovieClip._x -= (InstanceNameOfMovieClip._x -
_xmouse)/10;
InstanceNameOfMovieClip._y -= (InstanceNameOfMovieClip._y -
_ymouse)/10-2;
instead of using the "InstanceNameOfMovieClip" can i use a
variable name? i've tried, but it doesn't work. i also tried using
the correct hierarchy too, such as this._parent.VariableName
too.

you need to concat the linkage to the movieclip using your
string variable like this
var mcName_str = "bigBox_mc";
this[mcName_str]._x = 20;
you can use this method for looping through incrementally
named objects
for(var i:Number=0;i<10;i++)
this["mc"+i]._x = 20;
hope that helped

Similar Messages

  • Error while using the variable name "VARIABLE" in variable substitution

    Hi Experts,
      I am using variable substitution to have my output filename set as a payload field value. It is working fine when I am using the variable name as fname, subs etc but channel goes in error when I am using the variable name as "VARIABLE". This is probably a reserved word but i would like to know where i can find a detailed documentation on this. Say things to note / restrictions while using variable substitution.
    This is the error in the channel:
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table
    Thanks,
    Diya

    Hi Zevik,
    Thanks for the reply. The output file is created correctly by merely changing the variable name to something else and hence the doubt.
    Below is the configuration:
    Variable Substituition
    VARIABLE    payload:interface_dummy,1,Recordset,1,Header,1,field1,1
    Filename schema : TEST_%VARIABLE%.txt
    Output xml structure:
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:interface_dummy xmlns:ns="http://training.eu.unilever.com">
    - <ns:Recordset xmlns:ns="http://training.eu.unilever.com">
    - <Header>
      <identifier>HDR</identifier>
      <field1>001</field1>
      <field2>001</field2>
      <field3>R</field3>
      </Header>
    - <Detail>
      <identifier>A</identifier>
      <field1>000000002</field1>
      <field2 />
      <field3>Doretha.Walker</field3>
      </Detail>
    I thimk my configuration is correct as it is working correctly with the variable name change, However, maybe i missed something !

  • Using a Variable to select a function

    Hi there.
    I am looking to use a variable that is set when a user clicks
    a button to then use as the variable name to call a function. The
    actual functions work, but when using a variable as the function
    name it doesn't call the function. Here's my code so far, could
    anyone help with what I may be doing wrong (please see code snippet
    attached).
    Thanks a lot
    Tony Mead

    Thanks for the reply Dave. I wanted to use a variable because
    when any of the 4 buttons are clicked they have to
    1. Run the function determined by the closeActive variable
    (closing the open panel - could be 1 of 4)
    2. open and run a particular panel
    Probably best explaind by looking at what I have done so far
    (home & about us only at the moment):
    http://www.soapbox-creative.com/development/08/index.html
    Basically I needed the flash movie to 'know' what panel is
    currently opn and when another button is clicked it can just run
    the close function and close the panel that is open.
    Thanks again
    Tony

  • Using a variable in a js function argument

    Folks,
    This is very basic, but I still cannot get it...
    I have this js function in an ASP page:function MM_changeProp(objId,x,theProp,theValue) { //v9.0
      var obj = null; with (document){ if (getElementById)
      obj = getElementById(objId); }
      if (obj){
        if (theValue == true || theValue == false)
          eval("obj.style."+theProp+"="+theValue);
        else eval("obj.style."+theProp+"='"+theValue+"'");
    }i don't understand the function, as it was put in automatically by dreamweaver. right now, i am using this onclick event of an image:<div id="apDiv19" onclick="MM_changeProp('apDiv7','','backgroundColor','#FFFF00','DIV')"></div>the #FFFF00 is the color YELLOW. it is being passed to the theValue argument of the js. what i simply want to do is establish a global variable that will house a color string (like #FFFF00), and then use it in the function argument everytime i need the function. something like this:<div id="apDiv19" onclick="MM_changeProp('apDiv7','','backgroundColor',VARIABLE,'DIV')">i do not know how to do two things:
    1) initialize and assign the variable a value, and where to establish it (inside the script tags? in the head? in the body?)
    2) how to use the variable as an argument in the function
    any help greatly appreciated for this novice. thanks!

    ajetrumpet wrote:
    Folks,
    This is very basic, but I still cannot get it...
    I have this js function in an ASP page:This forum is not about ASP nor JavaScript. Please use Google to find an appropriate JavaScript forum.

  • Help, can I declare an object using a variable name

    I need to make a bunch of objects using a for loop, so I was wanting to name the object one of the variables that I read. But I basically want to know if I can do this.
         private Software makeObject(String proName, int proStock, double proPrice,String objName){
              Software objName = new Software(proName,proStock,proPrice);
              return objName;
    I want to create a Software object using the objName inputted to it. The software object holds three fields as you can see. The name, num in stock, and price. However it won't let me do this, because it says objName is a duplicate variable. Help would be appreciated

    private Software makeObject(String proName, int proStock, double proPrice,String objName){
    Software objName = new Software(proName,proStock,proPrice);
    ... it won't let me do this, because it
    says objName is a duplicate variable. Help would be
    appreciatedWell, it is duplicate. Change the name of one or the other of those variable names.

  • Use of & in search within a function

    I need to write a function that strips out
    information from a text string.
    The end of the text I am interested in is marked with &.
    As with other cases it keeps prompting for a value, which is not acceptable as this will be run from an application.
    I have tried set define off within the function, but this causes a compilation error.

    The '&' is only an issue within sql*plus. If you are not directly entering your code in sql*plus as against storing it in a file and then compiling the function '&' should not be an issue at all.
    HTH

  • Update a table using same variable name as the column

    I am not able to update a table column using a local variable which is having same name as the table column. Example of the function is as follows:
    create or replace function trial return integer as
    column1 integer:=99;
    BEGIN
    update firsttable set column1=column1 where column2='john';
    return 0;
    END;
    Existing data in firsttable:
    COLUMN1 COLUMN2
    123 xyz
    123 abcd
    101 john

    Unfortunately table aliasing won't help... Although specifying the procedure will. Somewhat academic I know, since if you can prefix the procedure name on the variable you can just as easily rename it, unless you happen to have a bunch of other code calling it using named notation possibly.
    SQL> select ename, comm from emp where empno = 7934;
    ENAME            COMM
    MILLER
    SQL> create or replace procedure new_comm
      2   (empno in number, comm in number)
      3  is
      4  begin
      5      update emp e
      6      set e.comm = new_comm.comm
      7      where e.empno = new_comm.empno;
      8      dbms_output.put_line('updated '||sql%rowcount||' rows!');
      9  end;
    10  /
    Procedure created.
    SQL> exec new_comm (7934, 100)
    updated 1 rows!
    PL/SQL procedure successfully completed.
    SQL> select ename, comm from emp where empno = 7934;
    ENAME            COMM
    MILLER            100Message was edited by:
    3360
    Colin beat me to it

  • Simple Question -- How to use global variables in an another function??!

    Function named globalLeftMargin that has:
    Global NumberVar LeftMargin := 5;
    HOW DO I USE THIS IN ANOTHER FUNCTION?  B/C IT DOES NOT RECOGNIZE IT AND GIVES THIS ERROR:
    The ) is missing.
    The other function is:
    Space(LeftMargin)

    Hi Ajay,
    Add WhilePrintingRecords at the beginning of each formula like:
    WhilePrintingRecords;
    Global NumberVar LeftMargin := 5;
    WhilePrintingRecords;
    Global NumberVar LeftMargin;
    Space(LeftMargin)
    Good luck,
    Brian

  • Using Dynamic Variable Names

    I am hoping someone can help me out with this.
    I am creating my own record that has the format (id_1, title_1, id_2, title_2...id_50, title_50). I was wondering if there was a way that I could iteratively assign values to each attribute in this record without having to explicitly type out each assignment (partially because the number of columns will vary).
    Any help is greatly appreciated!
    Thx

    I did not think that there was a way to access the attributes within a record/object by using an offset or an index (i.e. set the 4th attribute of the record to 'XXX').
    Here might be a better example for my problem. Let's say the "object" is a car. The car can have 1 to N options associated with it (we'll use 3 for this example). Each option has an ID associated with it as well as text that describes that option. Each car should only have one record that describes all of it's options collectively.
    car_id Opt1_id Opt1_Text Opt2_id Opt2_Text Opt3_id Opt3_text
    'car1' 25 'CD Player' 41 'A/C' 11 '4X4'
    'car2' 25 'CD Player' 40 NULL 10 '2X4'
    So how can I build these records without having to directly assign each value as show below?
    car(1).car_id := 'car1';
    car(1).Opt1_id := 25;
    car(1).Opt1_Text := 'CD Player';
    car(1).Opt2_id = 41;
    car(1).Opt2_Text := 'A/C';
    car(1).Opt3_id := 11;
    car(1).Opt3_Text := '4X4';
    Desired solution:
    car(1).car_id := 'car1';
    For i IN 1..3
    LOOP
    car(1).Opt||i||_id := <some id>;
    car(1).Opt||i||_Text := <some text>;
    END LOOP;

  • Using multiple variable names in a for statement?

    I have searched, and I just can't seem to find how to do something, I do not have the code atm, but easy enough to explain...
    I have a GUI that has 3 rows of 3 fields...
    emp1Name, emp1Phone, emp1Fax
    emp2Name, emp2Phone, emp2Fax
    emp3Name, emp3Phone, emp3Fax
    I also have a tabbed file that has the input for each of these fields, it looks something like...
    Mike 602-111-1111 602-111-1112
    Dave 602-222-2222 602-222-2223
    Bethany 602-333-3333 602-333-3334
    Here is my method...
        private void getFile() {
            myFile = new File("C:/javainput.txt");
            msgField.setText("Welcome!");
            try {
                BufferedReader br = new BufferedReader(new FileReader(myFile));
                String s;
                while ((s=br.readLine())!=null){
                    String f[] = s.split("\t");
                    emp1Name.setText(f[0]);
                    emp1Phone.setText(f[1]);
                    emp1Fax.setText(f[2]);
                br.close();
            } catch (IOException e) {
                msgField.setText("INPUT FILE NOT FOUND!");
        }My question is, how do I cycle through emp1, emp2 and emp3 in a for statement. I tried empName, but that obviously isn't correct.
    Help, or point me to where I can read on this?
    Thank you!
    Edited by: 805764 on Oct 27, 2010 12:10 PM

    Do one thing at a time. First, define your Employee class. Compile it, debug it. Test it. Make sure that you can create Employees, set their names, phone numbers, etc., and get them back.
    Once that works, familiarize yourself with arrays, if necessary, completely separately from your Employee class.
    Once you're comfortable with arrays and with defining a new class (i.e., Employee), write a tiny test program that just, say, creates an array of a certain size and populates it with Employees, and then iterates over it printing out each Employee's information to the console.
    Once that works, set it aside. Now work on a GUI. Start by just displaying one or two hardcoded names and phone numbers. Once that works, add a bit more to it--say by getting that hardcoded information from inside Employee objects.
    And so on.
    Right now you're biting off too much at once. Keep working on one very small new step at a time, only move on to the next step once the previous one is solid, and do the steps independently of each other first, and then combine their respective results. It may sound like a lot of work, but I promise you, in the end, it's faster, easier, and far less frustrating to do it this way.
    At any given step, if you get stuck, post a question here, providing an [url http://sscce.org]SSCCE that shows what you're trying to do, and clearly explain exactly what problems you're having.

  • Using Gmail Domain Name Within Apple Mail??

    I REALLY need your help. What am I doing wrong?
    I want to be able to send mail "From" [email protected] vs [email protected]
    I've redirected my [email protected] to my gmail account.
    The problem is when I set up Apple Mail with my Gmail information, I can't send "From" [email protected]
    I have already changed my "settings" in google & added an account making [email protected] the default. Also the always reply from default address is checked on.
    What am I doing wrong or is this even possible?
    Thanks

    What you are asking for is not possible, as directly as you are trying to do, but you can achieve the same results you seek with the tools you have.
    You can easily separate the two email accounts and use them separately on your iPhone. I currently have about 25-30 separate email accounts configured on my iPhone and each one receives its own mail, and sends out its own replies.
    The second option I can think of wold be for you to setup the separate account as mentioned above, but to continue to forward the email to your GMail account. When you reply and want the message to come from your domain account, just tap the "From:" line and select your domain's account and send the reply from there. Yeah, it will go out using your hosts server, but it will allow you to send from a different account than received the email.
    One more thing that might work for you is to use Google Apps. I help administer a domain for a local group, and they use Google Apps (standard) which is free, and it has their domain essentially hosted by Google. When I receive mail, it comes in to my [email protected], and I send out from my [email protected], even though it uses the GMail servers. I just have to login to the mail server using my full credentials for both sending & receiving. This would require you to use Google for managing your domain, and would still require you to have 2 separate email accounts like the second option above, but they both have their own login accounts on the GMail servers and the Google servers handle all the traffic.
    Of these options, the last seems to be the best fit, as you no longer need to forward all your email to a GMail account to access it, it is hosted by Google for you, and you just use their servers for your domain email. If you really want to have a GMail account that does nothing by masquerade as your account at your domain, then the second option seems to be a closer fit, but it requires you to do a little more work to manage the masquerading you desire.

  • Changing variable name within loop

    Instead of typing oit 8 different versions of this loop, I'd like to do something this where i increases value to define a new variable:
    for (int i = 1; i < 9; i++)
                double lbs[i] = (((dis * 2000) / 3456) * (ve)) * pr * 0.069 / 100;
                BigDecimal bd[i] = new BigDecimal (lbs);
    bd[i] = bd[i].setScale (1,BigDecimal.ROUND_UP);
    lbs[i] = bd[i].doubleValue ();
    String tflow[i] = Double.toString (lbs[i]);
    oFlow[i].setText (tflow[i]);
    i++;
    In PHP that's how I do it, but how about Java? I tried searching for "variable variables" since that's the only want I know how to describe it.

    I put what you gave me inside of public void CalcBoost() { ... } and I'm getting the error:java.lang.NullPointerException
            at Calculator.CalcBoost(Calculator.java:751)
            at Calculator.iBoostActionPerformed(Calculator.java:672)
            at Calculator.access$700(Calculator.java:69)
            at Calculator$8.actionPerformed(Calculator.java:299)
            at javax.swing.JTextField.fireActionPerformed(JTextField.java:491)
            at javax.swing.JTextField.postActionEvent(JTextField.java:672)
            at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:786)
            at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1530)
            at javax.swing.JComponent.processKeyBinding(JComponent.java:2438)
            at javax.swing.JComponent.processKeyBindings(JComponent.java:2473)
            at javax.swing.JComponent.processKeyEvent(JComponent.java:2401)
            at java.awt.Component.processEvent(Component.java:4909)
            at java.awt.Container.processEvent(Container.java:1569)
            at java.awt.Component.dispatchEventImpl(Component.java:3615)
            at java.awt.Container.dispatchEventImpl(Container.java:1627)
            at java.awt.Component.dispatchEvent(Component.java:3477)
            at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713)
            at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:627)
            at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:831)
            at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:741)
            at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:592)
            at java.awt.Component.dispatchEventImpl(Component.java:3506)
            at java.awt.Container.dispatchEventImpl(Container.java:1627)
            at java.awt.Window.dispatchEventImpl(Window.java:1606)
            at java.awt.Component.dispatchEvent(Component.java:3477)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)This now points to: for (int i = 0; i < oFlow.length; i++)

  • How to use variable in the LIKE function along with % operators

    Hi,
    Is there any way i can use the variable in the Like function. That means i have query like
    SELECT * FROM Device WHERE DeviceName LIKE %v_MediaName%;
    Here "v_MediaName" is the userdefined variable which contains string. I want to retrieve all the records from the "DEVICE" table whose DeviceName LIKE %v_MediaName%;
    If i put it in a single quotes '%v_MediaName%' then the v_MediaName will be treaded as a string instead of a variable. I am using this query in a Procedure.
    please help me out to resolve the issue.
    thanks

    LIKE '%'||v_MediaName||'%';
    Will not make use of the indexes though.
    Message was edited by:
    satishkandi

  • Variable scope within an interface and some questions

    I am creating a DataStorage interface with a member variable (can I call it a member variable when it is in an interface?) called dataObject. From what I remember, and what the compiler is telling me, the scope declarations "private," or "protected" can not be used on either methods or member variables in an interface.
    Now I have another class DataInput that implements DataStorage and I want to make the dataObject private and put in accessor methods to get to the dataObject. But I also remember reading something that said, during inheritance you can not make the scope of the method (and variable?) more narrow. Meaning if a method was defined as default in the parent class, the subclass can not override that method to give it private access all of a sudden.
    Now a couple of questions with this...does that rule only apply to subclassing (that is with extends) or does it also apply to implementing interfaces. Second question, I am pretty sure that rule applies to methods that are being overriden, but does it also apply to variables in an interface...because if that is the case, I can't re-declare the variable in the class that implements the interface to be private...and then there is no way to protect that variable.
    By the way I did re-declare the variable in the subclass (implementing class) and declared it as a private, and it works...but I'm still trying to figure out the general rule.

    well if the interface variables are implicitly public static final, how come I am able to re-declare the variable name within the class that implemented the interface.
    If for example in interface Car there is a variable color, how come in class Honda implements Car, I can redeclare the variable color, and give it public access. I thought final meant final, no redeclaring...but does that not hold for static variables?

  • Variable screen in Planning Function for Integrated Planning

    Hi all.
    I have created a planning application with the WAD, based on an Input_ready Query. Manual planning works fine and even planning functions go well, using the command wizard.
    However, if I try to use a variable in a planning function and I set the parameter to pop-up the variable screen within the command wizard for a planning function, I get an 'uncaught exception'. An almost blank IE-window pops up which is supposed to display the variables, but it fails.
    Does anybody know how to solve this?
    Gr.,
    Marc.

    Hello Marc,
    do you still have this error? I encountered the same problem with SPS 9. Maybe you should install at least SPS 10. The variable popup works correct there.
    Best regards
    Martin

Maybe you are looking for

  • Cant save as AI but can as PDF

    Using PC Windows XP Service Pack 3; CS5 Illustrator 15.1.0, 2gb Ram, 50gb Free HD space. Opening an AI file sent from Japan, not sure of its PC or MAC (is there a way to find out). All fonts are as outlines, images embedded. After making a few simple

  • USB hub stopped working

    For years, I've used a powered Belkin 6-port hub to connect an Apple aluminum extended keyboard to a rear port on a 2008 Mac Pro:  the way my desk is laid out, the pathetic 3 foot keyboard cord otherwise doesn't reach.  A couple months ago, upon rest

  • Where can i find this slideshow template?

    I've seen this slide show interface on a few different sites: http://downtownrivals.com/store/DeasVail/Shirts/Girls/299 When you click on the images it darkens the screen and then brings up a flash slide show. I'm assuming that this is some sort of t

  • Installation stops...what is "desktop client"?

    When installing the latest Adobe Flash update, the installation stops and tells me to stop the "desktop client".  Where and how do I do this?

  • Bw upgrade - Authorization concept

    Hi, We have just completed the BW3.5 upgrade to BI7.3. I'm trying to work out the authorization concept in our system again. I've created one simple query on a multiprovider with only 1 characteristic and 1 KF. -Authorization object S_RS_MPRO for thi