Pass Variables into AS3 through Query String?
Man! I've been searching ferociously and can't seem to find a solution that works for me. I am trying to pass variables via query string on a PHP page to Flash, and then have the swf add movie clips to the stage depending on the information it receives.
Here is what the PHP outputs:
swfobject.embedSWF("flash/detailScore.swf?a=0-0&b=0-0&c=30-54&d=30-20&e=42-18", ...
And here is my AS3 code:
function loaderInfoSh(e:Event):void{
var myQueryStrings=this.loaderInfo.parameters;
a = myQueryStrings.a;
b = myQueryStrings.b;
c = myQueryStrings.c;
d = myQueryStrings.d;
e = myQueryStrings.e;
addTheResults(a,1);
addTheResults(b,2);
addTheResults(c,3);
addTheResults(d,4);
addTheResults(e,5);
this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);
The addTheResults function takes the coordinates, adds a MC instance to the stage and positions it accordingly.
var colorMCArray:Array = new Array();
function addTheResults(val,colnum:Number){
if(val == null){val = "52-46";} // so I can test it locally
var daColor:String;
switch (colnum){
case 1:
daColor = "f3951c";
break;
case 2:
daColor = "74b47d";
break;
case 3:
daColor = "436494";
break;
case 4:
daColor = "9b74ac";
break;
case 5:
daColor = "b43d44";
break;
var dash:int = val.indexOf("-");
var lateral = val.slice(0,dash);
var vertical = val.slice(dash+1);
lateral --;
vertical --;
// adding the MC instance
var comm:tileB = new tileB();
comm.name = "comm"+colnum;
addChild(comm);
colorMCArray[colnum] = comm;
//Change the color
var colorTransform:ColorTransform = colorMCArray[colnum].transform.colorTransform;
var thiscolor = "0x"+daColor;
colorTransform.color = thiscolor;
colorMCArray[colnum].transform.colorTransform = colorTransform;
colorMCArray[colnum].x = 5;
colorMCArray[colnum].y = 536;
colorMCArray[colnum].x += (lateral * 9);
colorMCArray[colnum].y += (vertical * 9)*-1;
colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OVER, btnro);
colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OUT, btnrout);
I don't know what I'm doing wrong here.
Was this the "e" in the code below you were pertaining to as the culprit? "e" is not a keyword. It's just the shortcut for the word "event" for the variable name of type Event which is the Event object that triggered the call of function loaderInfoSh. In your code you assigned e = myQueryString.e which should have given you a type mismatch error.
function loaderInfoSh(e:Event):void{
var myQueryStrings=this.loaderInfo.parameters;
a = myQueryStrings.a;
b = myQueryStrings.b;
c = myQueryStrings.c;
d = myQueryStrings.d;
e = myQueryStrings.e;
addTheResults(a,1);
addTheResults(b,2);
addTheResults(c,3);
addTheResults(d,4);
addTheResults(e,5);
this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);
Similar Messages
-
How to pass variable into lov sql query using like operator
hi.
i want to use a lov where i want to pass a variable using like operator.
my query is
select empno,name from table where empno like ':ed%';
my empno is A001 TO A199 AND B001 TO B199 so i want show either A% or B% empno
how can i do this ?
reagrdskindly press Shift+F1 at a time you face this error to see the exact Oracle error message.
and provide us with that detail
and its better if you start new topic for that error... because that will be new error,,,
-- Aamir Arif
Edited by: Aamiz on Apr 7, 2010 12:27 PM -
Deferred Tasks - Passing Variables into Workflow
Hi everyone
I am experiencing difficulties with deferred tasks in IDM 8.1. I have managed to create a deferred task on a user, with the task name being Generate Email. I also passed in an attribute id, and these can be seen in the user view under waveset.properties.tasks.
<Activity id='1' name='Add Deferred Task'>
<Action id='1' application='com.waveset.session.WorkflowServices'>
<Argument name='op' value='addDeferredTask'/>
<Argument name='type' value='User'/>
<Argument name='name'>
<ref>accountId</ref>
</Argument>
<Argument name='authorized' value='true'/>
<Argument name='subject'>
<s>Configurator</s>
</Argument>
<Argument name='task'>
<ref>taskToAdd</ref>
</Argument>
<Argument name='date'>
<new class='java.util.Date'/>
</Argument>
<Argument name='owner'>
<ref>WF_CASE_OWNER</ref>
</Argument>
<Argument name='taskDefinition'>
<new class='com.waveset.object.GenericObject'>
<map>
<s>id</s>
<ref>accountId</ref>
</map>
</new>
</Argument>
</Action>
</Activity>I have set up a scheduler that correctly scans all the user objects for this workflow name, and the Generate Email workflow is periodically run.
The problem is when it gets to the Generate Email workflow, all the variables that were set when the deferred task was created are gone. Both <ref>id</ref> and <Variable name=id input=true/> return null.
Setting the following in the TaskSchedule object did not help, as the string value $(id) is passed into the workflow instead of the id itself. I cannot debug the TaskSchedule as the Netbeans IDE does not allow me to put in breakpoints on this file.
<Variables>
<Object>
<Attribute name='id' value='$(id)'/>
</Object>
</Variables>My question is, how do I pass variables into a workflow via a deferred task?Hi,
Here is an example that I found that may assist.
<Activity name='setDefTask'>
<Action application='com.waveset.session.WorkflowServices'>
<Argument name='op' value='addDeferredTask'/>
<Argument name='name' value='$(user)'/>
<Argument name='task' value='$(taskType)'/>
<Argument name='date' value='$(date)'/>
<Argument name='description' value='$(taskDescription)'/>
<Argument name='taskDefinition'>
<Object>
<Attribute name='Arg1' value='value1'/>
<Attribute name='Arg2' value='value2'/>
<Attribute name='Arg3' value='value3'/>
</Object>
</Argument>
</Action>
<Transition to='end'/>
</Activity>Hope it helps -
Passing variables from AS3 to PHP
Hi there
I am having some trouble in passing variables from AS3 to PHP. I am using flash and php both in the same file [try.php].
I've stuck with this for two days.. Here's what I have done. Please help!!!
header.fla [Actionscript in the timeline]
stop();
import flash.events.Event;
import flash.display.Sprite;
import flash.net.*;
var url:String = "http://localhost/0000/try.php";
var req:URLRequest = new URLRequest(url);
var loader:URLLoader = new URLLoader();
var variables:URLVariables = new URLVariables();
send_btn.addEventListener(MouseEvent.CLICK, sendForm);
function sendForm(evt:MouseEvent):void
// add the variables to our URLVariables
variables.asd = "value";
// send data via post
req.method = URLRequestMethod.POST;
req.data = variables;
loader.dataFormat = URLLoaderDataFormat.TEXT;
// add listener
loader.addEventListener(Event.COMPLETE, onLoaded);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
//send data
loader.load(req);
function onLoaded(evt:Event):void
var result_data:String = String(loader.data);
if (result_data)
trace(result_data);
else if (!result_data)
trace("error");
function ioErrorHandler(event:IOErrorEvent):void
trace("ioErrorHandler: " + event);
try.php
<body>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="563" height="280">
<param name="movie" value="header.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="../Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="header.swf" width="563" height="280">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="../Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<?php
if($_POST['asd'])
echo "value of var1 is <b>".$_POST['asd']."</b>";
else
echo "bad luck";
?>
</body>
BIG THANKS!!the problem is nothing your showed. did you see a security warning that you ignored?
to test, if that's the problem go here and adjust your security settings: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.ht ml
if that fails, upload your files to a server and confirm everything works. then start working on your local configuration. -
How to pass a Vector as a Query String to a URL
is there a way to pass a vector as a query string in a URL in Java. If so how?
thanks in advanceYeah may need some more detail, but if you are trying to pass the Vector object itself from one JSP/Servlet to another, you can simply put the object in one of the scopes like session or request then forward page on.
e.g.
FirstServletVector things = new Vector();
things.add("one thing");
things.add("another thing");
request.setAttribute("objThings",things);
getServletContext().getRequestDispatcher("/NextServlet").forward(request, response);SecondServletVector things = new Vector();
Object o = request.getAttribute("objThings");
if(o instanceOf Vector) things = (Vector)o;Hope that helps!! -
How to pass variables into an alert
Hi,
I have set up an alert control step in my BPM, and completed all the required config to see the alert is created in my alert inbox. However, I want to pass some parameters into the alert message, such as po number. Does anyone know how to do it? I already defined the variables in the alert category container.
Your help is appreciated!
HartHi Hart
I don't know if my way is "recommended" but...:)
1. don't define container variable in alert def
2. select "dynamic text" in your alert category
(if you select this you'll be able to pass text from "alert message" to the alert)
now it should work
passing variables into the long text
of the alert message works for me just great
Hope it will for you to:)
Kind Regards,
Michal Krawczyk
https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/u/34500 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] -
Passing Flash Vars Through Query Strings and JS
I'm trying to get a particular video to play in a flash ad
when a particular query string is clicked. I can't get it to work
and would appreciate any help that you can provide. The ad plays
but the movies don't show when the query string is clicked or when
you click on objects in the movie that are supposed to populate a
movie. Here's the code I've been trying to use:Thanks for the advice, I have tried Javascript to resolve the
problem. In response to the <object> tag missing, There is
one I just included a snippet of the html code sorry for the
confusion. Due to deadlines I abandoned the functionality of the
script and "dumbed" down the script. Thank you again for the help -
Passing a parameter in the query string
When a string containing a �+� is passed as a parameter in the URL in the query string through a POST request, it is interpreted as two strings separated by a �+� and thus when the string is retrieved through a request.getParameter (),it returns the string with a space in place of the �+� sign.
eg:
String dblink = "/TCE/servlet/LoginService?name="+vSystemAccount.getAccountName()+"&password="+pw;
Here the parameter pw contains a '+' sign which when retrieved by a request.getParameter() returns the parameter with a space in place of the '+' sign.How can i prevent this??Hi,
In post method , the data is sent as request message body. The data is passed as query string in Get method not in Post method.
Could you please explain your question again ?
bye for now
sat -
Passing Variables to a SQL Query
I have a select box with multiple choices allowed in
form1.ASP. I want =
to pass the form on submit using request.form ("variable")
and process =
data and a query string for an SQL select where statement.
The form =
data is in the format of "E123 B456 X789" . What is the best
means of =
processing that for my Access database?
Thanks.
RossWell, here's the answer:
http://kb.adobe.com/selfservice/viewContent.do?externalId=3Dtn_15906&slic=
eId=3D1
"ross m. greenberg" <[email protected]> wrote in
message =
news:gb5reg$714$[email protected]..
I have a select box with multiple choices allowed in
form1.ASP. I want =
to pass the form on submit using request.form ("variable")
and process =
data and a query string for an SQL select where statement.
The form =
data is in the format of "E123 B456 X789" . What is the best
means of =
processing that for my Access database?
Thanks.
Ross -
Passing variable into pdf document
I have created a pdf document that I want to share with my marketing team. However, in the document I want the url to be dynamic and show that individual's url. For example, if my domain is www.xyz123abc.com In the pdf, I want to setup the url in the document as www.xyz123abc.com/REPSITE. Then when the pdf is opened from each individual's site, we will pass the REPSITE variable into the pdf document. If my marketing page is www.xyz123abc.com/jim. When someone visits my website and opens the pdf, they will see www.xyz123abc.com/jim. When my partner Bob's site is visited, the pdf will display www.xyz123abc.com/bob.
So how can I dynamically pass variables from a website into the pdf?Don't know if there is a better way, but you could use the 'identity Object'. Just make sure that the Identity is set in the application preferences for each employee
var userName = identity.name
Edit: Sorry, after rereading your post, I don't think this is what you are asking for. Perhaps the 'HostContainer Object' wll allow you to do what you want? -
Pass collections into to select query on IN caluse
Hi friends,
I wanted to pass collections in to select query IN caluse .
Eg..
Declare
type tab is table of varchar2(25);
v_tab tab:
type tab1 is table of varchar2(25);
v_tab1 tab:
Begin
select ename into v_tab from emp where deptno in (10,20,30);
select location into v_tab1 emp_hist where ename in ( v_tab1 ); -- here where i wnt to pass the collections
End;
i dont want to write an loop to do this , i like to use only collections ? any idea how
thanks in advance .
RajHi Raj,
In the examples above you will need to have a type declared in the database, however you can create a pipelined function to do what you want... something like this,
SQL> Create OR Replace Package My_Types Is
2
3 Type enames_tab Is Table Of Varchar2(50);
4
5 End My_Types;
6 /
Package created
SQL> Create OR Replace Function lookup_ename Return my_types.enames_tab
2 Pipelined Is
3 v_row my_types.enames_tab;
4 cur Sys_Refcursor;
5 v_ename Varchar2(50);
6 Begin
7 v_row := my_types.enames_tab();
8 Open cur For
9 SELECT ename
10 FROM emp
11 WHERE ename IN ('SMITH', 'JAMES', 'WARD');
12 Loop
13 Fetch cur
14 INTO v_ename;
15 Exit When cur%Notfound;
16 v_row.Extend;
17 v_row(v_row.Count) := v_ename;
18 Pipe Row(v_row(v_row.Count));
19 End Loop;
20 Return;
21 End;
22 /
Function created
SQL> Set Serveroutput on;
SQL> Declare
2 v_tab my_types.enames_tab;
3 Begin
4 SELECT ename Bulk Collect
5 INTO v_tab
6 FROM emp
7 WHERE ename IN (SELECT *
8 FROM Table(lookup_ename));
9
10 For i IN v_tab.First .. v_tab.Last Loop
11 dbms_output.put_line(v_tab(I));
12 End Loop;
13 End;
14 /
SMITH
WARD
JAMES
PL/SQL procedure successfully completedRegards,
Christian Balz -
Passing variables into CVI from TestStand.
Is there a different way to send variables into CVI from TestStand other than the input buffer? Parsing that string is annoying and bulky. Isn't there an easier way?
Hi,
Here is a short cut to another example which will use the StationGlobals -
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=313&HOID=506500000008000000301F0000&UCATEGORY_0=_8_&UCATEGORY_S=0
There are loads of other examples either as part of the examples provided by TestStand installation or in the Resource Library under TestStand on the NI website
Good Luck
Ray Farmer
Regards
Ray Farmer -
Loop through Query String in ASP
Hi,
I am new to ASP and am trying to loop through values in a
query string
separated by a comma, for example:
/site/search/results.asp?ids=19736a,20248a,14952a,19956a
I need to construct SQL from this something like
SELECT * FROM MyTable WHERE
ID = 19736a OR
ID = 20248a OR
ID = 14952a OR
ID = 19956a
I am just unsure on how to separate all the values from the
query string.
Thanks for your advice.Oh, in the example below there is no space between the id
numbers in the
querystring.
eg. ids=1,23,456,2
If you do have spaces then you need to adjust the split
accordingly
eg. ids=1, 23, 456, 2
you would use myIdArray=split(idStr,", ")
note the space after the comma.
just make sure you always use the same format in your
querystring
Justin
"Justin Reid" <[email protected]>
wrote in message
news:e6osem$dfj$[email protected]..
> You need to create an array of ids and then add them to
your SQL.
> Something like:
> <%
> If Request.QueryString("ids") <> "" Then
> Dim idStr, cnt, varID
> 'get the string of id'
> idStr = Request.QueryString("ids")
> 'create the array
> myIdArray=split(idStr,",")
> cnt=0
> 'loop though the array and add to a new string
> for i=o to ubound(myIdArray)
> If cnt > 0 Then varID = (varID & " OR")
> varID = (varID & " id = " & cStr(myIdArray(i)))
> cnt=cnt+1
> next
> End If
> %>
>
> Then simply add you new SQL segment to your recordset.
> Something like
>
> SELECT * FROM MyTable WHERE" + Replace(varID, "'", "''")
+ "
>
> Hope that helps
>
> Justin
>
> "Shaun" <[email protected]> wrote in
message
> news:e6ole1$56v$[email protected]..
>> Hi,
>>
>> I am new to ASP and am trying to loop through values
in a query string
>> separated by a comma, for example:
>>
>>
/site/search/results.asp?ids=19736a,20248a,14952a,19956a
>>
>> I need to construct SQL from this something like
>>
>> SELECT * FROM MyTable WHERE
>> (
>> ID = 19736a OR
>> ID = 20248a OR
>> ID = 14952a OR
>> ID = 19956a
>> )
>>
>> I am just unsure on how to separate all the values
from the query string.
>>
>> Thanks for your advice.
>>
>
> -
I need to know how to pass a variable into getURL.
Is it possible to use a param name in the html with a value
of a URL (google.com) and pass that into the flash... and then in
the actionscript replace the link with a var that calls the param?
hope that makes sense.
ThanksAll you need to know here?:
http://www.adobe.com/devnet/flash/articles/google_search.html -
Pass variable into xMII applet???
Is it possible to pass a javascript variable into the xMII applet?
I guess what I asking is could I place a variable that I created in the head of the html file and then call for it in the applet.
The variable is called in the Applet name below.
For Example:
<html>
<head>
<script>
var TEST = alert("")
</script>
</head>
<body>
<tr>
<td>
<applet name="TEST" codebase="/Illuminator/Classes" code="iGrid" archive="illum8.zip" width="775" height="350" mayscript>
<param name="DisplayTemplate" value="/Production/gridQA_Moistures">
<param name="QueryTemplate" value="/Production/qryQA_Moistures">
<param name="UpdateEvent" value="Grid_Updated">
<param name="Param.1" value="%">
<param name="Param.2" value="%">
<param name="Param.3" value="%">
<param name="Param.4" value="%">
</applet>
</td>
</tr>
</body>
</html>
Maybe you are looking for
-
How do i set up airdrop on my iphone 4 and ipad with retina display?with out jailbreaking it
All my friends have it and their devices are the same as mine and their device is not jailbroken.
-
Hello guys. Today I connected my iPod 5th gen to the charger and I noticed it wasn't charging. This started today. Someone please help me. I appreciate every tip and help I recieve.
-
Opening applcations and windows, open behind first application
Whenever i open an applicaton or new window in a browser, the application opens up behind another application. E.g. Itunes is open, i open firefox and it is stuck behind Itunes, i then have to drag Itunes to the other side of the screen to access Fir
-
What will happen when my fusion 4.04 trial expire?
Hello Do you know what is going to happen when my fusion 4.0 trial program expire? All the virtual machine will be uninstalled? or all those programs will be into my hard disk memory like garbage, ocupping space? If that is true, how can i erase all
-
How do I get RAW Support for Panasonic Lumix L10 camera?
Aperture 2.1 still does not support Panasonic Lumix L10 RAW nor jpegs (Adobe 4.3 RAW plug-in already does). Is there a workaround? Any help?