A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [F8] Passing variables from PHP to Flash, loading image

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    27

    [F8] Passing variables from PHP to Flash, loading image

    Alright- I need to pass a URL in a PHP variable to Flash, and have Flash load the image at certain measurements, which will also be passed through variables from PHP to Flash.

    I've been Googling LoadVars() the last two hours, and can't understand any of it. It gives me bits of code, but it doesn't tell me where to put this code, and I'm just downright confused. I've seen many different ways to do this, I don't know which is the best for what I'm looking to do, or anything.

    I know PHP, and I've got that part down pat. It's the Flash part I don't understand.

    Could somebody walk me through this? I know it's alot to ask.. but thanks. =]

  2. #2
    Have you tried passing the variables to the flash player through a query string? In your embed code, just tack on all this extra stuff after the ".swf":

    http://www.yourserver.com/flashfile....&picheight=600

    When your flash file loads, the variables (picwidth, picwidth, picheight) will be loaded in the _root of your flash movie. Then you can use them with loadMovie or loadClip to load your image. Then you'll need to find some way of waiting until AFTER the image is fully loaded, then resizing the "_width" and "_height" to your desired dimensions.

    If you need more info on the query string thing, google will help you:

    http://www.google.com/search?q=pass%...query%20string

    I know that wasn't really a complete answer, but I hope I've pushed you in the right direction. I don't know how to do the PHP code, but it sounds like you've got that part figured out anyway.

  3. #3
    Sorry, that first link was supposed to be a snippet of text, not an actual link. Let me try again without the "http://". Here's what I meant:

    yourserver.com/flashfile.swf?picname=folder/filename.jpg&picwidth=800&picheight=600

  4. #4
    Junior Member
    Join Date
    Mar 2007
    Posts
    27
    Okay- that's where I'm confused. How do I access/use/set the variables and tell them to display in Flash? How do I use loadMovie or loadClip?

    I understand the query thing- I'm a PHP/MySQL expert.. I'm just newbie at Flash. ;D

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    have a look at the flash-php video tutorial at www.gotoandlearn.com ... he explains it well..

    also i have a few flash-php examples in my library u can download ... e.g have a look at my flash-php feedback form
    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

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