all groups > flash data integration > november 2005 >
You're in the

flash data integration

group:

Beginniner help with PHP and Flash



Beginniner help with PHP and Flash the Fusion project
11/16/2005 9:40:52 PM
flash data integration: Hey everyone,

I'm trying to test out integrating PHP with Flash by creating a Flash document
that simply states the current date (information which is transferred from a
PHP document). My flash file just contains one dynamic text box with the
instance name "theDate_txt." The actions under the actions layer has the
following actionscript:

var dateDisplay:TextFormat = new TextFormat();
dateDisplay.font = "Georgia,Times,_serif";
theDate_txt.setNewTextFormat(dateDisplay);
theDate_txt.autosize = "left";

var getDate:LoadVars = new LoadVars();
getDate.load("http://localhost/phpflash/date.php");
getDate.onLoad = function() {
theDate_txt.text = this.theDate;
};

The "date.php" file has the following and is placed properly in the phpflash
folder...

<?php
echo 'theDate='.urlencode(date('l, F jS, Y'));
?>

When I test the flash movie, no date comes up and it's simply blank. What am I
doing wrong?
Re: Beginniner help with PHP and Flash SimonTheSwift
11/17/2005 11:38:42 AM
Hi there,

first, let me ask you a question: Are you using a book called Foundation PHP5
for Flash? Well it doesn't really matter, just that your example is exactly the
same as in the book.

Your code seems flawless, so I would guess the problem is with the server.
Make sure your server is running. The book I mantioned above uses Apache. You
should make sure it is started. Then, if that is not the case, check your
configuration files, both for Apache and for PHP. Make sure your Flash movie
file is actually in the server-root directory (the one you set as localhost in
the Apache config. file).

Another thing is, if you really are using the book, and you followed it to all
the details it suggests, then your URL parameter in the load() method should be
http://localhost/phpflash/ch02/date.php.


Good luck,

Simon.
Re: Beginniner help with PHP and Flash Motion Maker
11/17/2005 6:16:25 PM
onLoad event assignment should precede the load method.

var getDate:LoadVars = new LoadVars();
getDate.onLoad = function() {
theDate_txt.text = this.theDate;
};

getDate.load("http://localhost/phpflash/date.php");



--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Hey everyone,

I'm trying to test out integrating PHP with Flash by creating a Flash
document
that simply states the current date (information which is transferred from a
PHP document). My flash file just contains one dynamic text box with the
instance name "theDate_txt." The actions under the actions layer has the
following actionscript:

var dateDisplay:TextFormat = new TextFormat();
dateDisplay.font = "Georgia,Times,_serif";
theDate_txt.setNewTextFormat(dateDisplay);
theDate_txt.autosize = "left";

var getDate:LoadVars = new LoadVars();
getDate.load("http://localhost/phpflash/date.php");
getDate.onLoad = function() {
theDate_txt.text = this.theDate;
};

The "date.php" file has the following and is placed properly in the
phpflash
folder...

<?php
echo 'theDate='.urlencode(date('l, F jS, Y'));
?>

When I test the flash movie, no date comes up and it's simply blank. What
am I
doing wrong?

Re: Beginniner help with PHP and Flash eddyyanto
12/29/2005 4:11:15 PM
i've tested your code by copying and pasting into flash & php, and it works
perfectly, if you are using apache web server in ms. windows the put all your
file in htdocs folder and try to open those file in the web browser by
typing-in http://localhost/date.swf. if you are not sure whether your webserver
is working or not then create a info.php file. put phpinfo(); into that file
and access that file in the web browser, just type "localhost/info.php", and
hopefully it'll work
Re: Beginniner help with PHP and Flash ElijahRock
1/1/2006 8:43:17 PM
Here's a tip from someone who only recently began working with the php/flash
combo, so take it for what it's worth... download and install WAMP. (or LAMP
if you're running Linux). I've found it's been invaluable for my purposes.
And it keeps life simple when I move the application from one developing
machine to another.
http://www.wampserver.com/en/index.php
It takes care of all the dirty work with Apache and PHP for you and comes with
various utilities for administering your server. It also includes a MySQL
server if ever you become interesting in using a database with PHP.

Happy new year.
AddThis Social Bookmark Button