[AS]
as with(this){
eyezberg.postCount == 1000;
this.setValue(“something special”);
this.text = “Something Usefull on PHP”;
this.text +="";
[/AS]
Ok, so this is post 1000 in season 2 of KirupaForums for me…
What I want to do on this occasion is start a thread like senoculars “best of” ones,
but not about Flash and /or Actionscript, but rather
about Flash and PHP usage; in the hope of providing
a usefull resource to refer to for commonly asked questions…
Please add only short comments to keep this as clean as possible,
or usefull tips’n’tricks of your own.
To start with: WHY should you bother learning PHP?
1/ it’s free! most hosts give you acces in the basic packages.
2/ there’s a huge community on the web with 1000s of scripts
for you to download and use:
- http://www.asp-php.net/scripts/asp-php/download.php
- http://phpclasses.goelette.net/browse.html/browse.html
- http://www.evilwalrus.com/
- http://codewalkers.com/archives/phpcoding/
- http://www.mattsscripts.co.uk/php_scripts.htm
- … (just do a Google search…)
3/ it’s very well documented, help is available on lots of
forums, and the scripting is very similar to actionscript.
4/ it lets you achieve things Flash alone can’t:
-send server-side email (think “contact form, survey etc”…)
-read contents of your online folders (think “list all files/mp3s/images in a folder”…)
-store data in a database (think “guestbook”…)
-write data to a textfile in your webspace (think “guestbook - i got no database”…)
-upload (and resize!) images to your server (think “photogallery”…)
-create swf on the fly (MING library)
-maintain registered users records (think “login”…)
-…basically, save data to your server for later retrieval.
If you want a few examples of Flash/PHP integration, check out
Now, HOW do you use it?
The general usage is to combine Flash’s LoadVars object
with a PHP script:
-you include the variable you want to send to PHP into the LoadVars
(myloadvars.variable1 = value;****)
-you use myloadvars.sendAndLoad(“yourphp.php”, this, “POST”) to access the script
-the script uses the recieved variables and sends the result back to Flash
via PHP’s “echo” or “print” command as “&variablename=value” pairs.
-the onLoad handler of your LoadVars processes the results in Flash.
And WHAT are the tools you need?
Well, PHP is just text, so it can be coded in any text editor.
Macromedia’s Dreamweaver provides convenient PHP highlighting,
same for Edit Plus ( http://www.editplus.com ) which I recommend
(cheap, lots of languages supported, and an add-on so you can test-compile
your actionscript code in Flash straight from the editor!)
, or have a look at PHPEd from http://www.nusphere.com …
If you want to test on your computer, so as not to upload the scripts
every time you change something, I recommend using the Easy PHP package
from http://www.easyphp.org , I’ve been using this for some years now
on both Win 2k and Win XP Home without any problem, it’s a one-click
install of the Apache server, PHP, phpMyAdmin to work on your databases…
All for free. If you want to try out another package, here’s a link for
a huge collection:
http://www.hotscripts.com/PHP/Software_and_Servers/Installation_Kits/index.html
and that’s all you need!
Don’t forget to empty your browsers cache after making changes to your
swf or PHP files, so as to always preview the latest ones!
Conclusion: this is just an introduction, which shall be followed
by posts giving example code for the above mentionned features.
Check the sticky thread here for more resources in the meantime, and if
you search Google well, normally you’ll always find a ready-to-use script
for all of your needs!
[AS]
this.onRead = function(you){
thank[you];
doSmilie(grin);
}//end onRead
}//end with
//end post 1000
[/AS]