dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Send an array from php to flash

  1. #1
    Member
    Join Date
    Oct 2001
    Location
    Nyon, Switzerland
    Posts
    36

    Send an array from php to flash

    Hi there,

    I've an array $array[] in a php file and would like to send it to flash with all its contents.

    How can I do so please?

    Thanks for your help.

    War_Angel

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    if there is a character that would not occur in the data (e.g a | bar), you could use
    print "myArray=" . implode($array, "|");

    Of course this only covers plain arrays - php arrays can have both text indices (like an actionscript object) and structured elements

    Musicman

  3. #3
    proud new daddy! LuxFX's Avatar
    Join Date
    May 2000
    Location
    Dunsinane
    Posts
    1,148
    ...and the flash side of that would be

    asArray = myArray.split("|");

    note:

    Although php supports delimiters (the pipe or other character you want to divide your array items with) of more than one characters, flash doesn't, you can only 'split' with single characters. This is one the more infuriating limitations of flash, because a traditional delimiter in flatfile (text) databases is the || (a double-pipe) and this simply isn't possible in flash.

    cheers!
    LuxFX
    For War's a banker, flesh his gold. There by the furnace of Troy's field, Where thrust meets thrust, he sits to hold His scale, and watch the spear-point sway; And back to waiting homes he sends Slag from the ore, a little dust To drain hot tears from hearts of friends

    - Aeschylus, Agamemnon

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