RubyS
July 20, 2004, 11:55am
1
Hi,
Being a novice user of PHP and Flash I have no idea about where I am going wrong! :-/
I want to pass a PHP variable to load in a dynamic movie clip.
E.g I want to pass a user name from a postgress database to appear in the .swf file when loaded.
My PHP code is:
// ($myrowUN[0]) being the result of my query
$sendUserName = $myrowUN[0];
echo “&sendUserName=$sendUserName”;
My ActionScript code is:
// Placed in the movieclip
onClipEvent (load) {
GetUserName = new LoadVars();
GetUserName = function(success){
if(success){
this.sendUserName
}
else {
trace(“Sorry, Error logging your New Password”);
}
}
GetUserName.load(“Newpassword2.php ”);
}
Any help would be much appreciated!
system
July 20, 2004, 11:57am
2
Try this
onClipEvent (load) {
GetUserName = new LoadVars();
GetUserName.onLoad = function (success) {
if (success) {
trace(this.sendUserName);
} else {
trace("Sorry, Error logging your New Password");
}
};
GetUserName.load("Newpassword2.php");
}
system
July 20, 2004, 12:54pm
3
Voetsjoeba,
Thanks for the quick reply!
I tried that code but it didn’t work :-(!!!
Boooooo!
I’m positive that I am nearly there now though!!!..
system
July 20, 2004, 1:18pm
4
Worked for me … can you show me your files ?
system
July 21, 2004, 9:07am
5
Messed around with the code a little more yesterday and seem to have got it working with the following code:
PHP:
$sendUserName = $myrowUN[0];
echo “&sendUserName=”.$sendUserName;
Actionscript:
GetUserName = new LoadVars();
GetUserName.onLoad = function (success){
if (success){
UN = this.sendUserName;
}
else{
trace(“wrong”);
}
}
GetUserName.load(“NewPassword2.php”);
Thank’s a lot for your help - much appreciated!