A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: left side of operator must be a variable or property

  1. #1
    Member
    Join Date
    Sep 2001
    Posts
    43
    ex.
    eval("String"+varNumber)=thisProperty;

    this doesn't work.
    rats.
    this feels like a rookie q, but in flash mx i apparently cannot create a assignment name dyamically when i set a new var.

    how do i do it in flash mx?

    thanks

    JWT

  2. #2
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    thisProperty = eval("String"+varNumber);

  3. #3
    Member
    Join Date
    Sep 2001
    Posts
    43
    heh

    i apologize, i was not spec enough:

    eval( "string" + count ) = unescape( eval("string" + count) );


    both sides are eq's

    thanks again

  4. #4
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    hmmm... i'm not sure exavtly what you want to do but i set up this thing...

    Code:
    count = 1;
    thisIstest2 = "test1";
    MyString1 = "test2";
    thisStringCount = eval("MyString" + count);
    thisEval = eval("thisIs" + thisStringCount);
    trace(thisEval); //test 1
    trace(thisStringCount); //test 2

  5. #5
    Member
    Join Date
    Sep 2001
    Posts
    43
    thanks solo for your time. it is much appreciated.

    yes, that will work great.

    i was hoping for perhaps a less "roundabout" way to do it, since i'm using it in a "for" statement for generating about 7 vars for each of 10 items. so it gets messy. but it's all good.

    an offhand question - this used to work in flash 5, but not in mx anymore... anyone know why? practical advantages? just curious

    thanks

    jwt

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    This can be done without eval in both 5 and MX.
    Associative array syntax.

    whatever = this["string"+i];

  7. #7
    Member
    Join Date
    Sep 2001
    Posts
    43
    lol

    thanks yeah i assumed there was a syntax trick of SOMEthing i was missing.
    i feel much better.

    once again thanks!

  8. #8
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Originally posted by oldnewbie
    This can be done without eval in both 5 and MX.
    Associative array syntax.

    whatever = this["string"+i];
    can i do

    _root["string"+a] = this["string"+i]

    ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center