A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: variables from variables

  1. #1

    variables from variables

    im tyring to use the value of one variable to provide part of the value for another.

    ----
    var city = london;
    var citytext = londontext;
    var citybg = londonbg;

    highlight(city,citytext,citybg);
    ----

    the code above works- but im trying to avoid having to type in all three fields since they all include the word 'london'.

    but when i try:
    ----
    var city = london;
    var citytext = city+text;
    var citybg = city+bg;

    highlight(city,citytext,citybg);
    ----
    it doesnt work.

    how should i be doing this?



  2. #2
    a.k.a gltovar deadlock32's Avatar
    Join Date
    May 2001
    Location
    Naperville,IL
    Posts
    489
    var city = london;
    var citytext = city+text;
    var citybg = city+bg;

    should be

    var city = london;
    var citytext = eval(city+"text");
    var citybg = eval(city+"bg");

    hopefully that works

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