SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2004
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Help with MySQL Flash PHP and images

    PLease help. I am quite new to both actionscript and PHP, and I need to do something quite complicated.

    Basically. I have a database with pictures sorted into categories. I need flash to get the number of categories (this number varies you see) and create a button/link for each category, with the category-name on it. When you click on the button, the pictures within that category should then be displayed, and with the help of prev/next buttons you should be able to flick through them.

    Is this at all possible?
    Does anyone know how to do it?
    Does anyone know of a tutorial which might help (and please don't say the one with the address book, as it is a muddle and not very well-explained)?

    Thank you in advance

    Trine

  2. #2
    SitePoint Wizard bronze trophy JRMillion's Avatar
    Join Date
    Apr 2004
    Location
    Arlington VA
    Posts
    2,094
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you are probably talking about the tutorial at actionscript toolkit...
    I actually found that one helpful.
    Basically you want to use LoadVars() in conjunction with PHP scripts.
    The PHP scripts must produce output in the form of &var1=value1&var2=value&(etc etc)....
    you can then, using actionscript, loop thru the variables passed back to flash and dyanmically create or attache the buttons.
    flashkit.com might be a good place to look for example of using loadVars().
    You could also use XML if you want to use the XML object instead of loadvars, that would allow for more structured dat to be brought in. In that case you would use PHP to dynamically generate XML files from your database.

    This is an exampe of loadVars, I used this to populate a polldown list component with a list of image filenames returned by a PHP script.
    You will see reference to a function "loadPics" which actually bring the images into my flash app. As you can see, its not that hard.

    var picFiles = new LoadVars();
    picFiles.onLoad = function(){
    traceList.addItem("None");
    for(var i=0;i<picFiles.count;i++){
    traceList.addItem(picFiles["File"+i]);
    }
    traceList.addEventListener("change",loadPics);

    }

    picFiles.sendAndLoad("list_pics.php",picFiles,"POST");

  3. #3
    SitePoint Wizard bronze trophy JRMillion's Avatar
    Join Date
    Apr 2004
    Location
    Arlington VA
    Posts
    2,094
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    FYI- this is the output from my list_pics.php file

    &count=10&File0=freud.jpg&File1=goddard.jpg&File2=ipod.jpg&File3=seagull.jpg&File4=seagull_flying.jpg&File5=breecher.jpg&File6=m3.jpg&File7=anna.jpg&File8=rose.jpg&File9=jc.jpg


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •