Set Variables from HTML
Here is the set up, I have a video player embedded in an html
file. The player will play a lead in video for branding purposes IF
the user has not viewed this lead in video yet. ELSE it wil play
the video they specified and then continue to play the rest of the
videos in a que.
Everything is fine except, the current video is dependant on
the HTML page the view is at and I would rather just have 1 swf
file rather than 1 swf file for every video.
So my question is, how can i get the HTML page to tell the
swf file which file to load after the lead in file. I essentially
need to send this parameter from the HTML file to the swf file -
How do I do that??
Thanks!
Using FlashVars is just appending the variable to the SWF's
url. So, in your embed script, where ever you have the path to your
SWF, like, mymovie.swf, you just append whatever variable you need
to that. So, lets say you want to pass in a name, you would use
mymovie.swf?name=dzedward
Then, in flash retrieve it like so:
root.loaderInfo.parameters.name;
Lets say you want to pass in first and last name:
mymovie.swf?firstName=Damon&lastName=Edwards
retrieve it like so:
root.loaderInfo.parameters.firstName;
root.loaderInfo.parameters.lastName;
Now, if you're using SWFObject to embed your SWF, its as
simple as:
so.addVariable("name", "dzedward");
retrieving it the same way as above.
Similar Messages
-
How to pass a variable from HTML to Flash
I have built my flash ad banner in Flash 9 and now want the
HTML code to pass the url over to the flash movie that it should
jump to when clicked.
The info in the help file seems out of date for the latest
HTML template as it uses mainly JavaScript to get round IE's
dreadful embeding issue. So my problem is, how do I pass a variable
from the HTML to the actionScript specified int he Help file
(running on a full screen button) as shown below?
myButton_btn.onRelease = function() {
if (clickTAG.substr(0, 5) == "http:") {
getURL(clickTAG);
via the html code now used by Flash 9 which is like this:
<!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Advert_long</title>
<script language="javascript"> AC_FL_RunContent = 0;
</script>
<script language="javascript"> DetectFlashVer = 0;
</script>
<script src="AC_RunActiveContent.js"
language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 115;
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
Coping
with
Growing
Audio
Series
Theraputic stories
for children aged
4 to 9
-->
<script language="JavaScript" type="text/javascript">
<!--
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
var hasRightVersion = DetectFlashVer(requiredMajorVersion,
requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable
version
// embed the flash movie
AC_FL_RunContent(
'codebase', '
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
'width', '120',
'height', '600',
'src', 'Advert_long',
'quality', 'high',
'pluginspage', '
http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'Advert_long',
'bgcolor', '#ffffff',
'name', 'Advert_long',
'menu', 'true',
'allowScriptAccess','sameDomain',
'allowFullScreen','false',
'movie', 'Advert_long',
'salign', ''
); //end AC code
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be
placed here.'
+ 'This content requires the Adobe Flash Player.'
+ '<a href=http://www.macromedia.com/go/getflash/>Get
Flash</a>';
document.write(alternateContent); // insert non-flash content
// -->
</script>
<noscript>
// Provide alternate content for browsers that do not support
scripting
// or for those that have scripting disabled.
Alternate HTML content should be placed here. This content
requires the Adobe Flash Player.
<a href="
http://www.macromedia.com/go/getflash/">Get
Flash</a>
</noscript>
</body>
</html>You should use SWFObject to embed your Flash. Not only does
it make
embedding more straightforward, it makes passing query
parameters very easy.
Check out:
http://code.google.com/p/swfobject/
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
How to pass a variable from HTML to Flash 9
I have built my flash ad banner in Flash 9 and now want the
HTML code to pass the url over to the flash movie that it should
jump to when clicked.
The info in the help file seems out of date for the latest
HTML template as it uses mainly JavaScript to get round IE's
dreadful embeding issue. So my problem is, how do I pass a variable
from the HTML to the actionScript specified int he Help file
(running on a full screen button) as shown below?
myButton_btn.onRelease = function() {
if (clickTAG.substr(0, 5) == "http:") {
getURL(clickTAG);
via the html code now used by Flash 9 which is like this:
<!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Advert_long</title>
<script language="javascript"> AC_FL_RunContent = 0;
</script>
<script language="javascript"> DetectFlashVer = 0;
</script>
<script src="AC_RunActiveContent.js"
language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 115;
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
Coping
with
Growing
Audio
Series
Theraputic stories
for children aged
4 to 9
-->
<script language="JavaScript" type="text/javascript">
<!--
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
var hasRightVersion = DetectFlashVer(requiredMajorVersion,
requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable
version
// embed the flash movie
AC_FL_RunContent(
'codebase', '
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
'width', '120',
'height', '600',
'src', 'Advert_long',
'quality', 'high',
'pluginspage', '
http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'Advert_long',
'bgcolor', '#ffffff',
'name', 'Advert_long',
'menu', 'true',
'allowScriptAccess','sameDomain',
'allowFullScreen','false',
'movie', 'Advert_long',
'salign', ''
); //end AC code
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be
placed here.'
+ 'This content requires the Adobe Flash Player.'
+ '<a href=http://www.macromedia.com/go/getflash/>Get
Flash</a>';
document.write(alternateContent); // insert non-flash
content
// -->
</script>
<noscript>
// Provide alternate content for browsers that do not
support scripting
// or for those that have scripting disabled.
Alternate HTML content should be placed here. This content
requires the Adobe Flash Player.
<a href="
http://www.macromedia.com/go/getflash/">Get
Flash</a>
</noscript>
</body>
</html>You should use SWFObject to embed your Flash. Not only does
it make
embedding more straightforward, it makes passing query
parameters very easy.
Check out:
http://code.google.com/p/swfobject/
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Setting variables from a testcase?
Hello,
How do I access variables from my BPEL flow from a testcase?
I need to set some header variables and such that is not availible in the emulate tab so I am looking for a way to manualy in my testcase add/alter/read variables from the BPEL flow?
I know this "could" be emulated by setting them in the normal flow but since it is test specific I would like to avoid adding thing to the flow and instead have them in my "test case".
// MickeMshouldn't I also be able to access the outer classes methods? It doesn't seem to do this either.
-
Can you control format when setting variable from dashboard prompt?
I'm setting a session variable from a calendar date prompt in a dashboard prompt, and the variable is referenced in a calculation in the business model. I'm initializing the date prompt from another variable which returns format TIMESTAMP 'YYYY-MM-DD 00:00:00', and the initial load of the dashboard is successful. After changing the value of the date prompt, the query fails because the prompt sets the variable to 'mm/dd/yyyy'.
My question is: Is there any way to control the formatting when setting a variable from a dashboard prompt? I would like to get the timestamp format.
Thanks,
GregIf You wants time than in dashboard prompt's coloumn formula use cast function as "cast(date as time)" if date than "cast(date_col_name as date)". But I also have that one problem.Firstly tell me, Is it possible that using two dates in using betwwen operator in dashboard. We access server variable. If not working one thing more that u should have filter on date coloumn in report layout.And in action coloumn u select prompted. Than It will must work.
Thanks
Haroon -
Passing dynamic variable from html to Flash
I know this is pretty simple but all that I have read doesn't make much sense to me. I have one swf calling another swf that I have embedded into an htnl. In other words just calling another html page in a seperate window.
In one.swf (runing in broswer) I use the below to call another html page passing the variable NewLessonArray. This contains an array of completed chapters.
// LOADING URL
var NewLessonCompleteArray:String = LessonCompleteArray.toString();
navigateToURL(new URLRequest("two/index.html?CurrentLessonInfo=<NewLessonCompleteArray>"), "_blank");
In the receiving swf I want to retrieve the passing parameters.
two.swf
// Getting the parameters passed
this.loaderInfo.parameters.toString()
All that is returned that I can see is object Object. But since I am passing on a address line into another swf embedded in a html page I am unable to determine that correct syntac for retrieving the information.
Any suggestions? This has got to be pretty simple... I think.
THANKSWhat you are trying to do is not extremely difficult to do, but it is not something I would consider as being simple. With Andrei's approach you should be able to take the url String and dissect the parameters from it using String methods, like split().
As for the loaderInfo end of things, you are not passing the parameters to the swf file, you are passing them to the html page. So the loaderInfo won't have any info for you regarding the url parameters. The loadInfo would typically get parameters via the FlashVars parameters passed in in the html's swf embedding code.
Here are some other solutions that you might consider. I have not dealt with these myself, they are merely in my collection of useful info, so you might have to experiment to get them working. One is a link to a class-based approach and the other is an approach that use swfObject embedding to dynamically add the parameters as FlashVars to the embedding code....
http://mikethenderson.com/2009/02/as3-return-query-string-value-version-2/#more-105
OR
In your HTML:
var flashvars = {};
if (swfobject.getQueryParamValue("aParameter")) {
flashvars.param = swfobject.getQueryParamValue("aParameter");
swfobject.embedSWF("myMovie.swf", "myContent", "550", "400", "9.0.0", "", flashvars);
And the param variable will be available as a FlashVar to your movie:
var theParam = loaderInfo.parameters.param; -
Passing variable from html to flash
Hi I have built a flash movie with buttons...depending on
which button is clicked it loads a different flash movie due to
variable setting. I am able to set and call the variable s in flash
fine
But now i have an html page that needs to blend with this
flash...So i created buttons on my html page to look like the
flash...But when i click a certain button i want it to know the
variable going into the flashpage and load correct movie...not just
go to the beginning of my flash movie then user will have to choose
the button again...
How can i do this?
thank you in advance
renowell, between the post to forum and this link below i got
this to work for me
Just needed to know about the javascript....along with
putting the value/variable in url as posted..thanks
http://noscope.com/journal/2003/12/query_string
thanks for replying with suggestions!
reno -
Can't receive variables from HTML to Flash in AS3 passed via URL (not Flashvars)
hey all,
can't seem to get AS3 to recognize variables passed via URL
(not Flashvars). i can get vars passed with Flashvars in the
javascript but I don't want to use that method. i'm simply
extending the .swf call with .swf?var=123 in the embed and on the
AS3 side i'm calling loaderInfo.parameters.var
thought this would work but doesn't. what am i doing wrong?
HTML:
<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
width="1024" height="768" id="main" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="main.swf?var=123"
/><param name="quality" value="best" /><param
name="bgcolor" value="#ffffff" /> <embed
src="main.swf?var=123" quality="best" bgcolor="#ffffff"
width="1024" height="768" name="main" align="middle"
allowScriptAccess="sameDomain" allowFullScreen="false"
type="application/x-shockwave-flash" pluginspage="
http://www.macromedia.com/go/getflashplayer"
/>
</object>
AS:
t = new TextField();
t.text = String(loaderInfo.parameters.var);
thx in adv.
michaelappreciate you were going for brevity, but i think the
answer's going to be hidden either in your complete html code or
your complete AS code. without seeing this i can only keep
guessing.
that said, my latest guess is that you're not passing your
variable within the AC_FL_RunContent function. there are two
properties set in this function - src and movie, which contain your
movie name, to which you can add any parameters you wish to pass.
eg.
'src', 'main?var=123',
'movie', 'main?var=123',
where main is the name of your swf and var the name of the
parameter you wish to pass.
if this function fails - if javascript isn't available in the
browser, for example, or AC_RunActiveContent.js is missing, then
the <object> tag you described is used. (this object tag is
sitting inside a <noscript> tag.) -
Set variable from cookie value
Hi,
I have a website that saves a cookie to your browser when you log in,
The cookie value is the name of the user.
I want to see if I can read this value in captivate and set it as a variable in the content therefore no need to re-enter details in the content.
I have tried to tackle this using JS but my experience is limited.
Im using Cp8.
Thanks in advance...Hi VC, thanks for reply,
//try to set the value and see if it works
$s('P1_ID_PER_KND_NA_CRYPT','A422313E7F62D04D12347E7DE85DC53E')doesn´t work either, firebug brings up no error but i get an checksum error for this element from the apex engine, I will test the Apex internal GetCookie Function but my own function work very well too, the error is after that...
what i see, i also get the checksum error when using the varibable id_per_knd_na, too.
so i think, javascript tries to set the value to the hidden element, but the apex engine prvented it because of SSP.
Any other ideas?
ps: i use apex 4.0.2 -
I am trying to load a variable into a flash file from the
html page which it is displayed on. What i am trying to do is load
a photo album category from a GET variable
(photo_album.htm?cat=test) into the loadXMLgroup Actionscript event
for a program which I am using. I essentially want to be able to go
to photo_album.htm?cat=test and end up with the event
loadXMLgroup("test").
Please Help.SWFObject will help you do this easily
Check out the getQueryParamValue example on this page:
http://blog.deconcept.com/swfobject/ -
Need help sending variables from HTML to SWF...
I have a header with tab buttons--- When you are on a certain
page the coorisponding tab is a different color(as a locator).
Right now I have like, 7 or 8 different headers that are the
same thing minus the colored tab of the current page.
Is there a way to code the flash so that I only need one
header, but still keep the off-colored buttons when on the
coorisponding page?
Apparently, from what I have gathered I need to Send a
variable to the SWF from the embedding HTML using FlashVars or
SWFObjects' 'addVariable' method etc so the SWF knows which
tab/color to use.
But, I have no ideal where to start...uugggggg.
Any Suggestions????
I really, really need to figure this out.
Thanks in advance,
hutchthe easiest way to pass vars to the flash is by appending
them to the url of the flash:
e.g your swiff is called "mymovie.swf" and you want a
parameter "color" to be available on the _root level of your movie,
so all you have to do is embed the flash with the following url
into your html page:
"mymovie.swf?color=black"
now back in flash you can get the value of "color" like this:
in _root timeline:
color
in any other timeline:
_root.color
the value will be filled once the movie is called from within
the HTML as explained above -
Setting variables from inner class
I have a GUI that takes users information and provides a quotation as componants are clicked. My componants' Listeners are in seperate inner classes and from these I want to add certain details to variables, it seems to compile and run but it doesn't seem to be changing the value of the variable when the componants are clicked, is there any reason why this happens, my code is below:
public class MyGUI extends JFrame{
public MyGUI(){
//GUI STUFF HERE
double Price;
private String total=calculate();
public String calculate(){
double aTotal=Price;
return "$ " + aTotal;
class MyListener implements ItemListener{
public void itemStateChanged(ItemEvent evt){
if(evt.getSource()==rad1) {
Price=0.10;
else if(evt.getSource()==rad2) {
Price=0.12;
totalLab.setText(total);
}shouldn't I also be able to access the outer classes methods? It doesn't seem to do this either.
-
I have an SQL table that I store OrderID, ItemID, Qty. There are 15 possible ItemID's (will never be more). I need to output the order into a single table row that shows the orderID and the qty for each item.
For example:
<cfquery name="orders" datasource="xyz"
Select *
From solditems
Where orderid = 'Order1"
</query>
Would return something like:
Order1, Item3, 6
Order1, Item4, 7
Order1, Item18, 10
The table needs to look like:
<tr>
<td>#orderID#</td>
<td>#item1qty#</td>
<td>#item2qty#</td>
<td>#item3qty#</td>
<td>#item4qty#</td>
<td>#item5qty#</td>
<td>#item6qty#</td>
<td>#item7qty#</td>
<td>#item8qty#</td>
<td>#item9qty#</td>
<td>#item10qty#</td>
<td>#item11qty#</td>
<td>#item12qty#</td>
<td>#item13qty#</td>
<td>#item14qty#</td>
<td>#item15qty#</td>
</tr>
I'm at a loss trying to figure out how to match the row from the results of the record set into the right #itemXqty#.
Hope I explained this well and thanks in advance for pointers in the right direction!
GaryYou could do something like
<cfoutput><table border="1"><tr><th>#orders.orderID#</th></cfoutput>
<cfoutput query="orders">
<td>#itemID##qty#</td>
</cfoutput>
</tr></table>
For a start, your query would be more efficient using "select orderID, itemID, qty" instead of "select *" (assuming, of course, that the table has more than the 3 columns). -
How can I set the name of a value from an alias such as
"P & M:Editorial Photography:THISFOLDER:fpo:Book Shelf:"
to
"THISFOLDER"
Basically I want to set the name of a value to whatever the name of the second level folder up from the given path is.
Pedroon script_title()
Filename : ExtractDirNameFromPath.scp.as
Pathame : ExtractDirNameFromPath.scpt (Script Debugger)
Author : Bill Hernandez
Version : 1.0.0
Updated : Friday, December 15, 2006 ( 12:18 AM )
end script_title
-- ---------+---------+---------+---------+---------+---------+---------+---------+ ---------+---------
on script_notes()
How can I set the name of a value from an alias such as
"P & M:Editorial Photography:THISFOLDER:fpo:Book Shelf:"
to
"THISFOLDER"
Basically I want to set the name of a value to whatever the name of the
second level folder up from the given path is.
Pedro
end script_notes
-- ---------+---------+---------+---------+---------+---------+---------+---------+ ---------+---------
property NoOfLevelsFromTheEnd : 2
-- ---------+---------+---------+---------+---------+---------+---------+---------+ ---------+---------
on run
tell me
set delim to ":"
set theText to "P & M:Editorial Photography:THISFOLDER:fpo:Book Shelf:"
set aList to SplitString(delim, theText)
set NoOfItems to count items in aList
set whichItem to (NoOfItems - NoOfLevelsFromTheEnd)
set myVar to (item whichItem of aList)
my ShowMsg(myVar, 5)
end tell
end run
-- ---------+---------+---------+---------+---------+---------+---------+---------+ ---------+---------
on SplitString(delim, theText)
if (the last character of theText is equal to delim) then
set theText to (characters 1 thru -2 of theText) as string
end if
set old_delims to get AppleScript's text item delimiters -- always preserve original delimiters
set AppleScript's text item delimiters to delim
set theList to text items of theText
set AppleScript's text item delimiters to old_delims -- always restore original delimiters
return theList
end SplitString
-- ---------+---------+---------+---------+---------+---------+---------+---------+ ---------+---------
on join(theList, delim)
set old_delims to AppleScript's text item delimiters -- always preserve original delimiters
set AppleScript's text item delimiters to delim
set theStr to theList as string
set AppleScript's text item delimiters to old_delims -- always restore original delimiters
return theStr
end join
-- ---------+---------+---------+---------+---------+---------+---------+---------+ ---------+---------
on ShowMsg(s, howLong)
tell application "Finder"
activate
if (howLong = 0) then
set theTime to 3
else
set theTime to howLong
end if
set b1 to "OK"
display dialog s buttons {b1} default button {b1} giving up after theTime
end tell
end ShowMsg
-- ---------+---------+---------+---------+---------+---------+--------- -
Passing a variable from html to java
I'm trying to pass a value from a coldfusion page to an applet.
ThanksI'm trying to pass a value from a coldfusion page to
an applet.
ThanksGood luck! So what part of the code is the problem, or what exactly is your question?
Maybe you are looking for
-
Export book to PDF doesn't remember previous settings - CS5
I've just noted a somewhat annoying "bug" in the book export. When I export book to PDF--which I do a lot--I have to rename the file and reselect the type of PDF I'm exporting every time. It should remember the last settings I used.I believe in the
-
Where are the console launcher profiles saved (x-fi)
Everytime i install new drivers, all my equalizer settings get erased. and i have equalizer profiles for each band.. does anynone know where these are stored on win7 64bit, or any OS. I kind of want to back them up thx in advance for any help
-
HT3774 I have tried all of the above.
Hola: I have checked all of the settings in this support thread listed for wake on demand and they are correct. Apple TV 2.0 with current software, Airport Extreme with 7.6.1 and current firmware, iMac running Lion 27 inch, late 2009 (3.06 GHz Intel
-
How do I get Access Restrictions to work
I have a WRT54GS with firmware ver 7.50.0. I would like to set up time restrictions (14 year old - self explanatory) and don't know how to go about it. I have gone in and set up times, but it has no effect. I may be going out on a limb here and ho
-
Solman HP- ALM Integration and Business Process Configuration
Hello Solman Experts, Can anyone provide me the links/docs/materials/SAP application Help/Wiki etc for Solution Manager to HP-ALM Integration and Business Process Mapping/Configuration. Thank you in advance and waiting for the answers. Regards, Eswar