Php + Flash , Using New LoadVars()
hello~ php code: for ($i=0;$i<$sql_row;$i++) { echo "question$i=".mssql_result($sql_query, $i, "questionName")."&"; echo "answer".$i."1=".mssql_result($sql_query, $i, "answer1")."&"; echo "answer".$i."2=".mssql_result($sql_query, $i, "answer2")."&"; echo "answer".$i."3=".mssql_result($sql_query, $i, "answer3")."&"; }
flash code: for (a=0; a<=this.total; a++) { _root.test2 = this.question1; //case 1 _root.test = this["question"+a]; //case 2 _root.test1 = eval("this.question" add a); //case 3 }
in case 1, _root.test2 displays value. the value is right. and the value should be 1+1=?, but it dislays 1 1=?...dont know why.....how can it appears +?
in case 2 and 3, they have no any value.. just empty.. sth missing to code? thanks....
thanks for help
Tek-Tips > Adobe(Macromedia): Flash Forum
Posted on: 25 Jul 04 15:51
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Preloading Loadvars + Code That Uses The Loadvars
Hey everyone
I can't find out how to do this.
I have a main file with a menu. When a menu button is pressed, and external SWF with the corresponding page is loaded into a container in the main movie. I use the MovieCliploader for this
In all my external files, I have a loadVars that gets XML-output from a PHP-file. In the onLoad handler, I have a buildPage() function that takes the variables and e.g. builds a news page and so on.
My question is how I make a preloader that preloads the loadVars + all the code inside my buildPage function? I mean - on big preloader for it all?
I guess it cannot be done with my moviecliploader inside my main movie?
thanx - Rune
Help LoadVars.send Vs. LoadVars.sendAndLoad
OK, my understanding is that if example 1 works so too should example 2:
Example 1:var my_lv:LoadVars = new LoadVars();
my_lv.overall_score = _root.overall_score;
my_lv.send("score.php", _blank, "GET");
Example 2:var my_lv:LoadVars = new LoadVars();
my_lv.overall_score = _root.overall_score;
my_lv.sendAndLoad("score.php", result_lv, "GET");
My understanding is however clearly wrong as example 1 will pass the variable quite happily to my php script which will update appropriately. In example 2, nothing. Nada. Variables aren't availabe to php and (therefore unsurprisingly) my_lv.onload isn't picking up any return.
Where am I going wrong this time?!
Cheers,
Andrew
[AS1][loadVars] Scope Trouble With LoadVars
Hi everybody,
I'm new on this server !
Is there a way to attach a file to my thread ?
You would find enclosed a ".zip" file in wich there's a ".fla" file, a ".txt" file and 6 ".jpg" images.
Frame 1 of the FLA only has a "Preload" class/constructor found on another site and works well.
Frame 2 launches the graphic interface construction.
The file "externalVar.txt" has one variable "maxVin" with a value of 6.
I would like to know WHY i can't acces this variable from outside of the loadVars object's scope (i would better say from outside of its ".onLoad" methode scope).
In fact, when i trace my variable "maxVinNum" from outside of this function, flash player return "undefined". Even if i declare "maxVinNum" on the _root (_root.maxVinNum).
For information, at the start of frame 2, i have let an instruction in comment :
//var maxVinNum = 6;
When we activate this instruction, then the variable is directely declared and everything works well. This test allow us to verify that scripts are not bugged.
Here is the script of frame 2, some of you may understand quickly what's wrong :
//var maxVinNum = 6;
var vignetteVars = new LoadVars();
vignetteVars.onLoad = function(ok) {
if (ok) {
trace(this.loaded);
maxVinNum = this.maxVin;
trace("maxVinNum = " + maxVinNum);
}
};
vignetteVars.load("externalVar.txt");
//
function buildArray (arrayLength) {
FileArray = new Array();
for (var i=0; i<maxVinNum; i++){
FileArray.push ("v_"+(i+1)+".jpg");
}
trace("FileArray : " + FileArray);
};
//
function buildSlide(){
vinKern = 1;
preloadSlide = new Preloader(load_indicator);
for (var i=0;i<FileArray.length;i++){
//Construction du slide
slide.vignette.duplicateMovieClip("vignette"+i,i);
slide["vignette"+i]._x += i*(slide.vignette._width + vinKern);
// ajoute à la file du preloader
preloadSlide.insert(FileArray[i], this.slide["vignette"+i].conteneur, i,"","","okload");
}
slide.vignette._visible=0;
};
buildArray(maxVinNum);
buildSlide()
stop();
I hope my english is not too bad, and my explaination not too long and understable.
thanks a lot for your help !
LoadVars.send VS LoadVars.sendAndLoad
Last edited by gkcohen : 2004-04-23 at 09:19.
can someone tell me what the difference is with these two. here is my problem. i am trying to submit some info to php script. i have my variables in text file.
if if loadVars.load("textFile.txt");
and then say loadVars.send(url, "_blank", "post") then it will work. but i dont want to load the resulting php page outside of flash. if instead i do loadVards.sendAndLoad(url, dataReceiver, "post") then it will not work. my dataReceiver will return blank, or i will get an error that the variables were not sent.
i guess that you cant loadVar from a text file and then use it with sendAndLoad, is that right?
the reason for using the text file is the real problem. the php script requires a variable 'group_ids[]' with an integer for a value. apparently, flash cant read the variable with the '[]' in it. i have tried different ways to get it formatted, but it wont work. i tried do something like loadVars.group_ids + "[]" = 1 but i get message stating the the object to the left of the operand must be a variable.
my only fix was to use a text file to load this variable. it works, but only when using the send and having a php srcipt popup.
i am not too familiar with php to modify the scipt, and i think that variable needs to be an array.
i dont know what else to do. HELP
gkc
[AS1][loadVars] Scope Trouble With LoadVars
Hi everybody,
I'm new on this server !
Is there a way to attach a file to my thread ?
You would find enclosed a ".zip" file in wich there's a ".fla" file, a ".txt" file and 6 ".jpg" images.
Frame 1 of the FLA only has a "Preload" class/constructor found on another site and works well.
Frame 2 launches the graphic interface construction.
The file "externalVar.txt" has one variable "maxVin" with a value of 6.
I would like to know WHY i can't acces this variable from outside of the loadVars object's scope (i would better say from outside of its ".onLoad" methode scope).
In fact, when i trace my variable "maxVinNum" from outside of this function, flash player return "undefined". Even if i declare "maxVinNum" on the _root (_root.maxVinNum).
For information, at the start of frame 2, i have let an instruction in comment :
//var maxVinNum = 6;
When we activate this instruction, then the variable is directely declared and everything works well. This test allow us to verify that scripts are not bugged.
Here is the script of frame 2, some of you may understand quickly what's wrong :
//var maxVinNum = 6;
var vignetteVars = new LoadVars();
vignetteVars.onLoad = function(ok) {
if (ok) {
trace(this.loaded);
maxVinNum = this.maxVin;
trace("maxVinNum = " + maxVinNum);
}
};
vignetteVars.load("externalVar.txt");
//
function buildArray (arrayLength) {
FileArray = new Array();
for (var i=0; i<maxVinNum; i++){
FileArray.push ("v_"+(i+1)+".jpg");
}
trace("FileArray : " + FileArray);
};
//
function buildSlide(){
vinKern = 1;
preloadSlide = new Preloader(load_indicator);
for (var i=0;i<FileArray.length;i++){
//Construction du slide
slide.vignette.duplicateMovieClip("vignette"+i,i);
slide["vignette"+i]._x += i*(slide.vignette._width + vinKern);
// ajoute à la file du preloader
preloadSlide.insert(FileArray[i], this.slide["vignette"+i].conteneur, i,"","","okload");
}
slide.vignette._visible=0;
};
buildArray(maxVinNum);
buildSlide()
stop();
I hope my english is not too bad, and my explaination not too long and understandable.
thanks a lot for your help !
Flash Loadvars.
Hey guys,
Can anyone tell me why an swf file is incapable of loading variables outside of its own directory using loadVariables().
appreciate.
Flash - PHP.. LoadVars Or XML
apologies if this has been asked many times, or I am posting in the wrong place...
I'm writing a Flash MX chat/forum type application that gets / stores data via PHP and MySQL. I've developed the front end and now have to get the back end working. However, I'm not sure if loadVars is up to the task. I reckon it isn't, as a resultset can contain an unknown sized set of records, possibly quite large, and records have several fields of varying formats. Is there a practical limitation on data size returned by loadVars as opposed to loading XML?
All the Flash - PHP examples I've seen on the web use loadVars or for Flash 5 style loadvVariables(), but they usually only retrieve one piece of data containing two fields. So am I right to assume loadVars wont be up to processing a database query resultset?
If that is true, then my PHP is going to have to construct an XML document from the resultset, and send that back to Flash. Can anyone point me to any online learning resources on how to do this (PHP querying a database and producing XML), or just just say whether I'm going in the right direction
with this?
Any help gratefully received
thanks
Graham P
Flash & Loadvars? PLEASE Take A Look
hey guys,
i am building a database flash movie and have encountered one problem. my flahs movie doens't seem to be behaving right.
I am using php and mySQL to add data. I was using a basic html page to do this but wanted to go to flash for the looks. I have made flash movies that do this and use the load vars FOR SOME REASON THIS DOESN'T WORK!!
I have included all my files in the zip file including the php scripts and mysql dump, anything that can help. I know the php works fine cause i tested it through html.
the flash movie for some reason lets me put in the info and when i hit add doesn't go to the success page but just loops bakc round to the form again..........adding the data to the database bypassing all the php form checks.....
IT'S insane i don't knwo what's going wrong!!!
thanks for any thougth or any input.......maybe i am just fried.
Flash MX LoadVars
Hello All,
I am having some trouble figuring out what I am missing when I use loadvars to get values from asp. I can get the first two values to display but the third value in the asp generated text page does not show. What is more confusing is hardcoding that third value doesn't seem to make a difference either.
Here is the code in question:
ASPtoMX_LoadVars = new LoadVars();
MXtoASP_LoadVars = new LoadVars();
MXtoASP_LoadVars.sendAndLoad("http://www.meadowlakerealestate.com/slideshow.asp", ASPtoMX_LoadVars, "Post");
ASPtoMX_LoadVars.onload = AssignASPVariable;
function AssignASPVariable(success)
{
if(success)
{
set ("TotalPropertyCount", ASPtoMX_LoadVars.TotalPropertyCount);
set ("Phrase", ASPtoMX_LoadVars.Phrase);
set ("Property1Price", ASPtoMX_LoadVars.Property1Price);
//set ("PropertyAddress", ASPtoMX_LoadVars.PropertyAddress);
//set ("PropertyListNumber", ASPtoMX_LoadVars.PropertyListNumber);
//set ("varNumPropGroups", ASPtoMX_LoadVars.varNumPropGroups);
//set ("varNumGroupImg", ASPtoMX_LoadVars.varNumGroupImg);
//set ("varPropImage", ASPtoMX_LoadVars.varPropImage);
//set ("ImageDesc", ASPtoMX_LoadVars.ImageDesc);
}
}
The first 2 values TotalPropertyCount and Phrase both display in the movie but the third value Property1Price does not? I have checked the basics and yes the var for the Dynamic text matches the Property1Price etc.
Any ideas would be greatly appreciated. I am a very experienced programmer but not familiar with Flash to a great degree. I learned of the loadvars usuage from the internet so its very possible I missed some tidbit that makes the difference to what I am trying to do.
Thanks again for the help / input
Loadvars <-> Flash Php
I am loading variables from flash, changing one of the variables and then trying to send it back to the php script to have it write to a txt file.
Code:
phpvar.load("http://www.whyworkforever.org/test/test.php?Read");
phpvar.onLoad=function(){
var a=phpvar.aNum;
var b=phpvar.bNum;
var c=phpvar.cNum;
var d=phpvar.dNum;
var aL=phpvar.aLabel;
var bL=phpvar.bLabel;
var cL=phpvar.cLabel;
var dL=phpvar.dLabel;
phpvar.aNum=(Number(a)+1);
trace(phpvar.aNum);
phpvar.send("http://www.whyworkforever.org/test/test.php?WriteToFile",_"blank","POST");
}
Ok...so what that does is ask the php script to read the variables from the text file I have and it splits them up into separate variables in flash. I change one, aNum, and then I try to send it to my WriteToFile function to write the new string into the text file.
WriteToFile Code:
Code:
function writeToFile($aNum,$bNum,$cNum, $dNum,$numVotes,$aLabel,$bLabel,$cLabel,$dLabel,$ttl){
$filename = "/home/content/w/h/y/whyworkforever/html/test/test.txt";
$file = fopen($filename, "w");
fwrite($file,"aNum=".$aNum."&bNum=".$bNum."&cNum=".$cNum."&dNum=".$dNum."&numVotes=".$numVotes."&aLabel=".$aLabel."&bLabel=".$bLabel."&cLabel=".$cLabel."&dLabel=".$dLabel."&ttl=".$ttl);
fclose($file);
}
?>
I've tried a couple of variations, loadVariables instead of send...I have been doing research all day on how and why and what to do to get information to transfer between php and flash, and I am almost done, except the last part...getting the information back from flash to the php and the php to write to the txt, I might as well clear the txt and rewrite everything since I am sending all of the variables to the php script...
Thanks in advance!
-TJ
Help With Flash/php/loadvars
Hi, I'm having a strange problem that maybe someone else has come across. I am sending some variables to a flash file using a php script and loadvars.
This is my php script:
Code:
<?php
include ("includes/connection.php");
$entryID = 123;
$entriesQuery = "SELECT * FROM Entry WHERE ID = '$entryID'";
$entriesResult = mysql_query($entriesQuery);
$entry = mysql_fetch_array($entriesResult);
$entryRefNum = (string) $entry['entryRefNumber'];
$returnVars = "&filePath=".$entryRefNum."&";
echo $returnVars;
?>
And this is my actionscript:
Code:
var lvGetEntry = new LoadVars();
lvGetEntry.sendAndLoad("playEntry.php",lvGetEntry,"POST");
lvGetEntry.onLoad = function( success ){
var filePath = "mp3s/"+this.filePath+".mp3";
thePlayer.setMedia(filePath, "MP3");
thePlayer.play();
}
The idea is that the php file sends the name of an mp3 file to flash and flash then plays the file..
This works if I hard code in the name of the mp3 file in the php script:
i.e.
$returnVars = "&filePath=somefile&";
but not if i use what is read in from the database like this
$returnVars = "&filePath=".$entryRefNum."&";
to me they look identical but some how the second one above doesnt work - nothing gets passed to the flash file.
Any help is greatly appreciated - this is driving me mad!
Loadvars <-> Flash Php
I am loading variables from flash, changing one of the variables and then trying to send it back to the php script to have it write to a txt file.
Code:
phpvar.load("http://www.whyworkforever.org/test/test.php?Read");
phpvar.onLoad=function(){
var a=phpvar.aNum;
var b=phpvar.bNum;
var c=phpvar.cNum;
var d=phpvar.dNum;
var aL=phpvar.aLabel;
var bL=phpvar.bLabel;
var cL=phpvar.cLabel;
var dL=phpvar.dLabel;
phpvar.aNum=(Number(a)+1);
trace(phpvar.aNum);
phpvar.send("http://www.whyworkforever.org/test/test.php?WriteToFile",_"blank","POST");
}
Ok...so what that does is ask the php script to read the variables from the text file I have and it splits them up into separate variables in flash. I change one, aNum, and then I try to send it to my WriteToFile function to write the new string into the text file.
WriteToFile Code:
Code:
function writeToFile($aNum,$bNum,$cNum, $dNum,$numVotes,$aLabel,$bLabel,$cLabel,$dLabel,$ttl){
$filename = "/home/content/w/h/y/whyworkforever/html/test/test.txt";
$file = fopen($filename, "w");
fwrite($file,"aNum=".$aNum."&bNum=".$bNum."&cNum=".$cNum."&dNum=".$dNum."&numVotes=".$numVotes."&aLabel=".$aLabel."&bLabel=".$bLabel."&cLabel=".$cLabel."&dLabel=".$dLabel."&ttl=".$ttl);
fclose($file);
}
?>
I've tried a couple of variations, loadVariables instead of send...I have been doing research all day on how and why and what to do to get information to transfer between php and flash, and I am almost done, except the last part...getting the information back from flash to the php and the php to write to the txt, I might as well clear the txt and rewrite everything since I am sending all of the variables to the php script...
Thanks in advance!
-TJ
LoadVars Flash & PHP
Hi,
Can anyone tell me how to use the loadVars to pass a string from a text field to PHP script? The URL of the script is:
http://www.deutschesfachbuch.de/info...tskin&keyword=
What i need to do is tell this script somehow that ...keyword= "my string here"
I have this code in the first frame of the timeline:
startsearch.onRelease = function () {
var mySend_lv:LoadVars = new LoadVars();
mySend_lv.message = output.text;
mySend_lv.send("http://www.deutschesfachbuch.de/info/news.php?type=skin&code=defaultskin&keyword=", "_self", "POST");
}
I've made the startsearch button as movieclip.
Thanks in advance!
Nixx
Flash 8 - LoadVars Help Please
I am new to forums so I hope I give enough info for someone to help me out. I have been having issues with the LoadVars command. It seems easy enough yet I cannot seem to get it to do what I want.
I am trying to assign a variable (count) equal to the number referenced from an external text file called Count.txt. The only text inside the file is the following:
totalFrames=3
The Flash code is the following:
var slideInfoLV:LoadVars = new LoadVars();
var count:Number = 0;
slideInfoLV.onLoad = function(success:Boolean) {
if (success) {
count = slideInfoLV.totalFrames;
trace(count);
}
}
slideInfoLV.load("splash/Count.txt");
trace(count);
Now here is the weird part... You will notice that there are two "traces". The output for those is the following:
0
3
Flash reads the file and outputs the correct count from INSIDE the onload function (which outputs second for some reason) but when you trace the the variable from outside the function, it returns the initial setting of "0".
First question, how do I get the variable count to keep the value of "3" from the external text file. Second question, why is flash outputting the values in the opposite order that I would predict, in essence, why is the second trace outputted first? I thought that flash would output from top to bottom order of code.
Sorry for the long description. Any help would be great.
Thanks!
FLASH 8 & PHP - LoadVars
It's an email form that worked perfectly for years. All of a sudden it does not pass the variables to the php script anymore.
Going nuts..
Attached the source.
Any ideas you guys?
http://www.totolici.com
Flash+Php+txt+ Loadvars = Problem
I am trying to learn how to use flash with php and i finally managed to get loadvars to sent variables to and from a flash file to a php file, and had the save to a text file.
But now i want to format the strings using simple html tags. basically i want each value to be on a new line. Each time i send a new variable to php ".:-:." is added to it before it is saved to the text file. I can't figure out how to replace ".:-:." with <br>
LoadVars Object In Flash MX Ver 6.0
I am trying to read a simple text file into Flash MX Ver6.0 using LoadVars(); and I just can't get it to work. I have tried all the tutorials I can find and searched high and low. All the demos I try just don't seem to work.
According to the manual you can create a text file myfile.txt
name=John&age=25&wife=Kelly
then use actionscript
myData = new LoadVars();
myData.load("http://www.myDomain.com/myfile.txt");
Once this loads you are supposed to have access to the variables
myData.name
myData.age
myData.wife
Has anyone got this to work or have another way of getting these variables into flash MX?
Thanks for your help
very frustrated
The attached zip file contains a flash movie that loads an array of jpg names and then displays them randomly. If you comment out the first two lines of code and uncomment the third line, the file works from the array built in actionscript - this works. If you uncomment the first two lines and comment out the third line then the array is loaded from a text file as documented above - but it doesn't work. ahhhhhh !
LoadVars - Is It Me Or Flash MX That Is Dumb?
Hi,
Please tell me why I cannot access a value loaded by loadVars outside the loadVars function:
-----------------------------------------------
var myTextValue
myData = new LoadVars();
myData.load("theNews.txt");
myData.onLoad = function(){
trace(myData.Title); (works fine)
myTextValue = myData.Title;
}
//I NEED TO ACCESS THE VALUE HERE, WHY CANNOT I NOT?
aTextField.Text = myTextValue (this comes out as undefined)
-------------------------------------------------
How is loadVars useful if I cannot access the varibles with flash outside the onLoad function?
PLEASE post examples if possible.
I know that my text file is fine as I can trace myData(Title)
Thanks
Rich
Problem With LoadVars, PHP And Flash
I have a SWF file inside of a PHP file(myFile.php). What I want to do is to type in:
"myFile.php?Var_x=value"
and the SWF will read in Var_x and populate a dynamic text box.
My problem is that even if the PHP is echoing "&myVar=1&" or "&myVar=2&", the Flash variable is always being set to 3.
Any help would be appreciated....
Here is my PHP code:
PHP Code:
<?php
$Var1 = $_GET["Var_x"];
if ($Var1 == 1) {
$Var2 = 1;
} else if ($Var1 == 2) {
$Var2 = 2;
} else {
$Var2 = 3;
}
$vars = $Var2;
echo ("&myVar=".$vars."&");
?>
<html>
<body>
// Here is where my SWF is embedded
</body>
</html>
Here is my Flash AS:
code:
/* first create a new instance of the LoadVars object */
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("myFile.php");
// once vars have been loaded, we will have these variables:
myVars.onLoad = function( success ){
if(success){
_root.myVar = myVars.myVar;
trace("variables loaded");
} else {
trace("Error loading page");
}
}
stop();
Flash And PHP Problem, LoadVars
Hey guys,
Im working on a flash + php contact form that has a list of countries down one side of the stage and when the country is clicked it updates a variable called "country" that is defined in the root of the movie with that countries email address, like this:
on (release){
_root.country = "countryname@countrydomain.com";
trace(_root.country);
}
When the movie is tested this trace's as it should when the button is clicked.
Now onto the problem, I am using the code from cyanblue's flash contact form tutoriual on flashvaccum except i have customized it slightly to add another field and to make the email address to which the php sends change depending on which country is selected. This is the code on the _root of my flash movie that is used to send the data to php.
Code:
#include "lmc_tween.as"
var country = "";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
stop();
init();
function init()
{
this.info_mc.stop();
this.send_btn._focusrect = false;
this.clear_btn._focusrect = false;
this.name_txt.tabIndex = 1;
this.age_txt.tabIndex = 3;
this.email_txt.tabIndex = 2;
this.message_txt.tabIndex = 4;
this.send_btn.tabIndex = 5;
this.clear_btn.tabIndex = 6;
this.name_txt.text = "";
this.age_txt.text = "";
this.email_txt.text = "";
this.message_txt.text = "";
setTextFocus(this.name_txt);
}
function setTextFocus(tf)
{
Selection.setFocus(tf);
}
this.send_btn.onPress = function ()
{
validateForm();
}
this.clear_btn.onPress = function ()
{
init();
}
function validateForm()
{
if ((age_txt.text.isset()) && (name_txt.text != "Required Field"))
{
if ((name_txt.text.isset()) && (name_txt.text != "Required Field"))
{
if ((email_txt.text.isset()) && (email_txt.text.isEmail()) && (email_txt.text != "Required Field"))
{
trace("email_txt.text.isEmail() = " + email_txt.text.isEmail());
if ((message_txt.text.isset()) && (message_txt.text != "Required Field"))
{
info_mc.alphaTo(100,.5,"easeoutCirc");
info_mc.alphaTo(0,.5,"easeoutCirc",5);
sendEmail();
}
else
{
message_txt.text = "Required Field";
setTextFocus(message_txt);
}
}
else
{
email_txt.text = "Required Field";
setTextFocus(email_txt);
}
}
else
{
name_txt.text = "Required Field";
setTextFocus(name_txt);
}
}
else
{
age_txt.text = "Required Field";
setTextFocus(name_txt);
}
}
function sendEmail()
{
email_lv = new LoadVars();
email_lv.name = this.name_txt.text;
email_lv.age = this.age_txt.text;
email_lv.country = _root.country;
email_lv.email = this.email_txt.text;
email_lv.message = this.message_txt.text;
email_lv.onLoad = function (ok)
{
if (ok)
{
trace("Email Sent");
trace(unescape(this));
info_mc.gotoAndStop("Info" + this.result);
}
else
{
trace("Email unavailable at this time");
info_mc.gotoAndStop("Info2");
}
}
email_lv.sendAndLoad("mail.php", email_lv, "POST");
trace(email_lv);
}
The section i have highlighted in the bright blue is the part i think has the problem.
As you can see i have tried to add the variable "country" to the loadvars object. Mind you, when the movie is tested and the php echo's in the trace it shows that the country email is posting to the php file.
Now finally my PHP file
PHP Code:
<?php
if ($_POST)
{
$mailTo = "$_POST['country'];
$mailSubject = "Website Contact from " . $_POST['name'] . "";
$Header = "MIME-Version: 1.0rn";
$Header .= "Content-type: text/html; charset=iso-8859-1rn";
$Header .= "From: " . $_POST['email'] . "rn";
$output = "<BR>";
$output .= "From : " . $_POST['name'] . "<BR><BR>";
$output .= "Age : " . $_POST['age'] . "<BR><BR>";
$output .= "Email : " . $_POST['email'] . "<BR><BR>";
$output .= "Message : " . $_POST['message'] . "<BR><BR>";
$output = nl2br($output);
if (mail($mailTo, $mailSubject, stripslashes($output), $Header))
{
echo("&result=1&");
}
else
{
echo("&result=2&");
}
}
else
{
echo("This script runs only in Flash!!!");
}
?>
When i test this form in flash the trace seems correct this is what i get for the echo
echo("&onLoad=[type Function]&message=Testing form&email=testemail@testmail.com&address=recipien t@hotmail.com&age=22&name=Testname
But i never recieve the email when i test it on the server.
I have tried everything i can think of to fix this problem and i don't think the solution is something too advanced, I think i am just overlooking something.
Id really appreciate some help with this.
You can view the source files for all this at http://www.zendurl.com/jarradfo/contact.zip
Thankyou
Flash LoadVars Issue...
Hey guys,
I have been working on an ecard type thing for awhile now and keep running into roadblocks. If anyone could help me out that would be great.
i have the information hosted on my server in the ./dBText/ directory under a session ID name (123456789.txt, etc. its different everytime so i have it set in the php to be the variable $EcardText.
Here is my script that is running from my flash file that i am trying to COLLECT the information for...
myData = new LoadVars();
myData.load("./dBText/"+EcardText+".txt");
myData.onLoad = function(success) {
if (success) {
FromName.text = this.FromName;
FromNumber.text = this.FromNumber;
} else { trace("Error loading data");
}
};
I used the Charles debugging software and saw that it running the flash file right but instead of looking for the session_id.txt it is looking for undefined.txt.
any suggestions?
Thanks
Differences With LoadVars In Flash 8?
I am trying to load text from a text file using LoadVars. The text has HTML tags in it for formating, and I am assigning a CSS to it as well to ease some of the formating. Pretty standard. If I publish my flash project as Flash 8, LoadVars seems to pick up the carriage returns in the text file, and add those carriage returns to the HTML formating. The result is the loaded text with a lot of extra whitespace in it. If I then publish the same project as Flash 7, it works as I would expect and doesn't pick up the carriage returns in the text file.
What has changed in Flash 8 to cause this? Anyone know? Is there an easy way around this problem besides stripping out all the carriage returns in the text file? I would hate to do that since it makes maintaining the text files much more cumbersome.
Here is the code I am using for those that want to know:
var loadText:LoadVars = new LoadVars();
loadText.load("content.txt");
loadText.onLoad = function(success) {
if (success) {
content_txt.htmlText = this.contentText;
}
}
var contentStyle = new TextField.StyleSheet();
contentStyle.load("content.css");
content_txt.styleSheet = contentStyle;Any help or guidance would be appreciated.
Thank you.
Eric
LoadVars And PHP And Flash Versions
Alright guys and gals...I know there are TONS of posts similar to what I'm about to ask. I've looked through about 8 or 10 posts and everything I've seen doesn't address my problem.
I have a basic contact form in Flash...you can view it at http://daveydavecomedy.com/ and click on booking.
I have a php email script that handles it...and it does...but ONLY if I use a certain email address. It's really weird behavior.
Don't know why/how it works this way...but if I don't use "jason@froderman.com" in the php mail function, nothing happens. I've tried using my gmail account to no avail.
Additional information: jason@froderman.com is an email associated with a website on the same server that daveydavecomedy.com is...but dave@daveydavecomedy.com won't work (an email associated with the site and also on the same server)
Now you are thinking it's the php script or the webserver...if I access the php form directly...it works, every time. Even for different email addresses.
So I'm quite perplexed...has anyone observed similar behavior or know what to do?
I appreciate any and all help.
Here's the php script and the relevant LoadVars flash code in my fla:
PHP Code:
<?php
$name = $_POST['name'];
$organization = $_POST['organization'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$date = $_POST['date'];
$location = $_POST['location'];
$guests = $_POST['guests'];
$age = $_POST['age'];
mail("jason@froderman.com", "ONLINE BOOKING REQUEST :: DAVEYDAVECOMEDY.COM", "PERSONAL INFORMATION
Name: $name
Organization: $organization
Telephone: $telephone
Email: $email
EVENT INFORMATION
Date: $date
Location: $location
Number of Guests: $guests
Age Range: $age
", "From: PHPMailer
Reply-To: no_reply@daveydavecomedy.com
X-Mailer: PHP/" . phpversion());
?>
Code:
emailData = new LoadVars();
emailData.name = name.text;
emailData.organization = organization.text;
emailData.telephone = telephone.text;
emailData.email = email.text;
emailData.date = date.text;
emailData.location = location.text;
emailData.guests = guests.text;
emailData.age = age.text;
emailData.sendAndLoad("email_booking.php", emailData, "POST");
Thanks!
panhead490
Flash To PHP Using LoadVars.send
For the life of me, I've tried everything:
I've researched LoadVars on Adobe forum, used David Powers' books, googled 'flash to php', LoadVars, etc. and tried sendAndLoad, send, and using $_POST, $_GET, $_REQUEST. $HTTP_POSTVARS but I keep getting this same error. any advice please?
I have a Unix server running Apache/PHP 4 - LoadVars worked to load name-value pairs into an array -see thread)
My goal with this simple app is to prototype being able to pass a variable from flash to a variable in php.
Parse error: syntax error, unexpected T_VARIABLE in flash_to_SQL.php on line 5
Actionscript 2.0 code:
var c :LoadVars = new LoadVars();
c.testing = "123FOUR";
c.send ("
Flash MX/LoadVars/PHP Problem
ok... simple stuff here.. just basic Flash mailer stuff.... I am pretty much possitive all my code is correct, and I think the problem is that I have upgraded to MX and I am sending the vars using an old method... here is my submit button code:
PHP Code:
on (release) {
if (senderName == "" or senderComments == "") {
gotoAndStop(2);
} else {
lineAdapt();
loadVariablesNum("comments.php", 0, "POST");
gotoAndStop(3);
}
}
Line adapt calls a function that changes flash's carrier symbol (
) to one used in PHP (
) ....
I believe the problem is loadVariablesNum("comments.php", 0, "POST"); ... this worked in Flash 5, but do I have to change "loadVarsNum" for MX?????????????
Help would be appreciated!
Peace
[mx] Working With LoadVars From PHP, In Flash
I looked at the tutorial section to see how to get loadVars to load in data from PHP.
PHP code:
//do league queries
$query_mteam = "SELECT name FROM test ORDER BY name ASC";
$mteam = mysql_query($query_mteam) or die(mysql_error());
$row_mteam = mysql_fetch_assoc($mteam);
$num_rows = mysql_num_rows($mteam);
$message="hi there";
echo "&rows=".$num_rows;
Resulting code in flash:
loadText = new LoadVars();
loadText.load("test.php");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
totalBox.html = true;
totalBox.htmlText = this.rows;
var newrows=this.rows;
}
};
Now I added the extra line in bold as I need to be able to use the variable I have grabbed from my PHP file using the above code (the var is called rows) and I need to be able to use this figuree to do some simple math.. but I can't seem to get it to do anything apart from appear in text fields....
I want to be able to do:
row=row+5;
for example. In fact, I want to use the value of row to generate a certain number of buttons dynamically. This eventually will be a menu based on values from a database (mySQL and PHP) but I am stumbling at the first hurdle.
Any help here?
Flash + PHP LoadVars Array
Hi everyone one..I'm stuck. I want to load headlines that are linked to URL(s) into my flash movie where the dynamic txt box(tickertxt) is here:
_root.scroll.scrollbox.tickertxt
I am working along with my programmer and he built php page that says:
num=1&url1=ticker.php%3Fid%3D1&headline1=Test
here is my actionscript. I cannot get it work:
newsItems=new Array();
myVars = new LoadVars();
myVars.load("ticker.php?flash");
function () {
for (x=1; x<total;x++){
newsItems[x]=new Array();
var what="url"+x;
newsItems[x][0]=myVars.what;
what="headline"+x;
newsItems[x][0]=myVars.what;
}
for(x=1;x<total;x++){
newsItems[x][1]+"<a href=""+newsItems[x][0]+ "">Click here for more</a>";
}
}
What is wrong?? Flash shows no errors. Frustrated.
Any help??
FLASH PHP LoadVars Issue
Hi there,
I'm having an issues sending some vars to a php script. I've isolated the problem but I have no idea how to fix it...
The issue lies with the square brackets "[".
When I type the vars in the address of a browser it works fine. For example..
myscript.php?theVariant[size]=big
That works perfectly, the php script picks it up.
Now if I try to send that same info thru flash, it doesn't get thru. For example
ActionScript Code:
var myVars:LoadVars = new LoadVars();myVars.sendAndLoad('myscript.php?theVariant[size]=big', myVars, 'GET');
Isn't that exactly the same? Anyone got any ideas?
Thanks
[mx] Working With LoadVars From PHP, In Flash
I looked at the tutorial section to see how to get loadVars to load in data from PHP.
PHP code:
//do league queries
$query_mteam = "SELECT name FROM test ORDER BY name ASC";
$mteam = mysql_query($query_mteam) or die(mysql_error());
$row_mteam = mysql_fetch_assoc($mteam);
$num_rows = mysql_num_rows($mteam);
$message="hi there";
echo "&rows=".$num_rows;
Resulting code in flash:
loadText = new LoadVars();
loadText.load("test.php");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
totalBox.html = true;
totalBox.htmlText = this.rows;
var newrows=this.rows;
}
};
Now I added the extra line in bold as I need to be able to use the variable I have grabbed from my PHP file using the above code (the var is called rows) and I need to be able to use this figuree to do some simple math.. but I can't seem to get it to do anything apart from appear in text fields....
I want to be able to do:
row=row+5;
for example. In fact, I want to use the value of row to generate a certain number of buttons dynamically. This eventually will be a menu based on values from a database (mySQL and PHP) but I am stumbling at the first hurdle.
Any help here?
Flash + PHP LoadVars Array
Hi everyone one..I'm stuck. I want to load headlines that are linked to URL(s) into my flash movie where the dynamic txt box(tickertxt) is here:
_root.scroll.scrollbox.tickertxt
I am working along with my programmer and he built php page that says:
num=1&url1=ticker.php%3Fid%3D1&headline1=Test
here is my actionscript. I cannot get it work:
newsItems=new Array();
myVars = new LoadVars();
myVars.load("ticker.php?flash");
function () {
for (x=1; x<total;x++){
newsItems[x]=new Array();
var what="url"+x;
newsItems[x][0]=myVars.what;
what="headline"+x;
newsItems[x][0]=myVars.what;
}
for(x=1;x<total;x++){
newsItems[x][1]+"<a href=""+newsItems[x][0]+ "">Click here for more</a>";
}
}
What is wrong?? Flash shows no errors. Frustrated.
Any help??
Flash MX LoadVars Saving?
I can load my varibles into my project from a .txt file.
QUESTION:
I would like to make a change to a variable then save it back to the .txt file. Can this be done?
//I've tried:
oLv.var1 = "newValue" ;
oLv.send("vars.txt") ;
//But this doesn't seem to work
Any input or syntax would be much appreciated, thank you!
Flash And PHP Problem, LoadVars
Hey guys,
Im working on a flash + php contact form that has a list of countries down one side of the stage and when the country is clicked it updates a variable called "country" that is defined in the root of the movie with that countries email address, like this:
on (release){
_root.country = "countryname@countrydomain.com";
trace(_root.country);
}
When the movie is tested this trace's as it should when the button is clicked.
Now onto the problem, I am using the code from cyanblue's flash contact form tutoriual on flashvaccum except i have customized it slightly to add another field and to make the email address to which the php sends change depending on which country is selected. This is the code on the _root of my flash movie that is used to send the data to php.
#include "lmc_tween.as"
var country = "";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
stop();
init();
function init()
{
this.info_mc.stop();
this.send_btn._focusrect = false;
this.clear_btn._focusrect = false;
this.name_txt.tabIndex = 1;
this.age_txt.tabIndex = 3;
this.email_txt.tabIndex = 2;
this.message_txt.tabIndex = 4;
this.send_btn.tabIndex = 5;
this.clear_btn.tabIndex = 6;
this.name_txt.text = "";
this.age_txt.text = "";
this.email_txt.text = "";
this.message_txt.text = "";
setTextFocus(this.name_txt);
}
function setTextFocus(tf)
{
Selection.setFocus(tf);
}
this.send_btn.onPress = function ()
{
validateForm();
}
this.clear_btn.onPress = function ()
{
init();
}
function validateForm()
{
if ((age_txt.text.isset()) && (name_txt.text != "Required Field"))
{
if ((name_txt.text.isset()) && (name_txt.text != "Required Field"))
{
if ((email_txt.text.isset()) && (email_txt.text.isEmail()) && (email_txt.text != "Required Field"))
{
trace("email_txt.text.isEmail() = " + email_txt.text.isEmail());
if ((message_txt.text.isset()) && (message_txt.text != "Required Field"))
{
info_mc.alphaTo(100,.5,"easeoutCirc");
info_mc.alphaTo(0,.5,"easeoutCirc",5);
sendEmail();
}
else
{
message_txt.text = "Required Field";
setTextFocus(message_txt);
}
}
else
{
email_txt.text = "Required Field";
setTextFocus(email_txt);
}
}
else
{
name_txt.text = "Required Field";
setTextFocus(name_txt);
}
}
else
{
age_txt.text = "Required Field";
setTextFocus(name_txt);
}
}
function sendEmail()
{
email_lv = new LoadVars();
email_lv.name = this.name_txt.text;
email_lv.age = this.age_txt.text;
email_lv.country = _root.country;
email_lv.email = this.email_txt.text;
email_lv.message = this.message_txt.text;
email_lv.onLoad = function (ok)
{
if (ok)
{
trace("Email Sent");
trace(unescape(this));
info_mc.gotoAndStop("Info" + this.result);
}
else
{
trace("Email unavailable at this time");
info_mc.gotoAndStop("Info2");
}
}
email_lv.sendAndLoad("mail.php", email_lv, "POST");
trace(email_lv);
}
The section i have highlighted in the bright blue is the part i think has the problem.
As you can see i have tried to add the variable "country" to the loadvars object. Mind you, when the movie is tested and the php echo's in the trace it shows that the country email is posting to the php file.
Now finally my PHP file
<?php
if ($_POST)
{
$mailTo = "$_POST['country']";
$mailSubject = "Website Contact from " . $_POST['name'] . "";
$Header = "MIME-Version: 1.0
";
$Header .= "Content-type: text/html; charset=iso-8859-1
";
$Header .= "From: " . $_POST['email'] . "
";
$output = "<BR>";
$output .= "From : " . $_POST['name'] . "<BR><BR>";
$output .= "Age : " . $_POST['age'] . "<BR><BR>";
$output .= "Email : " . $_POST['email'] . "<BR><BR>";
$output .= "Message : " . $_POST['message'] . "<BR><BR>";
$output = nl2br($output);
if (mail($mailTo, $mailSubject, stripslashes($output), $Header))
{
echo("&result=1&");
}
else
{
echo("&result=2&");
}
}
else
{
echo("This script runs only in Flash!!!");
}
?>
I have tried everything i can think of to fix this problem and i don't think the solution is something too advanced, I think i am just overlooking something.
Id really appreciate some help with this.
Thankyou
[AS & PHP] Updating Flash With LoadVars
Hi Everyone,
Ive recently created a ranking chart that gives visitors to my site the ability to vote on pieces of my artwork. But Im having troubles getting it to update properly.
The PHP works fine, as does the interaction with flash, however, after updating my database flash occasionally doesnt reload the newest information. I believe this to be the way Im loading and sending information, but Im not sure of any other way to do it.
If anyone can take a look at my code and make some suggestions on how to get everything updating and loading at the right times, I would greatly appreciate it.
Thanks!
ActionScript Code:
// This goes in my timeline
stop();
var load_lv = new LoadVars();
load_lv.onLoad = function(success) {
if(success) {
_global.votes = int(this.votes);
_global.rating = int(this.rating);
_global.newRating=Math.round(rating/votes);
//trace("VOTES:"+votes+" / RATING:"+rating+" = NEWRATING:"+newRating)
nextFrame(); //shows the rank info instead of loading screen
}
}
load_lv.load("http://mypage.com/ranking.php", load_lv, "GET");
Between these steps is a slider bar that updates the value newRating
I didnt show the code because it doesnt really affect my problem.
ActionScript Code:
// this goes on the submit button
on(press) {
++_global.votes;
_global.rating=(rating+newRating);
//trace("UPDATED - VOTES:"+votes+" / RATING:"+rating+" = NEWRATING:"+newRating)
send_lv = new LoadVars();
send_lv.votes = _global.votes;
send_lv.rating = _global.rating;
send_lv.sendAndLoad("http://mypage.com/ranking.php", send_lv, "POST");
_root.prevFrame(); //goes back to loading screen which executes the code above
}
Problem With LoadVars, PHP And FLASH
I have a SWF file inside of a PHP file(myFile.php). What I want to do is to type in:
"myFile.php?Var_x=value"
and the SWF will read in Var_x and populate a dynamic text box.
My problem is that even if the PHP is echoing "&myVar=1&" or "&myVar=2&", the Flash variable is always being set to 3.
Any help would be appreciated....
Here is my PHP code:
PHP Code:
<?php
$Var1 = $_GET["Var_x"];
if ($Var1 == 1) {
$Var2 = 1;
} else if ($Var1 == 2) {
$Var2 = 2;
} else {
$Var2 = 3;
}
$vars = $Var2;
echo ("&myVar=".$vars."&");
?>
<html>
<body>
// my swf file is embedded here
</body>
</html>
Here is my Flash AS:
ActionScript Code:
/* first create a new instance of the LoadVars object */
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("myFile.php");
// once vars have been loaded, we will have these variables:
myVars.onLoad = function( success ){
if(success){
_root.myVar = myVars.myVar;
trace("variables loaded");
} else {
trace("Error loading page");
}
}
stop();
LoadVars Object In Flash 9?
Alright I have a fairly simple flash movie with two textboxes in it, a loadVars object that gets some vars from a php script that scraps myspace for comments, and a few animations/a preloader leading up to them etc, but I do have the following code right before I play the little animation to display the textboxes (they're just under a layer with some crap on top and the ani drags a mask down and reveals the text underneath):
Code:
stop();
var phpVars:LoadVars = new LoadVars();
phpVars.onLoad = function() {
loadingCover_mc.gotoAndPlay("goop_fra");
comTxt_mc.comt_txt.htmlText = this.comments + "<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br>";
}
phpVars.load("http://www.dboyzetown.com/eric/com.php");
Pretty simple, right? And that's exactly what happens. It works completely when I hit test movie, or I read the .swf file right off my machine with flash 8 reader. The problem occurs when I try to view it in a browser. It just gives me 'undefined'. I'm pretty sure it has something to do with the .onLoad event or how I define the object or something cus there is no wait for the onLoad event to fire off and the animation to play (with 'undefined' in the textbox). It basically occurs right away as if its loading nothing, or next to nothing. My best guess is that because my browsers (both IE and FF) use flash 9 reader, that's where the trouble is. I haven't been able to confirm that though cus I just don't feel like uninstalling flash 9 to see.
So anyway, is this some kinda flash 9 security thing that I need to turn off? Did I screw up something that flash9/AS 3 doesn't like?
Edit:
I updated my code with this:
Code:
stop();
var phpVars:LoadVars = new LoadVars();
var varLoadError:Boolean = false;
phpVars.onLoad = function(success) {
if (success) {
// starts the mask ani and sets the text underneath:
loadingCover_mc.gotoAndPlay("goop_fra");
comTxt_mc.comt_txt.htmlText = this.comments + "<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br>";
} else {
// if it doesn't load send a warning var (for a different textbox that displays after the ani's over) to the ani and sets the text to error stuff.
varLoadError = true;
loadingCover_mc.gotoAndPlay("goop_fra");
comTxt_mc.comt_txt.htmlText = "Errr.... Error.<br>Refreash the page or something?";
}
}
phpVars.load("http://www.dboyzetown.com/eric/com.php");
and it continues to work fine in flash 8 but in my browsers, now the .onLoad event doesn't seem to fire at all.
Also, here's the source if you'd like to take a look a that and the actual swf here.
LoadVars Flash Form ***HELP***
hey,
i really need some help with this - i have made a flash movie with a flash designer program and i put some input text inside the flash ( Username , Passowrd, ) also i named the variables to Password and username.
then i exported that flash into another flash designer program where i desgined a enter flash button and i added the enter flash button onto the external swf file which is the one ive created before with the other program.
-HERE ITS MORE SPECIFIC http://www.officialunlimitedbackups.com/TRYLOGIN.asp
as you can see thats my flash movie i just want to know how can i make a flash form for those variables .
and how can i get actionscripts so that all the information is sent and the user can log onto my website.
I would greatly appreciate any help ..Thanks.
Jace
Accessing Flash LoadVars Object In PHP
in Flash I have
myVar = loadVars();
myVar.name = "joe";
myVar.code = "234";
myVar.send("myPHP.php","_blank","POST");
How do I access the name and code in PHP?
I tried
$name = $HTTP_POST_VARS["name"];
$code = $HTTP_POST_VARS["code"];
I am getting "undefined index" errors.
I could use some help.
Thanks.
Accessing Flash LoadVars Object In PHP
Accessing Flash loadVars object in PHP
in Flash I have
myVar = loadVars();
myVar.name = "joe";
myVar.code = "234";
myVar.send("myPHP.php","_blank","POST");
How do I access the name and code in PHP?
I tried
$name = $HTTP_POST_VARS["name"];
$code = $HTTP_POST_VARS["code"];
I am getting "undefined index" errors.
I could use some help.
Thanks.
LoadVars & Connecting MySQL To Flash...
Good morning!
I am currently trying to make a Starmap for a game which will load the coordinates of the stars when you enter the code for it (1-11800~). I have compiled a Database which has 5 variables per Star in it and when I use the PHP as seen below:
PHP Code:
<?
$dbh = mysql_connect("aaa", "bbb", "ccc");
$query = "use aaa";
if (!mysql_query($query, $dbh)) die("Datenbank existiert nicht.
");
$query = 'SELECT * FROM navigator WHERE system_name="'.$_GET["system_name"].'"';
//if (!mysql_query($query, $dbh)) die("Fehler beim INSERT von Galaxen.
");
$result = mysql_query($query, $dbh);
echo mysql_error();
$arr=mysql_fetch_row($result);
echo "&system_name=".$arr[0]."&coordx=".$arr[1]."&coordy=".$arr[2]."&coorda=".$arr[3]."&coordb=".$arr[4]."&coordc=".$arr[5];
mysql_close($dbh);
?>
I am handed the following response:
Quote:
&system_name=1234&coordx=537&coordy=178&coorda=118 &coordb=-7&coordc=299
What I am trying is to get Flash to understand these are variables it should be loading into the program because I have multiple functions that use exactly these variables. So I coded this into my Flash Application (This is in the Timeline and not on the button)
PHP Code:
Calc.onRelease = function ()
{
var n = new LoadVars();
n.onLoad = function(OK) {
if(OK){
trace("getcoords.php?system_name="+SystemNr.text);
trace("coorda="+coorda);
trace("coordb="+coordb);
trace("coordc="+coordc);
trace("coordx="+coordx);
trace("coordy="+coordy);
/* The next 4 functions use the variables coming from the php file */
karte();
yline_mc.move(yline_mc._x, Number(coordy), 8);
xline_mc.move(Number(coordx), xline_mc._y, 8);
Flugzeit(coorda,coordb,coordc);
} else {
trace("This script is broken.");
}
}
n.load("getcoords.php?system_name="+SystemNr.text,"");
};
Since I couldn't find out what the problem was I placed some traces as seen above. I end up getting shown that the number I input (in this case 1234 as example) gets read in but I think I have a problem getting the variables actually loaded into the program.
Is it maybe because flash needs a bit more delay to make sure it has what it needs before proceeding ? I tried that with LoadVars as seen above but to no avail =/
The trace result:
getcoords.php?system_name=1234
coorda=
coordb=
coordc=
coordx=
coordy=
I think what I am missing is something minor but I can't seem to find where I am lacking =/ Any help would be extremely appreciated ! Thanks in advance.
Phelan
Where Does Flash Download Content From LoadVars(); To?
i think it is odd that you can access the amount of data that is loaded from a LoadVars(); at anygiven time, but you cannot actually access what the data is...
I was hoping that i could create my own type of chat program that was for the most part JUST LIKE A SOCKET SERVER but still with the same old loadVars();
my idea, i access a php file through LoadVars();... this is not an ordinary php file, however... (NOTE: I actually have this working) The php file has set_time_limit(0); so that it never actually stops running.. then the php file echo's out any new events that it finds..
i do this through flush() and ob_flush();
So, when you view it in internet explorer, it works absolutely perfect, when ever there is a new event, it pops up in the browser...
I just need it to work with flash... the LoadVarsObject.onLoad only is called when the page is COMPLETELY LOADED.. the only problem is that this page NEVER IS COMPLETELY LOADED... i cannot rely on onLoad to get the new events that are sent from flash...
I played around with it to make sure that the file was actually being sent. and it is... i put trace(_rooot.LoadVarsObject.getBytesLoaded) inside of a movieclip to continualisly relay how much was loaded... when ever there was a new event, more was loaded.. So now I thought i had figured it out.. But, when ever i try to access any content that is stored in the LoadVarsObject, it just gives me the &onLoad=.... part... So, i was wondering if there was any cheat that you guys could think of to MAKE FLASH GIVE ME THE DATA I WANT?
Obviously the data is there, or else the number of bytes loaded would not increase...
In my php file, i made it exit after X amount of seconds.. and as soon as it exited, or it completly loaded in flash, i could access all the data that was sent... All i need to do is access the data before the page is completely loaded...
Thanks in advance,
Mike Haverstock
LoadVars Works In Flash But Not On Server?
I just created a LoadVars so that I can upload a .txt and have it grab the text from there. It works great when I publish it but then when I upload it to the server it doesn't work. Any thoughts?
Code:
var textVars = new LoadVars();
textVars.load("ShowTimes.txt",_root);
textVars.onLoad = function(success){
if(success){
_root.loadShows.text = textVars.msg;
}
LoadVars Within A Simple Flash MP3 Player
I'm using this simple flash MP3 player on my site, and I want to be able to send the song value, which is passed through the embed as _root.file, to an external PHP file where it will be stored in a database. I've figured out the ideal place to put the code (within the sound.onComplete function), but I can't get it to work! I've used gotoURL, loadVars, and sendAndLoad, but nothing seems to work.
All I want is some simple code to send _root.file to database.php. Nothing has to be sent back. Am I overlooking something really, really easy that is going to make me feel really, really stupid?
Flash Security Issue With LoadVars
Hello all,
I am having a problem with LoadVars.load in flash 8. It seems that there's a security setting somewhere that does not allow me to access remote sites ( load(" http://www.youtube.com/..."); for example.
My code did work in the Flash 8 authoring environment before I had to run some virus/spyware scanners, but now i cannot open external urls. I get a "Error opening URL...".
If i publish my apps and open the html file, they do work correctly. The 1st time I opened the html, i had to set a security preference to allow the app file to access external sites.
So it seems that there is a security preference somewhere that does not allow the authoring environment to access external sites/server.
Does anyne have any ideas on where i can start on this? Where can i get info pertaining to this security concern? Does it seem reasonable that it is even a security concern?
Please help,
marrek
Flash Form To E-mail Using LoadVars And PHP
Having tried the tutorial example and many of the samples on the forum pages including CyanBlues' example, (which I tested on my server, changing just the email address and the mail3.php URL but to no avail) I cannot get any of them to work. I have never used PHP before but am reasonably adept with ActionScript. Is there something obvious I am missing here, i.e. does the PHP file have to go in a specially named folder to work or something?
Loadvars Flash & MySQL Query
Can somebody help me to find a solution to this example?
I'm working on a tutorial I found in Macromedia Flash Developer Center:
This is the PHP Script that shows images and data stored in a MySQL database. I have modyfied it...
<?php
mysql_connect("localhost","root","");
mysql_select_db("flashcms");
$tab = $HTTP_POST_VARS['thisLetter'];
$qr = mysql_query("SELECT * FROM press WHERE LEFT(magazine,1) = '".$tab."' ORDER BY date");
// start output string with number of entries
$nrows = mysql_num_rows($qr);
$rString = "n=".$nrows;
for ($i=0; $i < $nrows; $i++) {
$row = mysql_fetch_array($qr);
$rString .= "&magazine".$i."=".$row['magazine'] /*."&firstName".$i."=".$row['firstName'] */;
$rString .= "&date".$i."=".$row['date'] /* ."&email".$i."=".$row['email']*/;
$rString .= "&picFile".$i."=".$row['picFile']."&caption".$i."=".$row['caption'];
}
echo $rString;
?>
/////////////////////////////////////////////////////
In the actionScript frame I have got the following:
function showjpg(paramString) {
// get the individual parameters:
// params[0] = picture file name
// params[1] = caption
var params = paramString.split("#");
picHolder.loadMovie(params[0]);
caption.text = unescape(params[1]);
}
function showContent() {
var i;
content.htmlText = "";
for (i=0; i < this.n; i++) {
if (this["picFile"+i] != "") {
content.htmlText += "<b>" + this["magazine"+i] + " " + "</b>" + "<a href='asfunction:showjpg," + this["picFile"+i] + "#" + escape(this["caption"+i]) + "'> (<font color='#0000cc'>pic</font>)</a><br>";
} else {
content.htmlText += "<b>" + this["magazine"+i] + " " + "</b><br>";
}
content.htmlText += " " + this["date"+i] + "<br>";
// content.htmlText += " <a href='mailto:" + this["email"+i] + "'>" + this["email"+i] + "</a><br><br>";
}
}
Everything's ok so far... but I'd like to show the query as soon as the movie loads - directly - instead of showing data according to the letter of the tab pressed.
http://www.adobe.com/es/devnet/flash/articles/flashmx_php.html
Thank you very much in advanced for your help.
Kind regards.
Angel
LoadVars Broken In Flash 7 Onward?
This script works fine when I publish for Flash 6:
// create a new LoadVars instance
thisVars = new LoadVars();
thisVars.Load("variables.txt");
thisVars.onLoad = function() { // check if vars all loaded
if (thisVars.loaded = 1) { // vars completely loaded
trace(thisVars.loaded);
trace(thisVars.file);
gotoAndPlay(2);
} else { // The data didn’t load at all. Display error
trace("error: data didn't load");
} // end "if loaded==1" statament
}
But when I publish for Flash 7 or later, the data does not load!
I'm using a Mac running OSX 10.4.11 with Flash CS3.
Please help,
Display A Variable In FLASH Using LoadVars And PHP
What I'm trying to do:
Send a user input to PHP
Use this input to query a MySQL DB (This works fine)
Get the result back to Flash and put it in a dynamic Text Box - How???
The communication from Flash to PHP works fine. The variable I pass from Flash to PHP are used in the query as intended.
Then Im trying to send a variable back to flash. I cant display this variable in Flash, only in a new explorer window........
<?php
require 'Include.php'; //Data about $DBhost,$DBuser,$DBpass
$user=$_GET['name'];
// Connects to the database.
mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
// The SQL query.
$query = "SELECT * FROM $table WHERE user ='$user'" ;
$result = mysql_query($query);
/* This just gets the number of rows in the Query */
$numR = mysql_num_rows($result);
// If the number of rows is 0--> no hits on query
if ($numR>0) {
for($i=0; $i < $numR; $i++) {
$row = mysql_fetch_array($result);
print $row['fname']; //This prints 'Bruno' when user = 'test'
}
}
else {
print "not connected ";
}
?>
--------------------------
Actionsript:
on (release) {
var my_vars = new LoadVars();
//Get the text from Input Text
my_vars.name=userName.text;
//Send input (my_vars) to PHP and assign result to my_vars
my_vars.send("http://localhost/lms/Login.php",my_vars,"POST");
//Set the result in Dynamic Text box with Var name status
status=my_vars.name;
}
-------------------------------------------------------------
I've read all the tutorials I was able to find, looked at the macromedia site, and still not able to solve it.
This problem has been driving me crazy for one week now. I scanned through this forum, but haven't found anything useful for my case.
Hoping for replies, best regards
Jarle
FLASH MX LoadVars With HtmlText Problem
I am having a strange problem...
If I am using the following code to pull straight text data (output as html), I don't have any problems, except of course that my html tags don't render properly:
System.useCodePage = true;
loadText = new loadVars();
loadText.load("http://www.mysite.com/func/data.php");
loadText.onLoad = function() {
topbar.text = this.topbar;
};
However, if I do ANY of the following, it doesn't work - the variables aren't imported and I have a blank .swf:
change
topbar.text = this.topbar;
to
topbar.htmlText = this.topbar;
or to
topbar.html = true;
topbar.htmlText = this.topbar;
or I add
topbar.html = true;
topbar.htmlText = this.topbar;
AND set the 'render as html' in the text properties box...
I have tested this thing to death and I don't get it... data.php renders fine, and the .swf works if I am just using plain topbar.text, but not with HTML...
What's up?
Thanks
Flash LoadVars.send NOT Working.
Here is my Flash Action Script:
on (release) {
myVars = new LoadVars();
myVars.val = sector_01_var;
myVars.col = sector_01_status;
//myVars.SendAndLoad("http://www.jrphosting.co.uk/wellq/wellq_write_record.php", myVars, "POST");
myVars.SendAndLoad("http://www.jrphosting.co.uk/wellq/wellq_write_record.php", "_out", "POST");
gotoAndStop(25);
}
Here is my PHP script:
<?php
include("db.inc");
$conn=@mysql_connect("$db_address", "$db_username", "$db_password") or DIE("Could not connect to MySQL.");
$rs = @mysql_select_db("$db_name",$conn) or DIE("Could not select database.");
$sql = "INSERT INTO $db_table (wqr_sector_01_v, wqr_sector_01_c, wqr_uid) VALUES ('$var', '$col', '00000007')";
$rs = @mysql_query($sql,$conn) or DIE("could not execute query - get package details.");
mysql_close($conn);
?>
Problem:
The PHP script works if you send it with data, such as:
http://www.jrphosting.co.uk/wellq/we...hp?var=3&col=R
...it appears in the database fine...
http://www.jrphosting.co.uk/wellq/wellq_read_record.php
BUT Flash will not do it?
http://www.jrphosting.co.uk/wellq/
I'm stumped, help!
|