Support » Everything else WordPress » WordPress PHP code in Flash

  • Hi

    I am wanting to have a small Flash unit on my static home page displaying the latest posts. I have looked around for solutions but they all seem to be focusing on an entire WordPress-powered Flash site which isn’t what I’m after. Does anyone know how I can use my existing php code in Flash?

    Thanks very much

Viewing 5 replies - 1 through 5 (of 5 total)
  • whooami



    Do you know how to write actionscript? Thats the most important follow-up question.

    study up on how to use php, mysql, and flash together — thats really all you need to do.

    that or you can grab the data, drop it into an xml file, and display that.

    I could code up a simple flash object that accomplished what you want, but not for free, and Im not going to walk someone else through the process on these forums, sorry, as it’s really beyond the scope of a simple reply.

    Ok, I have managed to write the code for the swf to get the current php date, because I thought that would be an easier place to start. I will continue to try to integrate the WP template tags into the php which is fed to Flash. This is the code I am using at the moment:

    In my PHP file:

    $theDate = date('l jS F Y');  ;
    $passIn = "" ;
    $passIn .= "theDate=" . $theDate . "" ;
    echo $passIn ;

    and in my actionscript:

    onEnterFrame = function() {
    addressVars = new LoadVars();
    addressVars.onLoad = function() {
    _root.theDate = "The PHP date is 

    Thank you for your quick response

    Sorry it didn’t copy correctly, but you can still understand it.


    I have managed to get somewhere! So far it only displays the title and excerpt but the rest should be straightforward from now on.

    Here is the code in frame 1 of my swf:

    addressVars = new LoadVars();
    addressVars.onLoad = function(success) {

    In frame 10:

    _root.theTitle0 = addressVars.title0;
    _root.theExcerpt0 = addressVars.excerpt0;

    (theTitle0 and theExcerpt0 are variable names of my two dynamic text boxes)

    And finally, the code in posts.php:

    mysql_pconnect ("localhost", "myusername", "mypassword");
    mysql_select_db ("wordpress");
    $qResult = mysql_query ("SELECT * FROM wp_posts ORDER BY
         post_date DESC");
    $nRows = mysql_num_rows($qResult);
    $rString ="".$nRows;
    for ($i=0; $i< $nRows; $i++){
    $row = mysql_fetch_array($qResult);
    $datetime = strtotime($row['post_date']);
    $rString .="&title".$i."=".$row['post_title'].
    "&"."theTime".$i."=".date(jS." ".F." ".Y.", ".h.":".i."
    echo $rString."&";

    (That has more code than is necessary as I have not set up Flash to receive anything other than the title and excerpt yet.)

    As I said, this is just a start but I hope it was the hardest part! I will keep this topic marked as unresolved until I have completed what I am trying to do so if anyone has any suggestions I will be very grateful.




    Hello and I am glad that you’ve troubleshoot your error earlier. I am just curious and wondering how you are progressing. Thank you and many lucks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WordPress PHP code in Flash’ is closed to new replies.