cyrano wrote:I have just made static flash site, without xml and php.
What would be interessting is how to do this?
any hints or weblinks?
...
But making a small menue in flash would be nice
Hi cyrano,
a simple but effective tutorial how to load external text-data (like HTML) into flash is on this site:
http://www.flashkit.com/tutorials/Dynam ... index.php/
I'm sure you can find tons of information which will be more detailed than I can offer you in this forum.
Just search on the net for keywords like "flash dynamic content loadvars php".
One of the main advantages of using phpWCMS with Flash is that the editing of the site can be done with phpWCMS as well as structuring the items and providing a security system. You don't want to do those things in Flash. Too complicated and totally unnecessary.
If you're skill is entry-level with Flash (MX) and PHP I'd wait for a sample Flash frontend based on stable (RC5 ? v. Next ?) code of phpWCMS.
To give you a simple hint: When developping a static Flash site you'll end up with a lot of frames with text. The layout is virtually the same on each frame. When developping a dynamic Flash site you just create a single "layout aka template" frame which could be a "dynamic textfield". The textfield is a variable and you can load data into that variable using the Flash "LoadVars" object. This isn't complicated, actually it's a few lines code.
Using Flash MX (2004) you can perform such a load using these lines:
A. myfile.txt is a file on your server (
http://www.myserver.com)
B. myfile.txt contains: myName=John&myAge=88&myInteger=31137
C. In Flash (MX) you create 3 dynamic textfields named txtDynamicName, txtDynamicAge and txtDynamicInteger
D. In Flash (MX) you enter this code on the first frame:
Code: Select all
/* 1. create a new instance of the LoadVars object)
var myObject = new LoadVars();
/* 2. assing a function to be executed when the file has been loaded */
myObject.onLoad = function() {
/* put the content of the variables into Flash textfields */
txtDynamicName.text = myObject.myName;
txtDynamicAge.text = myObject.myAge;
txtDynamicInteger.text = myObject.myInteger;
}
/* NOW load the file from the server (or your local disk whatever) */
myObject.load("http://www.myserver.com/myfile.txt");
If you get it you can understand that you could write a PHP script that could access a database and return data in the same format as the textfile was formatted.
The PHP script could look like this:
Code: Select all
<?php
echo "myName=John&";
echo "myAge=11&";
echo "myWhatever=yes_it_is";
?>
A step further:
Code: Select all
<?php
$myphpvar_name = "George";
$another_variable = 7363;
$actor = "Marlon Brando";
$thewinner = "Greece";
echo "myName=".$myphpvar."&";
echo "myThing=".$another_variable."&";
echo "myWhatever=".$actor."&";
echo "myWinner=".$thewinner."&";
?>
If you'd execute the PHP-script the output would look (in your browser) like this:
Code: Select all
myName=John&myAge=11&myWhatever=yes_it_is
Flash can read the above line perfectly, will split it using the & (ampersand) sign and will create variables in your "myObject" object in Flash so you can access them easily.
Step 3 is to access a database in PHP and have PHP return the values from the database-query with echo-statements.
If you ever hear someone mention "Flash Remoting" than it's a new and better and more standardised way to transport data from the webserver (using PHP or ColdFusion or Perl or etc etc) to Flash. FlashRemoting (AMF) is a binary format which is more secure, faster but harder to implement and to debug.
Furthermore an excellent tutorial with Flash & PHP is here:
http://actionscript-toolbox.com/samplemx_loadvars.php.
Have phun,
M4