Using eval on variables' names

The line
eval("_root."+this.p).display_text.text=this.v
works fine, whereas
eval("_root."+this.n)=eval("_root."+this.n)+this.step;
says "Left side of assignment operator must be variable or
property"
p is a name of an object created with arrachMovie
n is the name of a variable containing a number
Using this[] in place of eval() raises no errors but does no
do the
assignment meant
What is the explaination?

In my case eval("_root."+this.n) is called on an object which
has an
attribute n which holds a string "variableName" and another
attribute called
step, holding a number
There is variable called variableName in the root, holding a
number
I expected eval("_root."+this.n) to evaluate to
_root.variableName and then
will add a number held in this.n to the number held in
variableName
Where are my expectations wrong?
"kglad" <[email protected]> wrote in message
news:e2g4ha$7t6$[email protected]..
> eval("_root."+this.n)+this.step supposed be be? it's a
string, so you're
not
> going to resolve it into an object by assigning it to
something that looks
like
> an object.
>
> if this is an object, then you could assign that to
this.
>

Similar Messages

  • Unable to publish in Swf format. Get error message: 'Swf compilation failed. Note: Please verify if any of the actionscript keywords is used as user variable name'. Anyone know how to fix?

    Unable to publish in Swf format. Get error message reads: 'Swf compilation failed. Note: Please verify if any of the actionscript keywords is used as user variable name'. Anyone know how to fix?

    Hi There,
    Can you tell me the Operating System and Captivate version you are using?
    Also can you confirm if you are getting this issue will this one project or all the projects? Try to copy paste this project on a new blank project and then try to publish.
    Regards,
    Mayank

  • When publishing a captivate I get the message "Swf compilation failed. Note: Please verify if any of the actionscript keywords is used as user variable name." and it won't allow me to publish the Captivate, can anyone help?

    When publishing a captivate I get the message "Swf compilation failed. Note: Please verify if any of the actionscript keywords is used as user variable name." and it won't allow me to publish the Captivate, can anyone help?

    Hi There,
    Can you tell me the Operating System and Captivate version you are using?
    Also can you confirm if you are getting this issue will this one project or all the projects? Try to copy paste this project on a new blank project and then try to publish.
    Regards,
    Mayank

  • When to use upper-case variable names?

    What is recommended:
    1. private static final int INITIAL_CAPACITY = 10000;
    or
    2. public static final int INITIAL_CAPACITY = 10000;
    or
    3. both (1 and 2).

    Get a copy of "The Elements of Java Style", and/or read the style guidelines available on this site.
    You should follow naming and other style conventions. It makes your code easier to read and thus easier to maintain.

  • Using a variable's definition as a variable name

    I have a string variable with definition I need to use as a
    variable name.
    For example, this is super simplified:
    var newVariable = 'it is working';
    var partOne:String = 'new';
    var partTwo:String = 'Variable';
    var partThree = partOne + partTwo;
    trace("my variable is " + partThree);
    Instead of tracing partThree as literally partOne + partTwo
    (which traces "newVariable") i'd like it to trace the
    Definition of partOne + partTwo (which is "it is working").
    I hope this makes sense, help or advice is
    appreciated.

    ...
    var partThree = this[partOne + partTwo];
    trace("my variable is " + partThree); //will trace: my
    variable is it is working
    TS

  • Question on exception variable name

    A very simple question:
    In the following code
    public void compile() {
    ParseTree p;
    try {
    p = parse();
    p.toByteCode();
    catch (ParserException e1) { }
    catch (DumbCodeException e2) { }
    in the first catch clause, the variable name is e1 and e2 for the second catch clause. Can I use the same variable name e for both clauses?
    Edited by: Shibaryotaro on Aug 19, 2009 3:59 PM

    What happens when you try to?

  • Which is worse: awkwardly long or vague/arbitrary variable names?

    I'm programming in C++, but that shouldn't matter.
    I'm working on a small chunk of code that is a module for a much, much larger project. Part of my code is to make several hundred histograms and then run some statistics over them.
    My dilemma is that there are so many, that naming them is becoming difficult. So, I opt for incredibly long, cumbersome names rather than short arbitrary names. Heck, even I wouldn't know what was going on if I just named them "histo1, histo2." Instead I name them things like "MomentumTimesDeltaPhiEta1" which MIGHT make sense to someone who is working on another part of the project.
    And actually, that wasn't a real example. Some of my names are longer than that. Is that normal? I have programmed in C++ for a year, but I'm still not good at programming etiquette, so my code looks clumsy.

    Local vars can be short, if you find the need to give further explanation, comment. Try to give meaningful names more for class atributes, interfaces, and where a variable name can help documenting the code itself. E.g. (Pseudo-code, as I don't remeber a lot of C++):
    Instead of:
    z = sqr(a^2 + b^2)
    This is better:
    // Pythagorean theorem
    z = sqr(a^2 + b^2)
    This is even better:
    hypotenuse = sqr(catheti_a^2 + catheti_b^2)
    If you find yourself using incredible long variable names, it's a signal that your program is too flat, and you need to start refactoring it into a function, class, or using a namespace.
    So, e.g:
    namespace Geometry {
    function Hypotenuse(float a, b) {
    return sqr(a^2 + b^2)
    The code expresses a lot more meaning, while staying concise.
    Edit: I forgot square root
    Last edited by freakcode (2008-08-06 19:49:58)

  • Failed to solve variable web.framesrc.afrPushIframe using path .//IFRAME[@name='afr::PushIframe']/@src

    I get this problem Failed to solve variable web.framesrc.afrPushIframe using path .//IFRAME[@name='afr::PushIframe']/@src
    So far in the posts i only see this problem . Please let us know how to solve this?
    Thanks
    Sankar

    Tses wrote:
    Am I the only one in the world who tried ΟLT 12c with ADF 11g R2 PS3 ?
    :-(Hi! You're not alone :)
    We tried to record some load tests (OpenScript 12.2.0.1 Build 223) for our ADF R2 application.
    But during the playback I had the same error: "Failed to solve variable web.framesrc.afrPushIframe using path .//IFRAME[@name='afr::PushIframe']/@src ".
    Haven't you found the solution yet?
    By the way, when I use operation "Revert to Recorded" for all nodes of my test and playback it again, I see in results that the script has passed without errors, but nothing has changed in database.
    Thanks.
    Natalie

  • Is it possible to add a property using variable in variable name?

    I want to query for a list of virtual machines within a folder, then create a menu of the host names using forms.  Since the list of machines is subject to change, I want to build the list each time the script is run, rather than build off a static
    list. 
    For each virtual machine I need to create the list of variables below:
    $hostnameX = New-Object System.Windows.Forms.checkbox
    $hostnameX.Location = New-Object System.Drawing.Size(10,20)
    $hostnameX.Size = New-Object System.Drawing.Size(100,20)
    $hostnameX.Checked = $true
    $hostnameX.Text = "Type"
    $hostnameX.Controls.Add($hostnameX)
    The location and size values need to be incremented but I think I can figure that part out.
    I can use New-Variable to generate the initial variable. But I receive errors using the same method to try to create a new property for the variable.
    $VMS = Get-Cluster MyCLUS | Get-vApp "My vApp" | Get-VM | Select Name,PowerState | Sort Name
    For ($i=0; $i -lt ($VMS.count); $i++)
    $VMS[$i].Name
    $VMGUEST = "$($VMS[$i].Name)" -replace("-","")
    New-Variable "CB$VMGUEST" "New-Object System.Windows.Forms.checkbox"
    New-Variable "CB$VMGUEST.Location" "New-Object System.Drawing.Size(10,20)"
    In the above, $CBVMGUEST1 =  New-Object System.Windows.Forms.checkbox which is what I want,  but $CBVMGUEST1.Location is not set.
    Is there way to add a property using a variable in the variable name?  Or any other suggestions on how to tackle this issue?

    Hi,
    maybe another approach is a bit easier.
    Use a hash-array like
    $CB = @{}
    $CB[$VMGUEST] = New-Object System.Windows.Forms....
    $CB[$VMGUEST].Location = New-Object System.Drawing....
    Mit freundlichen Grüßen Jens Kalski
    That's the correct answer.  Anytime you find yourself wanting to create variables named "Widget1", "Widget2", "Widget3", etc... it's a pretty clear indication that what you really need is a collection object of some sort.  That might be an array,
    a hashtable, or any other data structure for holding other objects, depending on your specific needs.

  • 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 variables as variable names

    Hello (me again)
    I know I can use this[variable] to evaluate a variable name
    so it can be used for such things as referring to a movie clip
    e.g
    this[variable]._x=100;
    However... I'm trying to create movieClips with:
    var MovieClipName:MovieClip = new MovieClip()
    which doesn't work if I use this[variable] instead of
    MovieClipName.

    Thanks,
    I'm having real problems. I'm looping through my movieclips,
    as I'd like to load content into them one by one..proceeding to the
    next after the first has been loaded.
    At the moment I have...
    for (var i=1; i<totalImages +1; i++)
    this["image" +i].loadMovie("image" +i +".jpg");
    bLoaded=0;
    bTotal=this["image" +i].getBytesTotal();
    while (bLoaded<bTotal)
    bLoaded=this["image" +i].getBytesTotal();
    This preloader isn't working..as the other images start
    loading before the first has completed..bTotal always seems to be 4
    which is the number of bytes of an empty movie clip.
    How odd

  • Using variable names for object names

    Is there any way you can use a String variable to name an object? I.e., something like:
    String name = "objectName";
    \\ create an Image object named objectName
    Image (name.valueOf()) = new Image();
    This code obviously does not work, but I'm working on a map applet which uses a map composed of thousands of tiles, and then shows only a portion of the map by drawing the appropriate tiles into the window using the x/y coordinates and a nested for loop to determine which tiles to draw. However, unless I want to manually declare and then call each of these Image objects, I need to have a way to have the actual name of each image object be a reference to a variable, which I will then initalize according to the name of the tile I'm using. Does that make sense at all? Anyway, I was just wondering if anyone knows of any way to do this. Thanks.
    -Ari

    Typically this is done using a Collection, for example:
    Image[] img = new Image[100];
    for (int i=0; i<img.length;i++)
      img[i] = new Image();... Sort of thing.

  • Using variable name for Netstream Publish() (actionscript)

    Relatively new to Actionscript.  In the netstream publish() or play() methods, can I pass variable names to the methods instead of hard-coding the stream name?
    Example:
    private function publishLiveStream():void
                ns = new NetStream(nc);
                ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                ns.client = this;
              // blah blah other stuff...
               ns.publish("thefilename", "record");
    I want to replace "thefilename" with a value passed from an input box or use dynamic naming (i.e. current date & time).

    you can use in procedure using sunopisis technology
    OdiExportMaster "-TODIR=/temp/" "-ZIPFILE_NAME=export.zip" "-XML_CHARSET=ISO-8859-1" "-JAVA_CHARSET=ISO8859_1" "-EXPORT_VERSIONS=YES"
    or you can use (unix System)
    OdiExportMaster "-TODIR=/#v_FileName" "-ZIPFILE_NAME=export.zip" "-XML_CHARSET=ISO-8859-1" "-JAVA_CHARSET=ISO8859_1" "-EXPORT_VERSIONS=YES"
    Hope it will work
    Thanks

  • 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.

  • How to use an array for variable name of swing components using NetBeans

    I'm completely new to Java and GUIs, so excuse me if I use the wrong terminology. I'm making a JFrameFrom in NetBeans. I'm getting really tired of typing instructions like jTextField15.setText(variable[15].text); I would like to make the variable names of my text fields an array so I can use a loop to change the values, text, tooltips, etc. When I click "change variable name" it won't let me put an array in. The code that Swing generates is protected and I can't change it. I know there must be a way to do this. Any help is appreciated.

    Try not to use the NetBeans visual GUI builder. Then it should be easy to create an array of text fields:
    JTextField[] tfs = new JTextField[15];
    for (int i = 0; i < tfs.length; i++) {
        tfs[i] = new JTextField(10);
    }For laying out the text fields, see: [http://download.oracle.com/javase/tutorial/uiswing/layout/using.html]

Maybe you are looking for

  • How to populate the fields in a report.

    Hi, I've created a function module which calls a report. The report generates a file with sequence no. in the application server. The problem now is that I want the data from the presentation layer but the Z-Report doesn't generate any output with da

  • Use of Font Sets in CHM Navigation Pane

    Hi everyone. One of our product suites is going to be published for the first time using WebHelp Pro as its primary output but with a CHM file as a backup in case the client's internet connection fails or isn't present. To cut a long story short we h

  • Nuked? I think so, how to fix this nightmare

    Can someone help me with my daughters Curve, its stuck in an endless loop restarting etc and i believe that this is what is known as being nuked I have had a look on the internet to try and work out what to do and have tried a few things most notably

  • Bulkloading vs Direct Path

    Having read this article http://www.oracle.com/technology/oramag/oracle/06-mar/o26performance.html and being a data warehouse person that firmly believes that target tables should have error processing on the row which is also clearly noted in oracle

  • Solaris 10  pts psuedo tty's

    I am porting from Solaris 8 to Solaris 10 on a SunFire V240. I noticed that there are only 32 pts entries in the /devices/pseudo directory. As I will have more than 32 users logged in to this server, will Solaris 10 automatically add more as needed o