A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Variable SharedObject identifiers

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    20

    Variable SharedObject identifiers

    Hi all

    I have a question regarding the use of variable identifiers when using SharedObjects, I will explain.

    I want to have the identifiers of a SharedObject as variable names, so:

    I create a variable:
    var destinationLoc = ["destination"+mySharedObject.data.numRuns];

    I write to SharedObject:
    mySharedObject.data.destinationLoc=destination;

    Unfortunately the above script does not see the variable, destinationLoc as a variable and instead views destinationLoc as a "hard-coded" identifier

    Is there a way to create a variable sharedObject identifier?

    Any help will be greatly appreciated, thanks

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    Code:
    mySharedObject.data["destination"+mySharedObject.data.numRuns] = destination;
    or equivalently:

    Code:
    var destinationLoc = "destination"+mySharedObject.data.numRuns;
    mySharedObject.data[destinationLoc] = destination;
    Last edited by silentweed; 03-10-2010 at 12:19 PM.
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    20

    SharedObject variable indentifiers

    Psssst..epic thank you

Tags for this Thread

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