Groups | Blog | Home
all groups > flash actionscript > april 2006 >

flash actionscript : Basic help using Flash, PHP, and mySQL



adamwissing
4/4/2006 8:35:29 PM
Hello,

So we had a small file management site created in PHP and mySQL that I'm
redesigning. The entire site is coded and working already, but I'd like to take
parts of it and put it into flash.

For instance, on the top of one page there is a simple echo statement that
lists the project name. The line of code is attached at the bottom.

I would like to make a small (maybe 400x20) flash file that displays this name
with a little animation. I setup a dynamic text box and the animation is made,
just not sure how exactly to get the Flash file to pull this data from the
database and display it.

Sorry for the very novice nature of the post, but any help would be very
appreciated.

Thanks!

<?php echo $projectrow['projectname']; ?>
Kagada
4/4/2006 8:42:58 PM
You can do it:

mylv:LoadVars = new LoadVars();
mylv._parent = this;
mylv.load("php_site.php ");
mylv.onData(success){
if(success){
_parent.my_dinamyctextbox.tex = this.projectname ;
}
}

and your php_site.php contains this code:
<? php
echo("&projectname=ThisIsMyProjectName");
?>

Your flash movie willget the output of php and load the variable projectname
inside of the LoadVars Objact
adamwissing
4/4/2006 8:55:23 PM
Kagada: thanks for the quick reply. More really basic questions:

1) where do I just the code? As just a keyframe in an action layer?
2) is the "http://php_site.php" the page that all this is happening on?
3) is the _parent.my_dinamyctextbox.tex suppose to be
_parent.my_dynamictextbox.tex ?
4) what do i name the dynamic text box in the Flash file? Instance? Variable?

Thanks again,

Adam

Kagada
4/4/2006 9:05:09 PM
1) where do I just the code? As just a keyframe in an action layer?
In the main timeline in a keyframe where your dinamic Text box is localized

2) is the "http://php_site.php" the page that all this is happening on?

No, Its a php page which only displays this output. For security questions it
must be in the same domain of the swf file.

3) is the _parent.my_dinamyctextbox.tex suppose to be
_parent.my_dynamictextbox.tex ?

Huh... its my mistake... the correct is _parent.my_dynamictextbox.text,
my_dinamictextbox is the instance name of your dinamic tex box, you can set
this name in properties tab

4) what do i name the dynamic text box in the Flash file? Instance? Variable?

For this script is "my_dinamictexbox", if you change the name you must change
the name in the script too.
AddThis Social Bookmark Button