[MX04] Trying To Pass Variables TO Flash Then Back Into Php
First of all, I am a complete Flash n00b. I'm making a website right now and I've been trying to learn it 'on-the-go' with no avail. After 2-3 weeks of reading tutorials, reading up and researching I'm at the end of my wits. What I am trying to do:
Pass variables into Flash from a PHP script using LoadVars in the html
Quote:
object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="360" height="260" id="snakeTutorial" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="snakeTutorial.swf" />
<PARAM NAME=FlashVars VALUE="gameid=<?php echo "$gameid&userid=$userid";?>">
<param name="loop" value="false" />
<param name="quality" value="low" />
<param name="devicefont" value="true" />
<param name="bgcolor" value="#ffffff" />
<embed src="http://buxgames.com/demo/games/snake/snakeTutorial.swf"
FlashVars="gameid=<?php echo "$gameid&userid=$userid";?>"
Then I have NO idea where to put the LoadVars and how to treat the variables and to make the show up on the nameTextField. I don't know to to implement the getUrl in the submit button to pass on the variables to a PHP script either!
Display the name when the game is finished and once the submit button is pressed, I want to pass on the score, gameid, and userid into another PHP script which contains the sql code.
The script that I'm trying to edit: http://www.strille.net/tutorials/sna...hHighscore.zip
I read over countless LoadVars tutorials and did a lot of examples but I still cannot integrate into the script.
If someone would be able to help me out, I'd be GREATLY appreciated!
FlashKit > Flash Help > Flash ActionScript
Posted on: 10-22-2008, 12:47 PM
View Complete Forum Thread with Replies
Sponsored Links:
Trying To Pass Variables TO Flash Then Back Into Php
First of all, I am a complete Flash n00b. I'm making a website right now and I've been trying to learn it 'on-the-go' with no avail. After 2-3 weeks of reading tutorials, reading up and researching I'm at the end of my wits. What I am trying to do:
Pass variables into Flash from a PHP script using LoadVars in the html
Quote:
object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="360" height="260" id="snakeTutorial" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="snakeTutorial.swf" />
<PARAM NAME=FlashVars VALUE="gameid=<?php echo "$gameid&userid=$userid";?>">
<param name="loop" value="false" />
<param name="quality" value="low" />
<param name="devicefont" value="true" />
<param name="bgcolor" value="#ffffff" />
<embed src="http://buxgames.com/demo/games/snake/snakeTutorial.swf"
FlashVars="gameid=<?php echo "$gameid&userid=$userid";?>"
Then I have NO idea where to put the LoadVars and how to treat the variables and to make the show up on the nameTextField. I don't know to to implement the getUrl in the submit button to pass on the variables to a PHP script either!
Display the name when the game is finished and once the submit button is pressed, I want to pass on the score, gameid, and userid into another PHP script which contains the sql code.
The script that I'm trying to edit: http://www.strille.net/tutorials/sna...hHighscore.zip
I read over countless LoadVars tutorials and did a lot of examples but I still cannot integrate into the script.
If someone would be able to help me out, I'd be GREATLY appreciated!
View Replies !
View Related
Pass Variable From Flash To HTML And Back?
OK I have a HTML page with a swf(created in Flash MX) on it. The user can choose between 2 buttons (basically to show text or to hide text). I need to somehow keep their option (hidden or shown text) the same on the next HTML page which has a different swf. I'm thinking I need to set a variable (ie 1 for turn on text, 2 for turn off text) and then send that variable to the HTML page where it somehow sends it to the next HTML page that is opened where the new swf reads the variable (1 or 2) and responds accordingly....
Can anyone help me work this issue out???? I'll probably need help in setting up both the swfs and the HTML code to make it all happen. I have limited experience in javascript for the HTML and more, but not much, experience with actionscript.
I'd greatly appreciate any help I can get on this. Thanks in advance.
View Replies !
View Related
How Do I Get Flash To Pass A Value Back To The Web Page In Which It Is Embedded?
Hi,
I'm sure this is very simple to do, but I have little experience with Flash.. and need to use it.
I have a flash file with a number of buttons on it. Each time a button is clicked, it changes the single dynamic text field to show relevant information about that button (using the on release event).
This flash object is going to be embedded in a Learning Management System, and I need it to pass a value back the page it is embedded in.
In this instance, I need it to pass back a single digit. Basically, I need the web page to know how many of the buttons in the flash object the user clicked on (each button should only be counted once though).
Can it be done, and.. ummm.. how (noob-instructions would be great!) I'm using Adobe Flash CS3 (ActionScript 3.0)
I hate to ask, but I have a 5 day deadline to present the whole e-learning system to a client, and this is a component of it!
Thanks!!
View Replies !
View Related
Pass PHP Variables To Flash
I am trying to create a flash site that will allow users to upload an image to database. I am using PHP script to upload the image through an HTML popup window. Once the image is uploaded (after 'submit' has been clicked), how can I pass the 'imgID' variable back to Flash?
I know variables can be passed back to Flash through PHP by simply using the 'echo' function, but I can't seem to get it to work in this case (maybe b/c I am launching my php script through the 'getURL' instead of 'loadVariables'???).
Flash code:
Code:
on (release) {
//launch upload window
getURL("javascript:openNewWindow('upload.php', 'myWindow', 'height=200,width=500,toolbar=no,scrollbar=no,menubar=no,location=no,resizable=yes,status=no'); NewWindow.focus(); void(0);");
}
PHP Code:
PHP Code:
<?php
#DB CONNECT
//database info
$host="localhost";
$user="";
$pass="";
$db="";
$table ="image";
// database connection
$conn = mysql_connect($host, $user, $pass) OR DIE (mysql_error());
@mysql_select_db ($db, $conn) OR DIE (mysql_error());
#ON SUBMIT
// Do this process if user has browse the
// file and click the submit button
if ($_FILES) {
#ALLOWED FILE TYPES
$image_types = Array ("image/bmp",
"image/jpeg",
"image/pjpeg",
"image/gif",
"image/x-png",
"application/octet-stream");
#IF THE FILE UPLOADS SET USERFILE AND BUILD VARIABLES
if (is_uploaded_file ($_FILES['userfile']['tmp_name'])) {
$userfile = addslashes (fread (fopen($_FILES["userfile"]["tmp_name"], "r"), filesize($_FILES["userfile"]["tmp_name"])));
$file_name = $_FILES["userfile"]["name"];
$file_size = $_FILES["userfile"]["size"];
$file_type = $_FILES["userfile"]["type"];
#IF THE FILE UPLOADED IS IN THE ALLOWED FILE TYPES ARRAY UPLOAD IT
if (in_array (strtolower ($file_type), $image_types)) {
$sql = "INSERT INTO ".$table." "
. "(image_type, image, image_size, image_name, image_date) ";
$sql.= "VALUES (";
$sql.= "'{$file_type}', '{$userfile}', '{$file_size}', '{$file_name}', NOW())";
@mysql_query ($sql, $conn);
//Header("Location:".$_SERVER["PHP_SELF"]);
//get image id
$id= mysql_insert_id();
echo "$id";
}
}
}
?>
<html>
<head>
<title>Upload Image</title>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<br>Select Image to Upload:<br>
<input type="hidden" name="MAX_FILE_SIZE" value="24000000">
<input type="file" name="userfile" size="60">
<p>
<input type="submit" name="submit" value="Upload Image">
</form>
</body>
</html>
HTML Code:
Code:
<HTML>
<HEAD>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<TITLE>index</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<!-- URL's used in the movie-->
<A HREF=javascript:openNewWindow('upload.php', 'myWindow', ','height=200,width=500,toolbar=no,scrollbar=no,menubar=no,location=no,resizable=yes,status=no'); NewWindow.focus(); void(0);></A> <A HREF=javascript:Launch('index.php')></A> <!-- text used in the movie-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="550" HEIGHT="400" id="index" ALIGN="">
<PARAM NAME=movie VALUE="index.swf?id=<? echo id?>">
<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="index.swf?id=<? echo id?>" quality=high bgcolor=#FFFFFF WIDTH="550" HEIGHT="400" NAME="index" ALIGN=""
TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function openNewWindow(URLtoOpen,windowName,windowFeatures) {
newWindow = window.open(URLtoOpen,windowName,windowFeatures);
}
// End -->
</SCRIPT>
</BODY>
</HTML>
Thanks for any advice you can offer.
View Replies !
View Related
Pass Variables From Flash
hi,
i like to know how do u pass variables from flash to another html. mine is just one simple variable.
what i get from flash Help is using GET and POST(after declaring the variables)
getURL("http://www.macromedia.com", "_blank", "GET");
getURL("http://www.macromedia.com", "_blank", "POST");
is there another way where i can pass variables? like using:
getURL("http://wwww.macromedia.com?fid=",);
*fid is the variables.
thank you
View Replies !
View Related
H E L P P L E A S E ASP And FLASH Pass Variables
Hope somone can assist here, I have an ASP page with 3 variables it gets from an excel spreadsheet (unusual but it works ok) I want to display the variables in 3 text areas in Flash 8
getdata.asp is my web page, variables are
STR_name
STR_add2
STR_postcode
its as simple as that, the ASP page works fine so I guess I need to run it in the background to produce the variables?
I have read many tutorials arround this but cant quite grasp it
I need to know what actionscript to run under what frame, I dont need to scroll through the records as the web page will only bring back 1 set of variables because the data is non conflicting
Thanks in advance
many thanks
Edited: 04/16/2008 at 12:56:42 AM by john iles..
View Replies !
View Related
Pass Variables To Flash
http://www.bayareafellowship.com/baf...es/losite1.php
the image titled "relentless" and the title "relentless" i want it to pull from an xml file. how would i go about loading this in flash. i am doing through a database and i know how to get the xml file to update from the database. but i want the flash file to update from the xml file. all the variables i need to pass are
1) Title of series
2) series image (jpeg)
any suggestions
View Replies !
View Related
Pass Variables From Flash To ASP
Hi all.
I am trying to pass variables from Flash to ASP when someone releases a button. The variable will then be passed to my timeline.asp page and go to a specific record in my database.
I found a very useful tutorial to pass variables from ASP to Flash but only vaery short description on passing variables the other way around.
http://www.asp101.com/articles/flash/
Cheers
View Replies !
View Related
Does ANYONE Know How To Pass Url Variables To Flash AS3
Hi,
I've done a ton of internet searching and can't find but snippets and vague, non-working tutorials on this.
How do I read url variables in Flash CS3 (AS3)?? What commands? Syntax? I tried the following:
var obj:Object=LoaderInfo(root.loaderInfo).parameters;
var try_txt:TextField = new TextField();
addChild(try_txt);
for (val in obj)
{
id=String(obj[val]);
try_txt.text += id;
trace(try_txt.text);
}
it's always blank. My url is of the form
www.mysite.com?x=77
Then I change the object and embed parameters in the swf loder:
<param name="movie" value="loadURLParams.swf?x=77" /> //x will be populated w/ php
and do the same for the embed.
NOTHING. How do I do this??
Thanks!
Jay
View Replies !
View Related
HELP How Can I Pass Variables From Flash To Javascript?
I am trying to pass variables which the user can enter into a flash movie to javascript (for example to have an alert using the data they have just entered) but the flash variables are just being ignored (if I'd have them in the sourch code of the html file it would work- but i need to have the user enter the).
Can this be done?
thanks.
View Replies !
View Related
Pass Variables To A Flash Movie
1st, I'm not sure if is is really concerning ActionScript (maybe it is silly HTML)
How can I load a page with a flash movie, passing a pair of variables to the movie?
In other words, I've an ASP page, that get name and age, and put them in variables. After that, I'll jump to a page with a flash movie, and I want to get the two variables inside the flash.
Any help will be pleasant
ray
View Replies !
View Related
Flash Images Need To Pass Php Variables In URL
Having spent loads of time learning php/mysql I then discovered Dreamweaver MX and am now updating my website. I have been give 4 lovely flash animations which I want to use as links to other pages in my website but have found that dynamic php variables passed to the images will not work. Any ideas. A friend said I could put the flash animations into a fireworks table but flash and fireworks just ain't my thing although if anybody can point me to an online guide that would help, I'd be a happy person.
View Replies !
View Related
Pass Variables From One Flash Movie To Another
Hi,
I need to find a method of passing a single variable from one flash movie to another, I have read up briefly on this subject but have only found methods of retrieving variables.
Basically, I have a swf with a number of buttons which call upon the corresponding URL containing the new swf when pressed. The problem is, I want a standalone preloader swf before the new swf loads, and rather than create lots of separate preloaders for each new swf, it would be nice if i could create just the one preloader, with the variable of the desired swf being passed to the preloader.
I'm sure this is possible, but if someone could get me started I would be very grateful!
Thanks, Steve.
View Replies !
View Related
How To Pass Variables To A Flash Movie?
Hello guys, I have a question regarding work with variables.
Now, the base of what I'm doing is php scripting. Among other things I want to pass some variables to a flash movie. So I have a script A that passes some variables to a php script B that has a flash movie included. I want that flash movie to pick up values of those variables.
I'm not sure what's the best way to do it and how it should be properly done to exclude any possibility of an error. Is the best way to do it, passing the variables through the URL? So I call "scriptB.php?somevariable=somevalue" in my script A or are there other options?
I'm really not sure how to read those variables in flash. I know functions like loadVariables, but that's loading an entire URL, ain't it? What I would like is for flash just to receive the variable & value pairs that were send to the script B that's holding the flash movie?
I hope it makes sense. Thank you for help.
Regards,
Airnine
View Replies !
View Related
FlashVars: Here Is A Way To Pass Variables To Flash Via AS3
I have been doing a lot of searching and speaking to a lot of people about a way to pass the current URL to flash so that I can make a simple button go to the down position based upon what page the person is on. WOW, what a pain... lol
Well, A pain no more. Here is a list of everything I have found. Hopefully it will help someone out there.
First, you can use FlashVars in order to talk to Flash.
You can use Flash Vars by simply either adding parameters to the movie parameter in the HTML for flash as such
<param name="movie" value="main.swf?one=1&two=2" />
<embed src="main.swf?one=1&two=2"
Code:
<!-- using query string -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
width="550"
height="400"
align="middle"
id="main">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="main.swf?one=1&two=2" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="main.swf?one=1&two=2"
width="550"
height="400"
autostart="false"
quality="high"
bgcolor="#ffffff"
name="main"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
OR
creating an additional parameter name called FlashVars such as:
<param name="FlashVars" value="one=1&two=2" />
FlashVars="one=1&two=2" (for the embed statement)
Code:
<!-- using FlashVars -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
width="550"
height="400"
align="middle"
id="main">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="FlashVars" value="one=1&two=2" />
<embed src="main.swf"
width="550"
height="400"
autostart="false"
quality="high"
bgcolor="#ffffff"
FlashVars="one=1&two=2"
name="main"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
Okay, that was the easy part.
The next thing you have to be able to do is retrieve this information that you have just passed in
This was not so easy to find. Even when you do find it tutorials that explain it, they are not correct and they end up not working.
You have to change a few items in order to get this to work.
1. You have to add the following parameter to the AC_FL_RunContent Javascript on the HTML page generated by Flash: 'FlashVars', 'YourFlashVarParameterHere'
Such As:
Code:
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '550',
'height', '400',
'src', 'flashvars',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'flashvars',
'bgcolor', '#ffffff',
'name', 'flashvars',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'flashvars',
'FlashVars', 'flashvars',
'salign', ''
); //end AC code
}
</script>
2. For testing, enter the following actionscript into your Actions Layer on your main timeline.
Code:
// Reading the FlashVars from the page
var tf:TextField = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = false;
addChild(tf);
tf.appendText("params" + "
");
try {
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
tf.appendText(" " + keyStr + " " + valueStr + "
");
}
} catch (error:Error) {
tf.appendText("error");
}
The above code creates a textbox dynamically and outputs the flash variable to that text field.
The following code is what I believe to be the actual item that collects the variable.
Code:
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
I hope this helps someone here like many people here have helped me.
Wayne
View Replies !
View Related
Pass Variables From Html To Flash ?
i was wondering if there's any way you can pass variables from html to a flash image ?
in other words: i want a script that takes a variable it is given from outside the flash movie and changes the link accordingly.
I hope this is possible and if someone wants to help me with this
Thx in advance
Greets
View Replies !
View Related
How Do I Pass Hidden Variables From Php To Flash
I am trying to make a flash file open a specific xml file from a URL that is set in the php file. when a the page is loaded, the php file is called for the variable. you must use a query line in the URL....example : http://www.mysite.com/test.swf?folder=myfolder
the php file should see the 'folder' variable and use it in the url that i want to load the xml file from. Once the variable is set in the php file, i want to transfer it to the swf file without having to change the url that the user types.
Here is basically what i want to do....
i want to be able to type in www.mysite.com/test.swf?folder=MyFolder in the browser. the php file will check some stuff in the mysql database and make sure that the user's space is not used up.....i can do that part with the space. If the user's space is not used up, it will post a variable to the swf file to load the xml file with the 'folder' variable in the url.. example : .....com/TheFolderVariable/thexmlfile.xml Once the variable is passed to the swf file, it will load properly.
I was trying to use the loadVars() and the loadVariable() commands but i cannot get the php file to post back to the swf.
View Replies !
View Related
Pass External Variables Into Flash
hi all,
i have a variable i want to pass into my flash movie. in my xhtml page i have:
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="767" height="184">
<param name="movie" value="images/header.swf?myVar=5" />
<param name="quality" value="high" />
<param name="WMode" value="Transparent">
</object>
so im passing in the variable 'myVar'. in my flash movie, how do i get at this variable and display it in, say, a dynamic text field?
many thanks
- D
View Replies !
View Related
Best Way To Pass Variables To Flash Media Server?
Hello all!
I'm new to the forum, so please excuse any blunders I make!
I'm trying to learn the best/simplest/easiest way to pass a variable from flash to a flash media server. The transfer will be triggered by a button press, sending the info to my FMS which will respond accordingly.
The real question is, is it better to send the info from the swf or to call on it from the FMS?
Thanks in advance to anyone who answers!
View Replies !
View Related
Pass Variables Into Flash Via Query String
I used to do this all the time to pass in simple values to Flash but with Flash 8 it doesn't seem to be working properly. I've stripped it down to it's most basic and it still doesn't seem to be working. I've got a test page here:
http://icglink.com/flashtest/
The top set uses the standard object/embed method, the left one passing in a 0, the right passing in a 1. Both use the variable named previousvisitor.
The bottom set use the same variable and value structure, but with the swfobject javascript call instead of the object/embed method.
I've got a case statement on the 5th frame that tests the incoming variable and directs the playhead to one frame label or another. The idea is that if someone has come to the site for the first time, they'll get to see a video. If not, they'll get a still frame with a "play video" button.
I'm also including a link to the FLA (version 8 remember).
http://icglink.com/flashtest/cookieTEST.fla
So does anyone have ANY idea why this isn't working correctly? I really need to get this working and it should be dead simple.
View Replies !
View Related
Help, Trying To Pass Variables From A Flash Movie To Html Using GetURL
here's an example of the code i am using (it's for a banner that lets you select a few dropdown options):
//concatenates the variables in my movie to the url
_root.urlvar=("http://www.examplesite.com/page.html?var1="+_root.variable1+"var2="+_root.var iable2);
//opens the url in a new browser window
getURL (_root.urlvar, "_blank");
The problem i am having is that IE and Firefox block this. Is there a way of getting around the security without changing browser settings?
View Replies !
View Related
Server Side PHP Script Pass A Result Back To Action Script Or Flash 8 Application
This is the little script to call the server side php script what has to be done to this actionscript to support the returning to the flash 8 the message email has been sent. The folowing is the actionscript tied to the submit button.
on (release){
txt.loadVariables("email.php", "POST");
}
Please review the folowing: this a server side php script - the main things is to try to understand how to send back to the flash 8 cleint a messge that the message was sent.
<?
// THIS STARTS THE WORK HERE
if(sizeof($_POST)) {
$body = "";
while(list($key, $val) = each($HTTP_POST_VARS)) {
if ($key != "submit")
$body .= "$key: $val
";
}
echo $body;
echo "<br><br>";
echo "Parseing results from Lodges history web page";
unset($index);
switch($body){
case "lodgapage1":
$index="johntheard.php" ;
break;
case "lodgapage1":
$index="essex.php";
break;
default:
$index="index.php";
}
echo $index;
echo "<br><br>";
echo "Parsed get lodges histroy";
echo "This is the name of the lodge History :" . $index; // The name of the lodge
echo "<br>";
header("Location:"index-7.php ");
echo $index;
exit;
// echo "<META HTTP-EQUIV="Refresh"
// CONTENT="0; URL=index-7.php">";
}
// end form processing
?>
View Replies !
View Related
Pass A Javascript Value Back To Actionscript
is there a simple way to just pull back a true or false value from an associated javascript file to a flash file? here is what i have:
Code:
var bincheck:Boolean = fscommand("eval", "parent.check_bins(\'"+img+"\')");
if (!bincheck){return false;}
return true;
check_bins(img) is a function in my javascript file that simply iterates through an array, returning false if "img" is found. im simply trying to get the true or false value back into flash, but its not proving that simple. i added a couple alerts so that i could see what the "bincheck" value was, and i keep getting an 'undefined' value for "bincheck" in flash.
any suggestions?
View Replies !
View Related
Flash Menu 4 HTML Pages - Pass Variables On Page Refresh
So the subject is a hint as to how hard it is to search on this simple idea.
Will be very greatful for some help today!
PROBLEM DETAILS:
I am building a swf menu for an HTML site. It has the following buttons:
SectionA
SectionB
SectionC
What I want to do is modify the text when the HTML page for the correspoding section is loaded. So, if I click on "SectionB", SectionB.html loads. Now I want that button "SectionB" in the swf to have a background glow.
Of course the catch is, that each time a new HTML page loads, it reloads the swf menu (No Frames please!). So, naturally I know I can just tell the swf menu to go to a certain place in the timeline where there is the glow graphic behind "SectionB". But the swf needs a variable saying it is on a Section B HTML page. (of course I could build a seperate swf for each section - but that seems stupid.)
THUS....
MY QUESTION:
How do I pass a variable from a swf on one HTML page (that is being replaced by a new HTML page!), to a swf on a new HTML page.
Can I do this with a GET/POST or something?
Thanks!
-AB
View Replies !
View Related
What Are The Ways You Can Pass Varables Back From A PHP File To A Actionscript Other
What are the ways you can pass varables back from a PHP file to a actionscript - the only way i ahve come acosss so far is the following :
SendData.sendAndLoad("phpFile.php",returnData)
and using a echo construct in PHP passing everything as a string eche!!!!
The problem is i want to pass back varabiles other then maybe a string and ya i could create one string and concatanate them to together but i do not like have to do that - I do not feel that is a vearble effective way and could be prone to data intagratdy problems in useing that methord. So is there a better way to pass the varabile back from a PHP file to a actionscript.
View Replies !
View Related
[MX04] Or Flash 8 - HELP With XML And Variables
Good morning everyone,
I'm working on a project and I've hit a road block. I need your help!
I'm currently reading an XML file to display thumbnail images along with their buttons.
The thumbnails and buttons are duplicate movies and duplicate buttons.
I simply increment a number after the segment name.
When you click on one of these images it displays it in another movie in a much larger format.
Since these movies and buttons are duplications, the button script is written in the script timeline and not in the button. I'm using doRelease function() to declare the buttons however for some strange reason the "k" variable always equals the final increment (8 in this case) while it should be say 2 for thumbnail #2, 3 for thumbnail #3, etc...
// Populate the component with the language names
for (var k=0; k < masterArray.length; k++) {
lang_cb.addItem(masterArray[k][0]);
// Duplicate Image Box, Button and Colour Index
duplicateMovieClip("_root.colours.swatch", "swatch"+idx, idx);
duplicateMovieClip("_root.colours.SButton", "SButton"+idx, idx+100);
_root.colours["SButton"+k].onRelease = function(){
_root.colours.LogoSelect.loadMovie(masterArray[k][3]);
setProperty("_root.colours.LogoSelect", _height, "15");
setProperty("_root.colours.LogoSelect", _width, "60");
_root.colours.LogoSelect.onPress = function() {
startDrag("_root.colours.LogoSelect.LogoSelectButt on", false);}
_root.colours.LogoSelect.onRelease = function() {stopDrag();}
}
View Replies !
View Related
Passing Variables From Flash To PHP And Back
Hi,
Im a noob to actionscript and can't find a solution to my problem in this forum.
I have a button in flash and a dynamic text field. What I require is on each click of a button a counter increments by 1 and the value is displayed in the dynamic text field. This value is passed into the URL (using GET or POST).On each click the counter will keep incrementing, the displayed value showing the increment and the value in the URL updates to reflect this.
This should all happen on the same PHP page. I have the PHP page echoing out the value...simple enough. The actionscript I have is below.
Code:
var value:Number;
if (isNaN(value)) {
value = 1;
}
myButton.onRelease=function(){
{
value++;
trace("click");
}
getURL("pass.php", "_self", "GET");
}
The counter increments to 2, then jumps back to 1. This means that PHP keeps echoing out a value of 2. How do I get flash to check for the value in the URL, and if not present set to 1. If is present use this value?
Any help greatly appreciated.
View Replies !
View Related
[MX04] - Passing Variables Flash/PHP
I am attempting to pass variables into flash from the php page which my flash file is viewed in.
php page has a variable called $aid, which is passed via the URL and retrieved with $_GET[' ']
This php page also displays my flash movie.
I want my flash movie to get the variable for $aid and be able to use it as a variable inside the flash movie.
Is there a way?
Thanks
PJE
View Replies !
View Related
Help With PHP Variables Sent Back To Loaded Flash Movie
Hi,
I'm trying to get a guestbook in flash working, and I currently have my guestbook.swf file load into a target in my main flash movie. Then, guestbook.swf uses loadVariablesNum to talk with a PHP script. This all works fine, but when the PHP script tries to print back to Flash, the variables go to my main flash movie, and not guestbook.swf
I can't figure out any way to get the variables to guestbook.swf. Any suggestions?
-Laura
View Replies !
View Related
Returning Variables From Form Back Into Flash
First off GREAT site.
Okay heres is my problem I built a form in flash and have it send the data to a myql DB via a php script. That part works fine. Now what im trying to do is get it to return the values of either what was submitted or just a simple thank you for your submision. What happens if I just leave it so It send the data thru the form after you hit submit it pops up to the php script and stops. What I would like it to do is either say submission a sucess or return what was submitted so here is what i have so far. Any help on this matter or maybe poiting me in the right direction would be awsome.
Code:
function doSubmit()
{
userData = new LoadVars();
userData.name = name;
userData.number = number;
userData.mail = mail;
userData.feedback = feedback;
userData.answer1 = answer1.getValue();
userData.answer2 = answer2.getValue();
userData.answer3 = answer3.getValue();
userData.city = city.getValue();
response = new LoadVars();
response.onLoad = getResponse();
userData.sendAndLoad("register.php", response, "post");
}
function getResponse(result)
{
if(result == true)
{
set("itemInstance.name", result.name);
set("itemInstance.mail", result.mail);
set("itemInstance.number", result.number);
set("itemInstance.feedback", result.feedback);
set("itemInstance.city", result.city);
set("itemInstance.answer1", result.answer1);
set("itemInstance.answer2", result.answer2);
set("itemInstance.answer3", result.answer3);
}
else
{
set("itemInstance.name", result.name);
set("itemInstance.mail", result.mail);
set("itemInstance.number", result.number);
set("itemInstance.feedback", result.feedback);
set("itemInstance.city", result.city);
set("itemInstance.answer1", result.answer1);
set("itemInstance.answer2", result.answer2);
set("itemInstance.answer3", result.answer3);
}
}
and here is my php
PHP Code:
<?
$name = $_POST['name'];
$number = $_POST['number'];
$mail = $_POST['mail'];
$feedback = $_POST['feedback'];
$answer1 = $_POST['answer1'];
$answer2 = $_POST['answer2'];
$answer3 = $_POST['answer3'];
$city = $_POST['city'];
// open connection to database
$connection = mysql_connect("localhost", "", "") or die ("Unable
to connect!");
mysql_select_db("") or die ("Unable to select database!");
// formulate and execute query
$query = "INSERT INTO feedback (name, number, email,
feedback, answer1, answer2, answer3, city) VALUES ('$name', '$number', '$mail',
'$feedback', '$answer1', '$answer2', '$answer3', '$city')"; $result = mysql_query($query) or die("Error in query: "
. mysql_error());
$name = 'Dan' ;
$city = 'Charleston' ;
$number = '88888' ;
$feedback = 'this is annoying' ;
$mail = 'crap@aol.com' ;
$answer1 = 'yes' ;
$answer2 = 'maybe' ;
$answer3 = 'no' ;
echo "&name=$name&city=$city&number=$number&feedback=$feedback&mail=$mail&answer1=$answer1&answer2=$answer2&answer3=$answer3";
// clean up
mysql_close($connection);
?>
thanks for any insight u might offer me
View Replies !
View Related
[MX04] Problems Passing Variables From FLASH To PHP
Hi:
I need some help here. I´ve done a form in flash. I´ve put several input text with the following instances names: nombre_txt, apellidos_txt, etc...this is the send function I´ve typed:
Code:
enviar = function () {
if (nombre_txt.length && apellidos_txt.length && nacimiento_txt.length && direccion_txt.length && localidad_txt.length && cp_txt.length && telefono_txt.length && email_txt.length && contactarle_txt.length && consulta_txt.length) {
if (email_txt.text.indexOf("@") != -1 && email_txt.text.indexOf(".") != -1) {
form_lv = new LoadVars();
form_lv.nombre = nombre_txt.text;
form_lv.apellidos = apellidos_txt.text;
form_lv.nacimiento = nacimiento_txt.text;
form_lv.direccion = direccion_txt.text;
form_lv.localidad = localidad_txt.text;
form_lv.cp = cp_txt.text;
form_lv.telefono = telefono_txt.text;
form_lv.mail = email_txt.text;
form_lv.contactarle = contactarle_txt.text;
form_lv.consulta = consulta_txt.text;
form_lv.sendAndLoad("http://www.financredit.info/send.php", form_lv, "POST");
consulta_txt.text = "Enviando su Consulta. Por favor, espere un momento...";
nombre_txt.text = "";
apellidos_txt.text = "";
nacimiento_txt.text = "";
direccion_txt.text = "";
localidad_txt.text = "";
cp_txt.text = "";
telefono_txt.text = "";
email_txt.text = "";
contactarle_txt.text = "";
form_lv.onLoad = function() {
if (this.estatus == "ok") {
consulta_txt.text = "Su Consulta ha sido enviada.";
nombre_txt.text = "";
apellidos_txt.text = "";
nacimiento_txt.text = "";
direccion_txt.text = "";
localidad_txt.text = "";
cp_txt.text = "";
telefono_txt.text = "";
email_txt.text = "";
contactarle_txt.text = "";
} else {
consulta_txt.text = "Problemas con el Servidor. Inténtelo de Nuevo.";
}
};
} else {
email_txt.text = "Correo Invalido";
}
} else {
consulta_txt.text = "Dato necesario";
nombre_txt.text = "Dato necesario";
apellidos_txt.text = "Dato necesario";
nacimiento_txt.text = "Dato necesario";
direccion_txt.text = "Dato necesario";
localidad_txt.text = "Dato necesario";
cp_txt.text = "Dato necesario";
telefono_txt.text = "Dato necesario";
email_txt.text = "Dato necesario";
contactarle_txt.text = "Dato necesario";
}
}
the "send.php" has the following:
Code:
<?php
if(isset($_POST["nombre"]) && isset($_POST["apellidos"]) && isset($_POST["nacimiento"]) && isset($_POST["direccion"]) && isset($_POST["localidad"]) && isset($_POST["cp"]) && isset($_POST["telefono"]) && isset($_POST["mail"]) && isset($_POST["contactarle"]) && isset($_POST["consulta"]) ){
$fecha = date("d-M-y H:i");
$mymail = "contacto@financredit.info";
$subject = "Nueva Consulta";
$contenido = "Sujeto: ".$nombre." ".$apellidos."
";
$contenido .= "Fecha de Nacimiento: ".$nacimiento."
";
$contenido .= "Vive en: ".$direccion.", ".$cp.", ".$localidad."
";
$contenido .= "Teléfono: ".$telefono."
";
$contenido .= "E-mail de contacto: ".$mail."
";
$contenido .= "Prefiere que se le contacte: ".$contactarle."
";
$contenido .= "Y su consulta es la siguiente:
";
$contenido .= $consulta."
";
$contenido .= "La consulta se escribió el ".$fecha;
$header = "From:".$mail."
Reply-To:".$mail."
";
$header .= "X-Mailer:PHP/".phpversion()."
";
$header .= "Mime-Version: 1.0
";
$header .= "Content-Type: text/plain";
mail($mymail, $subject, utf8_decode($contenido) ,$header);
echo "&estatus=ok&";
}
?>
Once clicked on the send button of the form, the message with the form arrives well, but it only APPEARS THE WRITTEN TEXT, NOT THE VARIABLES. What may be wrong? I´m really concerned about this. I need help, please.
View Replies !
View Related
Passing Variables From Flash To Php To MySql And Back Again Problem
hi everyone,
iv bin working on this piece of code for the last few days and theres just one tiny little piece that isn't working and iv no idea how!
im sending info from my flash file to php which retrieves info from mySQL database and then i want the database info to be displayed back in my flash file. Its doing all this correctly but when i want to display the database info in the flash file its not displaying it.
heres my php code.
<?PHP
if (isset($_GET["instructions_IDflash"] )) {
echo $_GET["instructions_IDflash"];
} else {
echo "$_GET["instructions_IDflash"] is not set";
}
$instructions_ID_number = $_GET['instructions_IDflash'];
$user_name = "root";
$password = "";
$database = "game";
$server = "127.0.0.1";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT instructions FROM main_instructions WHERE instructions_ID = $instructions_ID_number";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
$instrs = $db_field['instructions'] . "<BR>";
print "these are the instructions = " . $instrs;
}
print("&Data1=$instrs");
mysql_close($db_handle);
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
?>
the line 'print("&Data1=$instrs");' is posing problems. if i leave out the & sign it prints undefined in the flash text box, or if i leave out the $ sign instead it prints 'instrs' in the textbox, but it won't actually display the text thats bin loaded in from the database and stored in $instrs.
any ideas why? any suggestions would really be appreciated.
x C
my flash code looks like this if that helps
stop();
dataOut =new LoadVars
interval = setInterval(this, "pauseThis", 10000);
function pauseThis():Void {
dataOut.instructions_IDflash = 1;
//dataOut.sendAndLoad ("http://localhost/calc.php", "dataout","GET");
dataOut.send ("http://localhost/instructions.php", "dataout", "GET");
clearInterval(interval);
this.removeMovieClip();
}
//dataOut.onLoad = function(){
//trace(this.instructions_IDflash)
//}
//First we make a new loadvars object to hold
// the variables that are being loaded from the php file.
myData = new LoadVars();
//this is the part where we execute the
//function that handles the loaded data.
myData.onLoad = function(){
txtBox1.text = myData.Data1;
};
myData.load("http://localhost/instructions.php");
View Replies !
View Related
[MX04] Inserting Dynamic Variables Into LoadMovie In Flash
Here is what I want to do using flashVars
In my flashvars I have these variables "&p1char=Somedynamicname&p2char=somedynamicnam e"
Inside flash on the first frame of the movie I have this:
myurl = "http://www.mysite.com";
parta = myurl + p1char + ".gif";
partb = myurl + p2char + ".gif";
loadMovie(parta, _root.clipholdera);
loadMovie(partb, _root.clipholderb);
I want these gifs to load into two empty mc's I have on the stage with an instance name of clipholdera and clipholderb
Everything I've read says that the above should work, but it does not. I've made text boxes to verify the values of my variables and the whole URL with .gif" will show up. So what gives?
View Replies !
View Related
Send Variables From Flash 5 To Servlet And Get It Back In Flash
Does anyone know how to send variables to servlet in Flash?
I think I should use the loadVariables () to pass all the variables, but I'm not sure how to type in the URL part so that servlet can get them. My swf and servlet file are in different folders ... Must they be put in the same folder? Or I should use some XML formatting in transmitting data between Flash and servlet??? Please give me some help, thx a lot!!!
View Replies !
View Related
[MX04] Go One Level Back?
I have a movie clip which has another movie clip inside, I want to get information about the _x position of the container movie clip from the movie clip inside without using a full path.
how do I do that?
thanks.
View Replies !
View Related
[MX04] Back Button Issue (if ?)
Hey people...
I think this is an easy one for you guys, I have a simple back button within a gallery which works using the command;
on (release) {
prevFrame();
It works fine except when I reach my first image which is on the 3rd frame, if for some reason someone clicks back on the first image it will flash up with my preloader for a few seconds which is on frames 1 and 2. I know why it does this I'm just not sure how to construct the actionscript to have it stop on the 3rd image...I'm guessing it would go a little something like this;
on (release) {
prevFrame();
if (?????????) {
gotoAndStop(3);
}
}
I also have the problem with the Next button, I want it so when you are on the last image and you press next, the next Page (which will be a new Html) will open. I'm sure once my first question is answered I will be able to do this using the same principal.
Anyway hope someone can help...Cheers
View Replies !
View Related
Sending Variables From Flash To Php And Back To Flash
I am trying to send two String variables to php and from php back to Flash where i am trying to display them in TextField. The problem is that i keep geting this error:
Code:
Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
Here is my AS3 code:
Code:
var request:URLRequest = new URLRequest ("http://localhost/addUser.php");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.firstName = "FirstName";
variables.lastName = "LastName";
request.data = variables;
var loader:URLLoader = new URLLoader (request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
public function onComplete (event:Event):void{
statusTxt1.text = event.target.data;
}
And my addUser.php code:
PHP Code:
<?php
$fname = $_POST['firstName'];
$lname = $_POST['lastName'];
echo $fname;
?>
Can someone please help me on this?
thanks in advance,
cheers
View Replies !
View Related
|