Passing Flash Variable To Php
Hello guys!
im still newbie in server-side scripting and im just starting to learn php.. Here the problem i made flash form and im trying to use php as my server-side script.. im getting this error in my log file in php
Failed to Receive in C:Program_PHPwampwampwwwwebfinal_websiteema il.php on line 9
here is my code
<?php
$sendTo = "info@yahoo.com"; $subject = "My Flash site reply"; $headers = 'From: ' . $_POST["name"] . " "; $headers .= "Reply-To: " . $_POST["email"] . " "; $headers .= "Return-path: " . $_POST["email"]; $message = $_POST["message"]; mail($sendTo, $subject, $message, $headers);
?>
in flash i created 3 dynamic textfield.. with a var name of "name" first textfile. "email" second textfield and "message" third textfield.
please help me im stock.. what is the error.. my php or flash..
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-02-2007, 09:10 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Passing Flash Variable To PHP
Im trying to retieve a data from my Mysql database via PHP and using flash as my display arae. My problem is passing a varibale from flash to PHP. That can be done.But mine is not working. My scenario is this i have several button on a separate .swf file which load another .swf file to the rigth part of my stage whenever a button is hit and unload that movie and load another .swf file when other button is hit. here is a the code on each button
--------------------------------------------
on (release) {
_root.dostuff(x);
var id = "x";
loadVariables ("fetchclient.php?", "x.swf", "POST");
}
//where is is button number
//doStuff function does the loading and unloading of the movie
-------------------------------------------
now i want to pass var "id" to php, so that ill use that as a query id to retieve my data
here is the code for my PHP.Look at my query
-------------------------------------------
<?
// fetchcllient.php
// Define satabase connection details
$dbHost = "localhost";
$dbUser = "joseph";
$dbPass = "joseph123";
$dbName = "MDi";
$table = "clients_grp";
// Attempt to connect to MySQL server
$link = @mysql_connect($dbHost, $dbUser, $dbPass);
// Attempt to connect to MySQL server
$link = @mysql_connect($dbHost, $dbUser, $dbPass);
// If the connection was unsuccessful...
if (!$link)
{
// Report error to Flash and exit
print "&writeup=" . urlencode("Could not connect to server");
exit;
}
// Attempt to select database. If unsuccessfull...
if (!@mysql_select_db($dbName))
{
// Report error to Flash and exit
print "&writeup=" . urlencode("Could not select $dbName database");
exit;
}
// Build query to fetch client grp items from database
$query = "SELECT clients_grp.client_type, clients_grp.writeup, client.client_name
FROM clients_grp LEFT JOIN client ON clients_grp.client_grpid = client.client_grpid WHERE clients_grp.client_grpid = '$id'";
// Execute query
$result = @mysql_query($query);
if ($result && @mysql_num_rows($result) > 0)
{
// Initialise variable to hold client grp items
$writeup = "";
$client_type = "";
$client_name = "";
// For each client grp item returned from query...
while ($row = mysql_fetch_array($result))
{
$writeup .= '<font align="left" face="Arial, Helvetica, sans-serif" color="#003399" size="10"><b>';
$writeup .= stripslashes($row['writeup']);
$writeup .= '</b></font><br>';
$client_type .= '<font align="center" face="Arial, Helvetica, sans-serif" color="#003399" size="12"><b>';
$client_type .= stripslashes($row['client_type']);
$client_type .= '</b></font><br>';
$client_name .= '<font align="center" face="Arial, Helvetica, sans-serif" color="#003399" size="10"><b>';
$client_name .= stripslashes($row['client_name']);
$client_name .= '</b></font><br>';
}
print "&writeup=" . urlencode($writeup);
print "&client_type=" . urlencode($client_type);
print "&clientText=" . urlencode($client_name);
}
else
{
// Tell Flash no news items were found
print "&writeup=" . urlencode("No clients items yet");
}
// Close link to MySQL server
mysql_close($link);
?>
---------------------------------------------
when i run this i got the msg"No client items yet" and when i manually replace $id with a number say 1 it displays the content of my database to flash.What could be the problem ??Please help
Passing A Variable TO Flash FROM The URL
can i pass a variable INTO flash via the URL?
lets say on a splash page i want to put a link to HIGH and LOW quality flash movie.
the base swf if the same.. the LOW and HIGH quality is actually the loaded flash video.
in the base movie i would have something like
loadMovieNum(variableFromURL, "target");
is that possible? is there any script i need on the HTML page? browser version/platform limitations?
Passing Into Flash A Variable
Can someone please show me an easy piece of code that passes from the html a variable into a flash movie? Like if you wanted to pass in a username and then have that variable in flash.
Thank you very much.
Passing Variable From Flash To ASP
Hi all,
I'm just fixing a swf for a friend....it should be a quick fix.
Basically i have an input field in flash thet when the user clicks the button the following action is executed:
Code:
getURL("dosearch.asp?KEYS=" add val.text, _self);
The search works fine except when i seem to use special characters.
If i do a search for say
Ned's Head
it brings up an error but if i were to do:
Neds Head
it would search correctly.
My question is how do i escape special characters or do i have to do it in the ASP script. Because i have never used ASP can anyone tell me where i need to modify the script to allow special characters?
Here's the dosearch.asp
Code:
<%
'Dim rgKeys(20)
Dim rgKeys
Private nSrchType
Private nSrchRec
Private nRecs
nSrchType = VInt(Request("srch"))
nSrchRec = VInt(Request("srec"))
function GetKeys ()
Dim s,rg,i
Dim temp
s = Request("KEYS")
rg = split(s,",")
if (UBound(rg) = 0) then
rg = split(s,"+")
if (UBound(rg) > 0) then
'NOTYET - SET OPERATOR TO 'AND'
else
rg = split(s," ")
'NOTYET - DON'T SPLIT QUOTED STRINGS
end if
end if
rgKeys = rg
for i=0 to UBound(rgKeys)
rgKeys(i) = Trim(rgKeys(i))
if (left(rgKeys(i),1)="""") then rgKeys(i) = mid(rgKeys(i),2) end if
if (right(rgKeys(i),1)="""") then rgKeys(i) = left(rgKeys(i),len(rgKeys(i))-1) end if
rgKeys(i) = Replace(rgKeys(i),"'","''")
next
GetKeys = UBound(rgKeys)+1
End function
Private Function BuildWhere ()
Dim sWhere,sAge,sPrice,sBrand,sKeys,sImg,sAward,rgAge,rgPrice,i,nK,sKop,sKw
'build 'where' clause
'if more than one page, must track search clause or pass it in query to next
'page of results
sWhere = ""
sAge = ""
sPrice = ""
sBrand = ""
sKeys = ""
sImg = ""
sAward = ""
if (Request("AGE")<>"") then
rgAge = split(Request("AGE"),",")
if (rgAge(0)=0) then
sAge = "(nAgeFrom = 0)"
end if
if (rgAge(0)<>0) then
sAge = "(nAgeFrom >= " & rgAge(0)
if (rgAge(1)<>0) then sAge = sAge & " and nAgeFrom <= " & rgAge(1)
sAge = sAge & ")"
end if
if (rgAge(1)<>0) then
if (sAge<>"") then sAge = sAge & " and "
sAge = sAge & "(nAgeTo <= " & rgAge(1) & ") "
end if
end if
if (Request("PRICE")<>"") then
rgPrice = split(Request("PRICE"),",")
if (rgPrice(0)<>0) then
sPrice = "curPrice >= " & rgPrice(0) & " "
end if
if (rgPrice(1)<>0) then
if (sPrice<>"") then sPrice = sPrice & " and "
sPrice = sPrice & "curPrice <= " & rgPrice(1) & " "
end if
end if
if (Request("BRAND") <> "") then
sBrand = "sBrand in ("
for i=1 to Request("BRAND").Count
if (i>1) then sBrand = sBrand & "," end if
sBrand = sBrand & "'" & Request("BRAND")(i) & "'"
next
sBrand = sBrand & ")"
end if
'NOTYET - IF ONLY KEYWORDS, SEE IF KEYWORD IS A BRAND FIRST, IF SO, SHOW BRAND PAGE
'break into separate words
if (Request("KEYS")<>"") then
nK = GetKeys()'sets rgKeys
if (nK > 0) then
if (nK = 1) then
'check product code
sKeys = sKeys & "( (tblItems.id='" & rgKeys(0) & "') or "
end if
sKeys = sKeys & "("
sKop = Request("KEYS_HOW")
if (sKop="") then sKop="and"
for i=0 to nK-1
if i>0 then sKeys = sKeys & " " & sKop & " " end if
sKw = rgKeys(i)
sKeys = sKeys & "( (sText2='" & sKw & "') or (sName like '%" & sKw & "%' "
sKeys = sKeys & "or (sDesc is not null and sDesc like '%" & sKw & "%' ) "
sKeys = sKeys & "or (sDesc2 is not null and sDesc2 like '%" & sKw & "%' ) "
sKeys = sKeys & "or (sDesc3 is not null and sDesc3 like '%" & sKw & "%' ) "
sKeys = sKeys & "or (sDesc4 is not null and sDesc4 like '%" & sKw & "%' ) "
sKeys = sKeys & "or (sKeywords is not null and sKeywords like '%" & sKw & "%' ) ) )"
next
sKeys = sKeys & ")"
if (nK = 1) then
sKeys = sKeys & ")"
end if
end if
end if
if (Request("IMG")<>"") then
if (Request("IMG")="1") then
sImg = " bHavePic<>0 "
end if
end if
if (Request("AWARD")<>"") then
if (Request("AWARD")="1") then
sAward = " (sAwards is not null and sAwards<>'') "
end if
end if
sWhere = "where bShow<>0 "
if (sAge <>"") then
sWhere = sWhere & " and "
sWhere = sWhere & "(" & sAge & ") "
end if
if (sPrice <>"") then
sWhere = sWhere & " and "
sWhere = sWhere & "(" & sPrice & ") "
end if
if (sBrand <>"") then
sWhere = sWhere & " and "
sWhere = sWhere & "(" & sBrand & ") "
end if
if (sKeys <>"") then
sWhere = sWhere & " and "
sWhere = sWhere & "(" & sKeys & ") "
end if
if (sImg <>"") then
sWhere = sWhere & " and "
sWhere = sWhere & "(" & sImg & ") "
end if
if (sAward <>"") then
sWhere = sWhere & " and "
sWhere = sWhere & "(" & sAward & ") "
end if
BuildWhere = sWhere
end function
Private Sub Search
Dim sql,sql2
Dim s,sWhere
sql = ""
if (nSrchType) then
're-execute query
else
'Starting a new Query
sWhere = BuildWhere
'use separate connection because we need a static cursor
sql = "select distinct tblItems.id,sName,sSmallSize,tblItems.sBrand,bHavePic from tblItems inner join tblCodes on tblItems.sBrand=tblCodes.sText " & sWhere & " order by bHavePic desc,tblItems.id asc;"
'Response.Write sql
'STORE THE SEARCH TEXT
if (Request.Cookies("GRPERSON")="") then
s = Request.ServerVariables("QUERY_STRING")
sql2 = "insert into tblSearch (dtSearch,sSearch) values ("
if (gbWeb) then
sql2 = sql2 & "getdate()"
else
sql2 = sql2 & "Now()"
end if
sql2 = sql2 & ",'" & s & "')"
conn.Execute(sql2)
end if
end if
call Results(sql,nSrchType,nSrchRec)
end sub
%>
Regards,
Suzy
Passing Variable To Flash
OK, so I have a flash page that i want an .asp to tell it what to do.
we have the first frame in the flash with this:
loadVariables("myscript.asp", 0);
if (flag="on") {
gotoAndPlay(20);
}
and out .asp is saying:
<% flag="on"
%>
But when I play the movie it's not going to frame 20!!!
Anyone help???
Passing Variable From Flash To ASP
Hi there...
I'm trying to get variable 'score' from Flash to my ASP-page, but it ain't working...
This is the code in flash
[as]
on (release) {
var score
score = total
getURL("index.asp", "_top", "GET");
}
{/AS]
'Total' is a number in my game.
And I'm using this in my ASP-page: request.querystring("score")
I this the correct way or is the a better way to pass values from flash to asp?
Thnx
Passing Variable In Flash
i have a flash movie which redirects to a url
i just need to pass a variable to the flash and have it put that variable in the geturl so i can get it with php after the redirect.
like this
like
www.something.com/flash.swf?refer=flashkit
then the flash needs to put the variable in the get url
like geturl (http://yaddayadda.com/variable=variable
shouldnt be too hard.
Passing A Variable From Php To Flash
So I'm trying to pass a variable back to flash with php, however when I trace it, it comes up as undefined.
heres my flash code.
Code:
info = "infocheck.php";
loadVariablesNum(info, 10);
trace ($send_answer);
Code:
on (release) {
if(capture == "yes"){
status_e = "Please fill in the required fields";
//loadMovieNum("products_swf/infocatch.swf", 122);
} else {
status_e = capture;
trace (capture);
}
}
heres my php code
Code:
<?
// query to check if the user's info has been previously obtained
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = $REMOTE_ADDR;
$capture = "0";
$result = mysql_query("SELECT * FROM download WHERE ip = '$ip'");
$row=mysql_fetch_array($result);
$countrows = mysql_num_rows($result);
if($countrows == NULL) {
$capture = 'no';
echo "$capture";
} else {
$capture = 'yes';
echo "$capture";
}
?>
Passing A Variable To Flash
hi guys,
i'm sure this is a routine thing but i've never come across it before, i want to use one movie, with multiple starting positions (i.e. my movie will contain the navigation section of the site and depending on the page, a different tab will be highlighted)
is there a way to pass it a quick variable from the html that it can feed off to decide which page its on?
[F8] Passing Variable From Flash To Php
I have checked everywhere and thought I had this correct, but still does not work. I have a page that is protected with php sessions. Here is the code:
<?
session_start();
if ( empty( $first_name ) ) {
include 'http://www.sitename.com/db.php';
include 'http://www.sitename.com/index.html';
}
else
{
?>
<html>
...rest of page...
I have a flash movie with a password box that depending on what password you put in (called from external text file) takes you to a different URL. Works fine. But, when I redirect the URL to the above PHP site, it redirects back to index.html and asks for the password. SO, what I wanted to do was to pass a variable (just some variable to that $first_name would not be empty and it would show the page).
Here is the actionscript:
if(password==firstpass){
password="";
myLoadVars=new LoadVars();
myLoadVars.myvar="thevariable";
myLoadVars.sendAndLoad("http://www.sitename.com/PHPpage/index.php", myLoadVars, "POST");
getURL("http://www.sitename.com/PHPpage/index.php");
//
}else{
...rest of actionscript...
and the .../PHPpage/index.php says this:
<?
session_start();
$first_name = $_POST['myvar'];
echo "
<script type='text/javascript'>
alert('The variable has the following value: $first_name');
</script>
";
if ( empty( $first_name ) ) {
include 'http://www.sitename.com/db.php';
include 'http://www.sitename.com/index.html';
}
else
{
?>
<html>
...rest of page...
The echo was put to see if the $first_name was assigned, but it comes up blank and goes back to the sitename index page to login.
What am I doing wrong?
Thanks
Doc
Help Passing Variable From PHP To Flash
Hi All,
I have researched this topic extensively but to no avail. I want to pass a variable from php (where the .swf is embedded) to the .swf. The variable comes from the qurery string.
Here is what I have:
.php
PHP Code:
$id = $_GET["id"];
further down...
<param name="movie" value="~gallery1.swf?<? echo "var1=$id"; ?>"/>
<embed src="~gallery1.swf?<? echo "var1=$id"; ?>"...
This seems to work as it should. Looking at the source code, the variable shows up.
.swf
PHP Code:
var link = var1+"/images.xml"
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(link);
I've tried everything but dancing on my keyboard to get .php to pass the variable to flash but nothing seems to work.
Help Please!!!
Passing A Variable To Flash Through A Url
Hello, I would like to be able to pass a variable to flash through a link.
For example[as]theLink.onPress=function(){
getURL("aboutUs.php?page=about" , "_self");
}
Now, what would I have to write in the HTML/PHP to grab this variable an pass it to my Flash navigation?
I have done this before, but it was years ago.
Something with flashVars?
thanks
Passing A Url Variable To Flash
Hello, I have done this before but now I can't figure it out. Basically I have a php page with a Flash nav. When the link is click, a variable is appended to the url, for example:
ActionScript Code:
http://www.caillouette.com/AspenWags/catalog/index.php?cPath=43
So, in the PHPthat holds the Flash movie I have the following:
ActionScript Code:
<?php
$cPath= $_GET['cPath'];
?>
<div align=center>
<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="800" height="100" id="nav" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="nav.swf?cPath=<?php echo $cPath ?>" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />
<embed src="HTTP://WWW.CAILLOUETTE.COM/AspenWags/catalog/includes/nav.swf?cPath=<?php echo $cPath ?>"
flashVars="cPath=<?php echo $cPath ?>" quality="high" bgcolor="#ffffff" width="800" height="100" name="nav" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
The correct variable is showing up, but Flash isn't grabbing it.
In the Flash app I have:
ActionScript Code:
if (cPath==21){
_root.people_sub_sub_navMC.ySlideTo(55.5, .4, "linear");
_root.people_sub_sub_navMC.people_tilesBN.gotoAndStop("over");
_root.people_sub_sub_navMC.people_clothingBN.gotoAndStop("up");
}
else if(cPath==43){
_root.people_sub_sub_navMC.ySlideTo(55.5, .4, "linear");
_root.people_sub_sub_navMC.people_clothingBN.gotoAndStop("over");
_root.people_sub_sub_navMC.people_tilesBN.gotoAndStop("up");
}
else{
_root.people_sub_sub_navMC.ySlideTo(72.0, .4, "linear");
trace ("doesn't work");
}
but none of my Flash commands in the "if else" statement work, not even the final "else statement."
Any ideas?
thanks
</object></div>
Passing Variable In Flash
Hi,
I am trying to pass a variable in Flash(MX2004) but struggling with it.
can anyone please point out my fault,I am very bad at scripting.
This is my code in html:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub...ersion=7,0,0,0" width="550" height="400" id="dtext" align="middle">
<param name="allowScriptAccess" value="sameDomain">
<param name="movie" value="dtext.swf?texts=welcome">
<param name="quality" value="high">
<param name="bgcolor" value="#ffffff">
<embed src="dtext.swf?texts=welcome" quality="high" bgcolor="#ffffff" width="550" height="400" name="dtext" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
and this is my code in flash:
_root.onLoad();
main.loadMovie(_root.texts);
where 'main' is a movie clip which conatins a variable called 'texts' to show the text entered in the html
Thanks very much.
kedar
Passing Variable Into Flash
i'm trying to play a soundfile from external source passing a varible into flash which is called through php.the reason for doing this is without making changes in flash scripting i can play any sound just changing the file name in html. for the refernece i have attached .fla file and also the source code i have used in php. please help me to make it work.
can i do this this way?
source code are ....
in flashfile
//soundUrl = "http://jennl.com/mp3/10011.mp3";
// create sound object, assign properties and events
function createSoundObject(){
translation = new Sound(); // define sound object
return;
}
// create initial sound object
createSoundObject();
// load and/or play song
function playSnd(){
// check playstate
if(isPlaying){
status = "playing";
return; // deactivate button during play/load
} else {
isPlaying = true;
}
translation.loadSound(soundUrl,true); // sound automtically plays afer loading
status = "loading";
onEnterFrame = showPlayState; // start tracking playstate
}
// stop both playback and download
function stopSnd(){
translation.stop(); // stop playback
delete translation; // stop download
createSoundObject(); // create a new sound object
isPlaying = false;
onEnterFrame = null; // stop tracking playstate
status = "stopped";
title = "hit play";
}
// pause sound
function pauseSnd(){
translation.stop();
isPlaying = false;
onEnterFrame = null; // stop tracking playstate
status = "paused";
}
stopSnd();
// assign button events
playBtn.onRelease = function () {
playSnd();
}
pauseBtn.onRelease = function () {
pauseSnd();
}
stopBtn.onRelease = function () {
stopSnd();
}
stop(); // prevent timeline looping
php codes are ..............
<object classid='clsid27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='70' height='18' id='player' align='middle'> <param name='allowScriptAccess' value='sameDomain' /> <param name='FlashVars' value='soundUrl=../mp3/10011.mp3'> <param name='movie' value='/flash/player.swf' /> <param name='quality' value='high' /> <param name='bgcolor' value='#ffffff' /> <embed src='/flash/player.swf' quality='high' bgcolor='#ffff00' width='150' height='100' name='player' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /> </object>"
Passing Variable Into Flash
i'm trying to play a soundfile from external source passing a varible into flash which is called through php.the reason for doing this is without making changes in flash scripting i can play any sound just changing the file name in html. for the refernece i have attached .fla file and also the source code i have used in php. please help me to make it work.
can i do this this way?
source code are ....
in flashfile
//soundUrl = "http://jennl.com/mp3/10011.mp3";
// create sound object, assign properties and events
function createSoundObject(){
translation = new Sound(); // define sound object
return;
}
// create initial sound object
createSoundObject();
// load and/or play song
function playSnd(){
// check playstate
if(isPlaying){
status = "playing";
return; // deactivate button during play/load
} else {
isPlaying = true;
}
translation.loadSound(soundUrl,true); // sound automtically plays afer loading
status = "loading";
onEnterFrame = showPlayState; // start tracking playstate
}
// stop both playback and download
function stopSnd(){
translation.stop(); // stop playback
delete translation; // stop download
createSoundObject(); // create a new sound object
isPlaying = false;
onEnterFrame = null; // stop tracking playstate
status = "stopped";
title = "hit play";
}
// pause sound
function pauseSnd(){
translation.stop();
isPlaying = false;
onEnterFrame = null; // stop tracking playstate
status = "paused";
}
stopSnd();
// assign button events
playBtn.onRelease = function () {
playSnd();
}
pauseBtn.onRelease = function () {
pauseSnd();
}
stopBtn.onRelease = function () {
stopSnd();
}
stop(); // prevent timeline looping
php codes are ..............
<object classid='clsid27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='70' height='18' id='player' align='middle'> <param name='allowScriptAccess' value='sameDomain' /> <param name='FlashVars' value='soundUrl=../mp3/10011.mp3'> <param name='movie' value='/flash/player.swf' /> <param name='quality' value='high' /> <param name='bgcolor' value='#ffffff' /> <embed src='/flash/player.swf' quality='high' bgcolor='#ffff00' width='150' height='100' name='player' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /> </object>"
Passing A Variable To Flash From Php?
I have been reading all the post on this topic, but i just do not seem to get it! I am trying to send the variable "folder" to a flash file and get the flash file to recognize it. i am using the loadVariables() command to get the variable, but i am not sure how to process it to where i can use the variable later in the actionscript. can someone post an example script to show how to process a variable sent from php to flash???? Pleeeeeeeeeeeeaaaaseeeee!
Thanks!
Tim
Passing A Variable To Flash
Hi,
I'm pretty new to AS3 and although I keep seeing the same solution all over the forums, I can't seem to get my flash movie to work properly.
I'm trying to pass a parameter id from a URL to my movie...for example:
http://www.mysite.com/xmas_2111.swf?id=3
Here is the AS code:
Code:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
var idString:String = root.loaderInfo.parameters.id;
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest
("xmas.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseNames(xmlData);
}
function ParseNames(nameInput:XML):void {
var nameRecipient = nameInput.Recipient.(@id == idString).firstname;
firstname.text = nameRecipient;
var nameSender = nameInput.Recipient.(@id == idString).sender;
sender.text = nameSender;
var titleSender = nameInput.Recipient.(@id == idString).title;
jobtitle.text = titleSender;
}
And here is the html code where the flash movie is embedded:
<script type="text/javascript">
Code:
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','550','height','400','src','xmas_2111','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','xmas_2111' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="550" height="400">
<param name="movie" value="xmas_2111.swf" />
<param name="FlashVars" value="id=1" />
<param name="quality" value="high" />
<embed src="xmas_2111.swf" FlashVars="id=1" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="400"></embed>
</object></noscript>
If I comment out this line in the actionscript:
Code:
var idString:String = root.loaderInfo.parameters.id;
then replace it with a value like this:
Code:
var idString:String = "3";
it reads the correct elements from my xml file as hoped!
I just can't seem to take the id value from the query string and pass it to the variable idString...so, so frustrating!
Any suggestions are most welcome.
Cheers,
W
Passing Variable In Flash
Hi,
I am trying to pass a variable in Flash(MX2004) but struggling with it.
can anyone please point out my fault,I am very bad at scripting.
This is my code in html:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub...ersion=7,0,0,0" width="550" height="400" id="dtext" align="middle">
<param name="allowScriptAccess" value="sameDomain">
<param name="movie" value="dtext.swf?texts=welcome">
<param name="quality" value="high">
<param name="bgcolor" value="#ffffff">
<embed src="dtext.swf?texts=welcome" quality="high" bgcolor="#ffffff" width="550" height="400" name="dtext" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
and this is my code in flash:
_root.onLoad();
main.loadMovie(_root.texts);
where 'main' is a movie clip which conatins a variable called 'texts' to show the text entered in the html
Thanks very much.
kedar
Passing Variable For Flash
Hi guys, i'd like know if someone know how i can pass a variable from a PHP page for a swf.
This is the problem:
I have a page than has a menu in flash and your content in html. When i hit a button at menu, the menu send a variable for php and the php insert the a page into the index.php. Well all right so far, but the problem is than all time than php include a new content the menu is animated again.
The possible solution.
I'd like send a variable to swf than will perform the animation just one time. What i was thinking.
At the flash this would control the animation.
Code:
function callAnimation(_extVariable:Boolean):void
{
if(_extVariable)
{
this.menuAnimation()
}
}
Something like this is possible?
Passing A Variable From Flash To An Url
hello gang
i am looking for a solid way to make this idea to work
my set up is this
btn.onRelease = function(){
thefile = "whatever.pdf"
theurl = "myhost.com/"
getURL (theurl+thefile,"_self","POST")
}
that's pretty standard stuff
so i thought, ok if that is possible lets try this
btn.onRelease = function(){
thelocation = "in the navy"
theurl = "myhost.com/"
getURL (theurl + "#" + thelocation ,"_self","POST")
}
this works for like 75%, i can clearly see that it adds what i code here
but my browser crashes on it. all i want to do is add a certain location to an url while the swf remains on the same page
aka some kind of crumbreads you often see on standard html/php sites
fe. http://mysite.com#yadiyadi
i know the method iam doing above isn't very good, so anyhelp is welcome
i am trying to avoid javascripts because as far as i know it doesn't work very solid on macintosh
my client clients(sounds dull) are mainly mac users.
i know i'll have to use some switch cases to make this thing work propperly thus to load the correct swf if you try to bookmark that, and wish to load it again so that isn't the problem
i've been trying to roam the web in order to find the sollution but since i don't know how this is called i am hitting rockbottom
thank you
Passing Variable From FLash To ASP
I currently have a form on a page that allows you to search a database for all information on certain states. From a drop down jump menu it passes that variable of which state you selected into an ASP query. I am building a interactive map in Flash that I would like to replace the drop down menu. So when you rollover a state it lights up and when you select it it passes the variable into the ASP query. Does anyone know how to do this out of FLash?
IMMEDIATE NEED: Javascript -> Flash Variable Passing
right, any help here would be mucho appreciato.
Basically, what I have got is 2 flash movies on a CDROM [don't ask me about this, I'm picking up someone elses project].
What I need to do is do some processing in one and then call a javascript function. No big deal fscommand or getURL works fine for this. What I need to do AFTER this though is call a function in the OTHER flash movie, passing some variables across [I can make them all one if necessary and split them later].
In Flash you can use the asfunction:funcName,param in a piece of HTML enabled text... I am wondering if this is doable though...
Need this info now as I'm against a deadline...
please email me direct on andyf@reshouselane.co.uk
Cheers,
Andrew Fisher
Passing A Variable FROM Flash To ASP Using An Image
I have an image in my movie that needs to call an asp page like this...
mypage.asp?variable=value
I have tried getURL and just adding my variable onto the end but it gets stripped off.
I also tried Load Variables but I don't think this is the right way for me to achieve what I want (I couldn't get it to work anyway!)
Can someone shed some light on this for me.
Cheers,
Rob
Passing A Variable From Html Into Flash
Hi there I am new to flash (my excuse just in case this question is stupid) and I am using a number of different html pages to call up a single html page with a .swf file. I would like to pass a variable which is individual to the initial page into a text field on to the .swf and I wondered if that was possible.
All that is important for me is that the html page that calls up the flash file passes a variable (which has already been declared in one of the flash programs textfield)and it appears in that text field
HELP!!
Dave
Passing Variable From HTML To Flash
Hi
I realize there are a couple of other threads on this topic but after trying suggested solutions I still cannot get this to work correctly in IE and Netscape!
My setup is really simple:
three HTML pages, each with a different variable being sent to the same SWF file which (hopefully) will do different things.
At the moment I am using this method:
On page 1 <PARAM NAME=movie VALUE="mymovie.swf?value1">
On page 2 <PARAM NAME=movie VALUE="mymovie.swf?value2">
On page 3 <PARAM NAME=movie VALUE="mymovie.swf?value2">
Then in the Flash movie:
s = unescape(_url);
location = s.substr(s.indexOf("?")+1, s.length);
Which retrieves the value given on each page.
This works great for IE but NOT for Netscape
If you have any suggestions I would be greatful.
BTW the site in question is:
http://www.globalbackpackers.com
(As you can see...All I am really interested in doing is changing the behavior of mymovie on the basis of the choice of three locations.
Thanks in advance
Passing A JavaScript Variable (or CF) Into Flash(5)
Hi, this may be a simple question, but it isn't something I have attempted yet. I was hoping maybe someone could point me in the right direction.
I will be working on project soon that will involve a flash masthead. Within that masthead will be links to different sections of the site. Using javascript or cold fusion to assign sectionID variables on each page of the site: say section one pages all have sectionID="sec1" for their sectionID. Is it possible to pass that value into the flash masthead on each page? So that when the user is in that section, that link in the flash masthead could be hi-lited or deactivated.
Any ideas or suggestions? Thanks!
Passing A Numerica Value To A Flash Variable
I feel so stupid asking this, but i have the hardest time understanding how variables work in flash. i'm using flash MX and i'm trying to evaluate a value i get from a ColdFusion query.
How does flash know if an item is a variable name or not? I am passing it the variable MaxStories from a query that contains a number. I then try to use it inside flash in a conditional statement:
if (flashid == MaxStories) {blah blha...
basically, it can't evaluate this statement.
If i write:
if (flashid == 5) {blah blha...
then it works. what am i doing wrong?
Passing A Variable From Flash To Html
This may be more of a javascript question but...
I am trying to pass a variable from a flash (5) file to an html file and have it appear in the html file.
The variable is in the root timeline:
score = 80;
I am using the get url action:
getURL ("jump.html", "", "GET");
When I run it in the browser, it appears to be passing the variable, as the browser location field displays the following:
file:///C:/test/jump.html?score=80
Then in the html I'm using the following:
<p align="center">You've passed with a score of <script>document.write(score);</script> %.</font></p>
but in th browser, it just displays as:
You've passed the course with a score of undefined %.
Any suggestions would be greatly appreciated!
Passing Variable From Js To Flash In Explorer
I need to pass variables from js to flash and all script I made are working well in netscape (4.5 to 6). Obviously (sic!) this isn't true in explorer (5.1.x to 6) (mac) . Also the sample from macromedia faq doesn't work with explorer...There's no any information about this
problem in macromedia, microsoft, flashkit and other support centers or forum... I can't think nobody discover this issue. Please, if something know the solution, tell me...thanx
Passing A Variable From Flash To JavaScript
Okay so I know that this method works in an instance where I'm not passing a variable to the Javascript - now that I'm passing a variable I get an error when loading the file from the html page where the javascript resides. It says that fileName is undefined... fileName is a dynamic text box in the flash movie that stores a filename. When I call the javascript using
getURL("javascript:loadLocation(fileName)");
when I click on the button, I get an error that says fileName is undefined. any idedas? The JS and AS is below:
function spawnLocation(file){
some instructions;
}
on release(){
getURL("javascript:loadLocation(fileName)");
}
Cole
Passing Javascript Variable To Flash
I got a function in javascript that goes like this:
< script language="JavaScript" type="text/JavaScript">
function passFlashT(){
window.document.port.SetVariable("javascript", "true");
)
< /script>
I also have:
< object name="port" id="port">
< embed name="port" id="port" SwLiveConnect="true">
But Flash doesn't seem to be taking the variable. Is there something in the Flash file that I need to do other than:
code:
if(javascript == "true"){
dosomething;
}
Passing A Variable From Flash To Javascript
I would like to pass a the following from flash to javascript. I want to be able to have flash write the following javascript in a defined location. Does anyone know of a good example of this?
So far here is what I have
Flash
===============
fscommand("call_alert", "Hello world!");
Javascript
===============
function news_DoFSCommand(command, args) {
if (command == "call_alert") {
alert("" + args);
}
}
I want it to document.write my fscommand, but every attempt crashes the browser.
Thanks,
--j
Passing Checkbox Variable - Flash 8
Hi,
I'm hoping someone can help me with this. I've scoured the forums and can't seem to find exactly what I need. I have a 'request quote' form, some of the fields are checkboxes.
I know that I can no longer use the getValue();. But i'm having trouble understanding how to pass the variable using the listener. The examples i'm finding seem to be more for triggering events when the checkbox is selected. I just need to send my variables to an asp page. My combobox & text fields work great, my checkboxes come back undefined.
Thanks for any help with this.
Quote:
on (release) {
sitedesign = sitedesign_ch.selected;
siteredesign = siteredesign_ch.selected;
ecommerce = ecommerce_ch.selected;
contentmgt = contentmgt_ch.selected;
programming = programming_ch.selected;
seo = seo_ch.selected;
hosting = hosting_ch.selected;
flashdesign = flash_ch.selected;
logodesign = logo_ch.selected;
printwork = print_ch.selected;
heardabout = hearabout_cb.selectedItem.label;
loadVariablesNum("_sendQuoteEmail.asp", 0, "POST");
}
[MX] Passing Variable From Flash To Oracle
Hello there...
I have one variable attached to a button that I want to submit to an oracle file when pressed. I;ve tried to use getURL as such to call the oracle and pass the value, but it looks to pass more than just my one var and causes a file not found error.
on (press) {
getURL ("http://cmc.koppers.com/extranet/submit_selection","_blank","POST");}
In this case x has been set to 21. On submit it expands the link, and this shows up in the browser..
http://cmc.koppers.com/extranet/subm...ject+Object%5D
but, if i cut this link down to just http://cmc.koppers.com/extranet/submit_selection?x=21
this works. So I guess my question is, can I use getURL to just send the bolded above without the extra format and object data... or is there a better way to pass this one variable to Oracle.
Thanks in advance...
Steve
Problem Passing Variable Between Flash And PHP
Hi there,
I've tried to write a very simple script in as3 and PHP, but for some reason it is not working.
Please could you take a quick look at my php to see if i have done it correctly. Any help is much appreciated!
getProductData3.php
Code:
Code:
<?php
@require_once ('database.php');
getProductData3($_POST['varEmail']);
function getProductData3($email, $currency) {
$sql = "SELECT * FROM `Saved_Products` WHERE `Saved_Products`.email = '".$email."' ";
$result = mysql_query($sql);
$count = 0;
while($row = mysql_fetch_array($result)){
echo "product_name$count=".utf8_encode($row[product_name])."&product_descr$count=".utf8_encode($row[product_descr])."&";
$count++;
}
echo "count=$count"."&";
}
?>
inside my flash file:
Code:
Code:
function getProductData() {
var theVariables:URLVariables = new URLVariables();
theVariables.varEmail = MovieClip(parent).globalUserAccount;
var theRequest:URLRequest = new URLRequest();
theRequest.url = "getProductData3.php";
theRequest.method = URLRequestMethod.POST;
theRequest.data = theVariables;
var theLoader:URLLoader = new URLLoader();
theLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
theLoader.addEventListener(Event.COMPLETE, loadCompleteHandler);
theLoader.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
theLoader.load(theRequest);
function handleIOError(event:IOErrorEvent):void{
event.target.removeEventListener(IOErrorEvent.IO_ERROR, handleIOError);
}
function loadCompleteHandler(evt:Event):void {
MovieClip(root).mcMessage.showMessage("count result: "+evt.target.data.count);
MovieClip(root).mcMessage.visible = true;
}
}
I am not getting any result in my trace mc... it just does nothing.
to my eye, the flash code is correct
My weakness is with the php and i think i've put something out of place there.
I have mysql and php working 100% well with the rest of the project. so it's not a problem is not with that
Any help is really appreciated!
Thanks a lot
Passing A Variable To Flash Problem [AS2]
Hello,
I'm passing a variable to flash like so:
Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="124" height="234">
<param name="movie" value="images/3cardsglow.swf?page=firstpage">
<param name="quality" value="high">
<embed src="images/3cardsglow.swf?page=firstpage" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="124" height="234"></embed>
</object>
Now inside of my first frame in flash I have:
Code:
stop();
onEnterFrame = function() {
gotoAndStop(page);
delete this.onEnterFrame;
}
I have a frame in Flash CS3 named "firstpage". However when I run this script on my server it doesn't work. The variable doesn't get passed to flash.
Is there a different script I should be using in flash???
Passing A Variable To Flash Via Url String
I understand how to get a variable into flash when it's hard coded into the html using Flashvars or this is how I do it with SWFObject:
where variable: location=subdirectory
Code:
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("featuredviewer.swf", "featuredviewer", "620", "480", "8", "#fff");
so.addVariable("location", "subdirectory");
so.write("logo");
// ]]>
</script>
What I don't understand and can't find is how to do this...
I have an html file with an swf in it. Different buttons in the file open a popup window via javascript. I want to pass a variable to the swf in the pop up window, possibly like this:
Code:
on (release) {
getURL("javascript:Launch('featuredviewer.html?position=one')");
}
But how do you extract the variable position=one out of the url and get it into flash?
Passing Variable From Link To Flash
Hello-
I had a question for passing variables from an html page into flash. Currently I have an index page that has various links that I want to attach a variable number to. Once the links are clicked, I will have a media player open up in a popup window and depending on the number in the variable will play a certain video.
Currently the media player initiates and plays whatever the current selected index is at, so my goal is to just create a variable for the selected index number and that variable will be dependent on the passed in variable from the link.
How do I do this? More specifically, how do I pass a variable from an html link into flash?
Passing Variable Through .INI File To Flash
Hello ,
I stucked into one problem Actually I want to load the "Image " Dynamically inside flash without hard Coding it.
I want that it should read the variable from any other file like .XML,.HTML,.INI etc so that user can change the name ...resulting the desire image to load inside Flash.
I have used two code.
loadVariables("VIPLOGO.png", "THEIMAGE");
import flash.display.BitmapData
/var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
/var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("VIPLOGO.jpg",container);
This loading the hard coded image file name. Which i dont want.
and the other is
var myStyle:TextField.StyleSheet = new TextField.StyleSheet();
//myStyle.load("master.css");
content_txt.styleSheet = myStyle;
content_txt.multiline = true;
content_txt.wordWrap = true;
content_txt.html = true;
var story:XML = new XML();
story.ignoreWhite = true;
story.load("images.html");
story.onLoad = function() {
content_txt.htmlText = story;
};
its reading the HTML file but in this I have made the CSS file as comment and the problem coming with this is the image is not coming at desire place.
I want any a simple method , So that a layman can also change the file name and that should effect the Flash Movie.
Please help me out!
Thanks!
Passing Checkbox Variable - Flash 8
Hi,
I'm hoping someone can help me with this. I've scoured the forums and can't seem to find exactly what I need. I have a 'request quote' form, some of the fields are checkboxes.
I know that I can no longer use the getValue();. But i'm having trouble understanding how to pass the variable using the listener. The examples i'm finding seem to be more for triggering events when the checkbox is selected. I just need to send my variables to an asp page. My combobox & text fields work great, my checkboxes come back undefined.
Thanks for any help with this.
Quote:
on (release) {
sitedesign = sitedesign_ch.selected;
siteredesign = siteredesign_ch.selected;
ecommerce = ecommerce_ch.selected;
contentmgt = contentmgt_ch.selected;
programming = programming_ch.selected;
seo = seo_ch.selected;
hosting = hosting_ch.selected;
flashdesign = flash_ch.selected;
logodesign = logo_ch.selected;
printwork = print_ch.selected;
heardabout = hearabout_cb.selectedItem.label;
loadVariablesNum("_sendQuoteEmail.asp", 0, "POST");
}
Flash Passing Variable Question
This may seem like a stupid question but I am having passing a variable from one swf to another. I have my main swf called "main.swf" calling "technology.swf." Once "technology.swf" opens I need it to set a variable that "main.swf" will see. Usually the way I would handle this is with a global variable but it seems like it only works if "main.swf" sets the variable and "technology.swf" but it won't work the other way around. I used "loadMovieNum("technology.swf", 1) to call the second movie in case that helps. Any help would be greatly appreciated.
Passing A Secure Variable From Flash To PHP
Hi there,
Does anyone know a 100% secure way to transfer a variable from Flash to PHP. I have a SSL on my site, but I've been told that using the loadvars cmd is about as unsecure as you can get, even if your page is secure.
One of the suggestions was Flash Remoting, can anyone confirm that this is a safe way to send a secure variable? If not, does anyone have any other suggestions?
Any help appreciated!
Also, thanks to Josh Jonah for his help so far
Passing Variable From Html To Flash
I would appreciate if someone could tell me any suggestion about why a simple example that I did to pass a variable from html to flash doesn't display in the website the value passed from html.
I have attached the example.
Thanks in advance
Passing Variable To Flash Movie
Hello
I have a problem passing a variable from an url.
We want only one swf file.
The .htm file that has the code for the SWF will dynamically append a category ID to the end of the flash code, ie <param name='movie' value='/flash/show.swf?cat=X' /> etc..
THEN, when the SWF file is called, i want actionscript to load the variable 'cat'. Once in loaded, i want to use it in another line of our actionscript: file..
myXML.load("images/show.htm?cat=x");
I'm having trouble with the syntax to do load the variable, and place it within the other actionscript string.... can someone help ?
Passing A Variable From Flash Into An ASP.net MultiView, How?
This is one for Flash and ASP.net guys:
I've made a flash map with clickable (buttons) Postcode areas. Wehn the user makes a selction I want the postcode to be passed into an ASP.net page where the all the details relating to that postcode will be pulled from the database.
i want the results to display alongside the map so as to keep the site neat and simple. So i have created a multiview, View1 displays Current site News, View2 displays the results of a search bar i have implemented just below the site banner. I want View3 to display results from the Map- what is the code I use in Flash to do this?
Maybe there is a better way?
Thanks in advance.
Passing Variable From Flash To Html Then To (?)VB
i have this crazy program that requires variables assigned in Flash, for example
varNumber = 1;
passed to an HTML page called 'Variables.html'. How can i do this?
The html page will then pass varNumber=1 to a VB executable file that is already opened by the HTML document.
This program will actually integrate VB with HTML as well as Flash. is it possible?
or is there an easier way to do this.
|