Jump to content


Photo

Externally updating pages in a flash website


  • Please log in to reply
24 replies to this topic

#21 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 28 January 2007 - 05:07 PM

Well it was just an example it doesn't need to be written like that. If you are taking data from a database, then yes it would have to be written above. What it basically does is just retrieves data from a database into XML. The XML is treated like a string, since we echo it out. And yes you include the PHP file straight into Flash, yet you treat it like XML. So, all at one time.

I'll do an easier example:

<?php
//We'll call this file example.php

//This is what a PHP variable looks like
$myVariable = "This is a PHP variable"

//Echo: Output a string or a number onto the page
//We use the backslash before the doublequote since the echo statement already uses double quotes. Alternatively you could use single quotes, with no backslashes, but I prefer to do it this way incase of problems (which I've had)
echo "<?xml version=\"1.0\" encode=\"UTF-8\"?>";
echo "<firstChild>";
//We add a variable to the string like we do in Flash. We close the string, add a dot (instead of a plus), write the variable, add another dot, and open the string again
echo "<childNode attribute=\"".$myVariable."\" />";
echo "</firstChild>";

?>

So now if you went into Flash...
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success:Boolean) {
	if(success) {
		trace(this.firstChild.childNodes[0].attributes["attribute"]);
	}
}
myXML.onLoad("example.php");


#22 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 01 February 2007 - 02:40 PM

Ben, was that a reply to me or to darkson01?

#23 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 01 February 2007 - 03:48 PM

Well, darkson01, but that code should help you too, if you want to use PHP and XML, instead of AMFPHP.

#24 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 14 February 2007 - 06:08 PM

I'm sorry but I don't get that at all.. I followed the tutorial on PHP, MySQL, and XML on www.gotoandlearn.com... but that only resulted in me understanding how to create a list.. could you possibly give me a quick little explanation (or point me towards one) for me to be able to use PHP and/or XML to update a section in flash with images and text? I must sound so incompetent but my mind is just getting to the point of total frustration.

#25 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 15 February 2007 - 03:39 AM

Well this is all Flash based now, what you need. Although it would take very long to explain to you how to do it. It's mainly for loops though. Not much else I can do except tell you to learn little tricks and tips in actionscript to help you solve later problems. Trust me, it really helps. I used to take maybe 5 actionscript tutorials a day right up until 1-2 years ago. I have now learnt many tricks, and I use them in everything I make.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users