dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: array syntax problem

  1. #1

    array syntax problem

    ok, i have multiple arrays and i need to access them by using a variable that gets sent thru one of my buttons.

    so let's say a button changes myVar to 0.
    myVar = 0;

    I need to set deptVar = to "advertising" which is held inside my array called "department".

    deptVar = department[myVar];

    so that much works. but now I need "advertising" to act as the name of the array I'm trying to call up.
    so now that deptVar = "advertising", i want to call on the advertising array:

    mediaType = deptVar[0][1];

    i want the effect of it saying advertising[0][1] because there is no array called deptVar.

    so my question is how do I use a variable like that to call up a different array?

    I tried concatenating it like this:
    newVar = deptVar + "[0][1]";
    mediaType = newVar;

    when tracing it, it looked right: advertising[0][1] but when i try to do something with it, Flash thinks it's a string!

    can someone help my syntax??
    thanks!
    -
    Jake

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361

  3. #3
    thanks so much! i feel so stupid, i've spent the past 2 hours trying to figure this out and all i needed was a stupid "this" !

    i appreciate it man.
    -
    Jake

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