A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Need help linking Flash and php

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    22

    resolved [RESOLVED] Need help linking Flash and php

    Hi all,

    I've got a mysql db in which a table called "pictures" holds a list of paths to images on the server.
    It looks like this:



    Also got a flash front end.
    Using php I can output (print) a string to the browser of all the images
    uploaded by a certain user or which have been uploaded to a certain gallery.
    like this:
    &picsToShow=/members/1/images/32.jpg,/members/1/images/33.png,/members/1/images/34.jpg,/members/1/images/35.png,/members/1/images/36.png,/members/1/images/37.png,

    But how can I pass that string to the flash front end (which is held in the same page)?

    All and any help much appreciated.

    Best wishes
    Monty

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

    how about sending
    <embed src="movie.swf" flashvars="picsToShow=/members/1/images/32.jpg,/members/1/images/33.png,/members/1/images/34.jpg,/members/1/images/35.png,/members/1/images/36.png" ...></embed>
    in your page?

    Musicman

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    22
    I'd totally forgotten about FlashVars so thanks for reminding me.
    Had to scratch my head about it for a while but I solved it and I'll post it
    here in case it might help others.

    So the query goes:
    //WRITE A STRING (ARRAY) THAT FLASH CAN READ
    $clever="";
    while (($row = mysql_fetch_assoc($sql)) !== false) {
    $imagelist= $row["dirpath"]. ",";
    $clever=$clever.$imagelist;
    }
    print ("&galleryPics=" .$clever);

    - - - - - -


    then in the embed tag:
    <embed src="memDBgallery.swf" FlashVars="<? echo "galpic=".$clever; ?>" quality="high"

    Works a treat.

    Best wishes
    Monty

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