i am working on a flash portfolio that is supposed to be fed from a MySQL database. Until early today everything worked just fine, but then i had to change the structure of my database. initially i had just 2 tables, news and work… now i added links, photo, digital etc, and dropped work…
and it just doesn’t work anymore… it’s strange as i did nothing to the news section for example…
i have included the fla, the php scripts that send the XML to flash as well as a query of my database in the following zip archive…
Please take a look and explain me what is the problem… i think just one example would be enough for me to take over from there…
thanks a lot
i solved part of the problem…
i had a wrong path for the php script that fed the XML to flash…
but i still can’t get the photos loaded through photoq.php
flash gets the XML correctly, but for some reason the images are not being loaded
ok… i simplified the problem…
i have included below the php script that gets the data from my database and the AS that should get the XML… i know the first one works, the problem must be in the second one, but i can’t figur it out…
$conn = @mysql_connect($host,$user,$password) or die("Could not connect to database.");
// select the database
mysql_select_db($database,$conn) or die("Could not find database $database");
//same thing
$photo_q = "SELECT * FROM `photo` ORDER BY `id` DESC";
$photo = mysql_query($photo_q,$conn) or die("photo data not found");
// also using a variable for the output
$xml_output .= "<main>
";
//
// News Section
//
$xml_output .= " <photo>
";
// same thing
for($i=0 ; $i < mysql_num_rows($photo) ; $i++){
$row = mysql_fetch_assoc($photo);
$row['picture'] = urlencode($row['picture']);
$xml_output .= " <entry>
";
$xml_output .= " <picture>".$row['picture']."</picture>
";
$xml_output .= " </entry>
";
}
$xml_output .= " </photo>
";
$xml_output .= "</main>
";
//output variable
echo $xml_output;
?>
this is the php… i just included it so you can see the structure of my photo table…
main = new XML();
main.ignoreWhite = true;
main.load("http://localhost/vilosophe/photoq.php");
main.onLoad = function(ok) {
if (ok) {
var photoSection = this.firstChild.childNodes[0];
var photoEntries = photoSection.childNodes.length;
//generator de butoane
positi=10;
for(j=photoEntries-1;j>=0; j--){
var mc = copyButton.duplicateMovieClip("copy"+j,j+10);
posit+=1;
if (posit>=5) {posit=0}
mc._x =(posit*20);
if (posit==0) {positi+=30}
mc._y =(positi);
mc.id = photoSection.childNodes[j].childNodes[0].firstChild;
mc.nr=j;
mc.onRelease = function(){
_root.workimg._visible=false;
topline._visible=true;
//removeMovieClip(_root.lwLogo);
//this.createEmptyMovieClip(lwLogo)
lwLogo._alpha=0;
topline._alpha=0;
lwLogo.loadMovie(unescape(photoSection.childNodes[this.nr].childNodes[1].firstChild.nodeValue));
this.onEnterFrame = function() {_level0.photo.loading.loader._visible=true; _level0.photo.loading.loader=(lwLogo.getBytesLoaded()/lwLogo.getBytesTotal()*100)+"%";
}
if (lwLogo.getBytesLoaded() == lwLogo.getBytesTotal()) {_level0.photo.loading.loader._visible=false;
this.onEnterFrame = function() {lwLogo._x=-(353 +lwLogo._width/2);
topline._y=lwLogo._y-2; topline._x=lwLogo._x-2; topline._width=lwLogo._width+4; topline._height=lwLogo._height+4;
if (lwLogo._alpha<=100) {
lwLogo._alpha += 10;
topline._alpha+=10;
}}}}}}}
and this is most of my AS… it creates a XML, some variables, then duplicates a button as many times as there are records in the table… the buttons are supposed to load the photos from my database and that is what doesn’t work…