Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / February 2005



Tip: Looking for answers? Try searching our database.

displaying mysql info via php in flash

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
isle10 - 27 Feb 2005 04:29 GMT
I have a movie sample that I downloaded because I dupoicated the same movie how
I wanted it to look.  However when I was done it didn't work.  To check if it
was me, I downloaded the exact sample and changed the database info, then
uploaded the page and it still didn't work.  I made a move that will get some
variables from a php page, which tapped into a database for the info, and
display the data in a text field.  The data doesn't display.  Here is the flash
page:
isle10.com/unit.html.

Here is the same php page:
isle10.com/test.php.

Can anyone help me?

Code for php:
<?php
mysql_connect("dbname","dbuname","pwd");
mysql_select_db("whatdb");
$qr = mysql_query("SELECT * FROM unit");
$nrows = mysql_num_rows($qr);
for ($i=0; $i < $nrows; $i++) {
  $row = mysql_fetch_array($qr);
  echo $row['lastName'].", ".$row['firstName']."<br>";
  echo " ".$row['phone']." ".$row['email']."<Br>";
  echo " ".$row['picFile'].":
".$row['caption']."<Br><Br>";
}
?>

Now, here is the tutorial site which is here on macromedia:

http://www.macromedia.com/devnet/mx/flash/articles/flashmx_php.html

action script code:

function showjpg(paramString) {
    // get the individual parameters:
    // params[0] = picture file name
    // params[1] = caption
    var params = paramString.split("#");
    picHolder.loadMovie(params[0]);
    caption.text = unescape(params[1]);
}
function showContent() {
    var i;  
    content.htmlText = "";
    for (i=0; i < this.n; i++) {
        if (this["picFile"+i] != "") {
            content.htmlText += "<b>" + this["firstName"+i] + " " + this["lastName"+i]
+ "</b>" + "<a href='asfunction:showjpg," + this["picFile"+i] + "#" +
escape(this["caption"+i]) + "'>&nbsp;&nbsp;(<font
color='#0000cc'>pic</font>)</a><br>";
        } else {
            content.htmlText += "<b>" + this["firstName"+i] + " " + this["lastName"+i]
+ "</b><br>";
        }
        content.htmlText += "&nbsp;&nbsp;" + this["phone"+i] + "<br>";
        content.htmlText += "&nbsp;&nbsp;<a href='mailto:" + this["email"+i] + "'>"
+ this["email"+i] + "</a><br><br>";
    }
}

// Create new load vars object c for data transfer
var c = new LoadVars();
c.onLoad = showContent;

// define content and actions for each tab
for (var i=65; i<=67; i++) {
    this["tab"+chr(i)].letter.text = chr(i);
    // when this tab is clicked
    this["tab"+chr(i)].onRelease = function() {
        // can't use chr(i) here -- must use mc name
        c.thisLetter = this._name.substr(3,1);
        bigLetter.text = c.thisLetter;
        content.htmlText = "Loading data for " + c.thisLetter;
        // scope of this function is main timeline so can refer to c directly
        c.sendAndLoad("power.php",c,"POST");
    }
}

stop();

The php page works just fine without flash, but the flash will not display it.
Can anyone point me in the right direction.  I'm using Flash MX.  Thanks.

Josh.
JamesDad - 27 Feb 2005 04:53 GMT
// When you use this syntax to invoke the onLoad function:
c.onLoad = showContent;

// You'll need to use this syntax to define the function:
showContent = function() {
// function body
}
isle10 - 27 Feb 2005 05:15 GMT
I already created a function for that:

function showContent() {
    var i;  
    content.htmlText = "";
    for (i=0; i < this.n; i++) {
        if (this["picFile"+i] != "") {
            content.htmlText += "<b>" + this["firstName"+i] + " " + this["lastName"+i]
+ "</b>" + "<a href='asfunction:showjpg," + this["picFile"+i] + "#" +
escape(this["caption"+i]) + "'>&nbsp;&nbsp;(<font
color='#0000cc'>pic</font>)</a><br>";
        } else {
            content.htmlText += "<b>" + this["firstName"+i] + " " + this["lastName"+i]
+ "</b><br>";
        }
        content.htmlText += "&nbsp;&nbsp;" + this["phone"+i] + "<br>";
        content.htmlText += "&nbsp;&nbsp;<a href='mailto:" + this["email"+i] + "'>"
+ this["email"+i] + "</a><br><br>";
    }
}

I also tried the one you showed, still didn't work.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.