squiggles121
Technical User
Hiya
I'm making a website for kids and on the profile page there is a character that you can change the clothes of (there is a Flash movie clip for Hats, Eyes, Hair etc. with a nextFrame and prevFrame arrow to change the colour of the items respectively).
I need to connect this in PHP to a database so that you can save the clothes that the user picks (or the current frame of each movie clip)and this is then saved as their profile picture.
As it stands, I have created a variable on each frame of say the hatColour movie clip to set a variable (frame 1 hatColour="red"; frame 2 hatColour="blue" and so on)
The Actions layer on the main timeline then has
There are then 2 PHP files; one to save the animation (save_vars.php) and one to load it back (load_vars.php) with the swf file on edit.php.
I could post the code but this post is getting really long already! Basically save_vars.php connects to the database, ensures the user is logged in and then has the code:
to update the user's profile in the database.
When run and the user hits the save button it says failed (as it has gone to frame 3 of the swf) and the database is not updated.
Any thoughts would be much appreciated as I've lost lots of sleep over this!
I'm making a website for kids and on the profile page there is a character that you can change the clothes of (there is a Flash movie clip for Hats, Eyes, Hair etc. with a nextFrame and prevFrame arrow to change the colour of the items respectively).
I need to connect this in PHP to a database so that you can save the clothes that the user picks (or the current frame of each movie clip)and this is then saved as their profile picture.
As it stands, I have created a variable on each frame of say the hatColour movie clip to set a variable (frame 1 hatColour="red"; frame 2 hatColour="blue" and so on)
The Actions layer on the main timeline then has
Code:
var hatColour:String ="";
vars = new LoadVars();
save_check = new LoadVars();
save_btn.onRelease = function(){
vars.hatColour=hatColour;
save_check.onLoad=function(){
if(this.response == "passed"){
_root.gotoAndStop(2);
}else{
_root.gotoAndStop(3);
}
}
vars.sendAndLoad("save_vars.php", save_check, "POST");
};
There are then 2 PHP files; one to save the animation (save_vars.php) and one to load it back (load_vars.php) with the swf file on edit.php.
I could post the code but this post is getting really long already! Basically save_vars.php connects to the database, ensures the user is logged in and then has the code:
Code:
<?php
$name = $_POST["name"];
$hatColour = $_POST["hatColour"];
mysql_select_db($database_db, $db);
$insert = "UPDATE users SET ( HatColour='".$hatColour."') WHERE Name='".$UserName."'";
mysql_query($insert,$db)or die(mysql_error());
echo "response=passed";
?><?php
mysql_free_result($Recordset1);
?>
to update the user's profile in the database.
When run and the user hits the save button it says failed (as it has gone to frame 3 of the swf) and the database is not updated.
Any thoughts would be much appreciated as I've lost lots of sleep over this!