Passing variables to a swf
I'm trying to create a navigation file that is used to navigate to several applications. Each application is stored as a separate swf on the server. I need to send password data to each of the apps and I'm using the following code connect to each file and to send the password.
var variables:URLVariables = new URLVariables();
variables.connectionInfo = connectionPw
var urlRequest:URLRequest = new URLRequest("http://... filename.swf");
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = variables;
navigateToURL( urlRequest );
My problem is that I am unable to access the data when I am in the connected file.I'm using
password=Application.application.variables.connectionInfo
but the variables are not showing up. How should I be doing this?
Thank you!
forty6n2,
I tried to do the same thing, eventually after much searching
I ran across something called flashVars. Essentially, you can pass
values into flex and then do what ever you want with them. I
wrapped my .swf file in an .asp page so that I could pass in the
userID and ip address.
Example:
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="MiscControls" width="362" height="280"
codebase="
http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name='flashVars' value='myName=<%=
Response.Write(Request.ServerVariables("REMOTE_ADDR"))
%>&myIP=<%=
Response.Write(Request.ServerVariables("LOGON_USER")) %>'/>
<param name="movie" value="MiscControls.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="MiscControls.swf" quality="high"
bgcolor="#869ca7"
width="362" height="280" name="MiscControls" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="
http://www.adobe.com/go/getflashplayer">
</embed>
</object>
Good luck!
- Mike
Similar Messages
-
Passing variables from one swf to another
I am facing problem to pass variable from one swf to another.
I am using loadMovie to load another swf. how can I pass a variable
value to another swf. Can anyone help me plz? It is somewhat
urgent.
thanx in advance.first of all:
this is the Flash Media Server and your problem is not
related to FMS....
second thing related to the "somewhat urgent" :
we, users on this forum, are not there to do your job... so
calm down otherwise no people will answer your question. This forum
is a free support forum that community of Flash developer use to
learn tricks and to solve problems.
Possibles solutions:
If the two swf are seperate you can use LocalConnection to
establish a connection between different swf.
If you load a second swf into the first one you can interact
like a standard movieClip(only if there from the same domain or if
you a policy file on the other server)
You can use SetVariable(via Javascript) to modify a root
variable on the other swf and check with an _root.onEnterFrame to
see if the variable had changed in the second swf.
* MovieClipLoader will do a better job, in your specify case,
than the loadMovie. Use the onLoadInit event to see when the swf is
really totaly loaded into the first one otherwise you will have
timing issues.
My final answer(lol) is the solution 2 with the
notice(*) -
How to pass Variable value to SWF file in Eclipse development
We are creating Widget file in Eclipse by using SAP Widget Foundation .
We included one SWF file in Widget & it is working fine.
But we are not able to pass the values to SWF file variables.?
How to pass variables to SWF file let us know.
Thanks & regardsWe are creating Widget file in Eclipse by using SAP Widget Foundation .
We included one SWF file in Widget & it is working fine.
But we are not able to pass the values to SWF file variables.?
How to pass variables to SWF file let us know.
Thanks & regards -
Passing variables / accessing other swfs
It has been years since I used flash, so I consider myself a
rank armature. I'm Using Flash 8 and would like the code to be
backward-compatible to ver. 6.
I have a big movie, with lots of images. I've comprimised the
image quality as much as I dare, but it still takes 20-30 seconds
to load (my client is in Paris, and claims to have the fastest
connection in Paris, but it takes more than a minute to load it
from there, even when loaded on his local server). I'm assuming
that the only way to achieve a meaningful decrease in load time
will be to split it up into smaller swf's, one mail swf, and each
sub-page in it's own swf, and have each swf loaded only when
needed. The fla can be downloaded here:
cjreynolds.com/fuda30.zip
The movie currently runs an intro animation, then when a link
is clicked, it loads different "pages" which consist of large movie
clips. These are contained in a MC called "pages", and are called
by manipulating a root variable called "level" - ie: "level = 1"
causes the MC at frame 1 of the "pages" MC to be displayed. (this
was an existing movie that I have been tasked with modifying).
#1 - Is it correct that splitting the individual pages into
different swfs the only way to lessen load time? I would welcome
any other suggestions.
#2 - If spitting the movie up is the way to go, I'm thinking
I need to replace the movie clips in the "pages" MC with swfs. How
do I tell each individual page to go back to the main (intro) swf
and load a different page? The main timeline contains animations
that "overlay" the sub-pages, creating a transision effect when
going from one page to the next.
Thanks for your help - you guys (and gals) have been a great
source of aid for me!
joeYes, _root is the wrong thing to use, and _global is never
good practice. I
don't use loadMovieNum - I'd use MovieClipLoader and it's
loadClip method to
load other swf's into target clips. You can then use
something like
this._parent to get to the timeline of the clip 'containing'
the loaded
clip.
However, I think your best bet is to probably use a singleton
class. That
way you have your main movie instantiate and set variables
within the
singleton - then any other movies can easily create an
instance (which will
be the same instance since it's a singleton) and get the
values you need.
Simple example:
class VariableHolder{
private static var instance:VariableHolder;
private var myA:Number;
private function VariableHolder(){}
public static function getInstance():VariableHolder{
if(instance == undefined){
instance = new VariableHolder();
return instance;
public function setVariableA(newA:Number){
myA = newA;
public function getVariableA():Number{
return myA;
So, in your main movie you'd do:
var myVariables = VariableHolder.getInstance();
myVariables.setVariableA(50);
And then in another movie you do:
var myVariables = VariableHolder.getInstance();
var myA = myVariables.getVariableA();
//will set myA = 50;
Because you're using a singleton - the second getInstance()
call returns
just the one class instance - held in the class' instance
variable. You can
have any/all movies instance the class, and only one instance
is ever
returned... Once you wrap your head around this it's a very
efficient way to
pass stuff around between various movies.
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Passing variable information to swf
I've created a flash file that imports photos from a database
where the user is able to merge the photos with a variety of photo
templates. I can pass the db info directly to the swf file with no
problem, but if I use the html file with all the related flash code
I can't seem to pass the code to the swf file. I'm not sure what
I'm doing wrong and would appreciate any help........ThanksThanks so much for replying. The code I'm using to pass the
information is below. The information pulls from a DB into an asp
page. Here's a url:
http://www.pixstarr.com/details_mx.asp?event_Desc=SFDR100508&img_Name=S516_DSC0204-3.jpg.
If you click the "Customize Prints" button on the left you'll see
what it does....hopefully.
It works fine if I pass the info to master.swf, but if I try
to pass it to master.htm which contains master.swf I run into
problems....Thanks again. -
Pass filename as a variable to a swf file
I want to pass a variable which will represent a filename to
a swf file from a hypertext link in an HTML document.
When the user clicks on the link which has
?variablename=filename_to_use appended to a "normal" link to a
page,
this variablename will be passed to the swf file.
I've already created this target swf file to have an
actionscript with a FLVPlayComponent with the filename hard-coded
in the actionscript. I want the actionscript to use the variable
representing the filename_to_use that was passed to from the URL
line.
The following is the actionscript that plays the flv file
taken from the Flash Help: Creating an Application with an
FLVComponent
ORIGINAL VERSION:
import mx.video.*;
this.attachMovie("FLVPlayback", "my_FLVPlybk", 10,
{width:320, height:240, x:100, y:100});
my_FLVPlybk.skin = "file:///install_drive|/Program
Files/Macromedia/Flash
8/en/Configuration/Skins/ClearOverPlaySeekMute.swf"
my_FLVPlybk.contentPath = "
http://www.helpexamples.com/flash/video/water.flv";
VERSION USING THE FILENAME FROM THE PASSED VARIABLE INSTEAD
OF WATER.FLV
import mx.video.*;
this.attachMovie("FLVPlayback", "my_FLVPlybk", 10,
{width:320, height:240, x:100, y:100});
my_FLVPlybk.skin = "file:///install_drive|/Program
Files/Macromedia/Flash
8/en/Configuration/Skins/ClearOverPlaySeekMute.swf"
my_FLVPlybk.contentPath = "
http://www.helpexamples.com/flash/video/variable";
I currently can play videos with this actionscript at my
school website but must make a separate swf for each video.
I want to be able to have one swf file that will play which
video was passed from the link in the HTML page.
I am using HTML page to lower the bandwidth so that users
won't have to load a swf file to see curricular material and then
perhaps choose a video on the topic.
http://www.wearekennedy.com/kent/whatsup.htm
click the link to the Spring curriculum map with resources
and then click on e.g. The_Food_Web video
Thank you,
Kevin Kent
Educator, John F. Kennedy H.S., Bronx, NYYou can use Liskov substitution/polymorphism:
DROP TYPE DEMO_T2
DROP TYPE DEMO_T1
DROP TYPE DEMO_ST
CREATE TYPE DEMO_ST AS OBJECT
( ID NUMBER,
MEMBER PROCEDURE THIS_PROC)
NOT FINAL NOT INSTANTIABLE
CREATE TYPE DEMO_T1 UNDER DEMO_ST
( OVERRIDING MEMBER PROCEDURE THIS_PROC )
CREATE TYPE DEMO_T2 UNDER DEMO_ST
( OVERRIDING MEMBER PROCEDURE THIS_PROC )
CREATE TYPE BODY DEMO_T1 AS
OVERRIDING MEMBER PROCEDURE THIS_PROC AS
BEGIN
DBMS_OUTPUT.PUT_LINE('DEMO_T1');
END;
END;
CREATE TYPE BODY DEMO_T2 AS
OVERRIDING MEMBER PROCEDURE THIS_PROC AS
BEGIN
DBMS_OUTPUT.PUT_LINE('DEMO_T2');
END;
END;
CREATE OR REPLACE PROCEDURE DEMO_PRC ( P_OBJ DEMO_ST) AS
V_OBJ DEMO_ST := P_OBJ;
BEGIN
V_OBJ.THIS_PROC;
END;
-- TAKES AN OBJECT, NOT A PROCEDURE PER SE
-- BUT ALLOWS THE PROCEDURE TO BE PASSED WRAPPED IN AN
-- OBJECT
BEGIN
DEMO_PRC( DEMO_T1(1) );
DEMO_PRC( DEMO_T2(1) );
END;
DEMO_T1
DEMO_T2I believe that this is superior to the passing of function wrapped procedures as arguments because it is according to the intention of object orientation, whereas wrapping a procedure in a function is contrarty to the principles of good functional programming. Good practise in functional programming is to return a single strongly typed result, and produce no side effects. Since the procedure wrapped in a function is a procedure, it therefore implicitly have side effects. -
How? Flex pass variables or call function in SWF
Dear All:
I am new in Flex.
But I stuck with a problem for weeks.
I wish to communication between Flex and Flash(swf).
I tried to pass variable from Flex to Swf. (Call function in Swf also pass variables)
I did some tourital on google by using SWFLoader, which works fine.
BUT the AS code in SWF must in MAIN FRAME.
I need put my AS code by using DOCUMENT CLASS.
BUT when I using Document class, the method is not working.
The flex cannot find function in Flash.
PS.I already set main.as class as public
Hope some one can give some hint.
I really get a huge headache.
Many thanks,
HenrymyIP wrote:
> or perhaps more ideal;
>
> for(var sVar in flashVars)
> {
> i++;
> //var mcName = sVar.substr(0,3);
>
> // create the MCs:
> duplicateMovieClip(_root.testBut,"medium"+sVar,i);
> _root["medium"+sVar].testText.text=sVar;
> _root["medium"+sVar].mcName = sVar.substr(0,3);
>
>
> // assign the function to each created MC:
> _root["medium"+sVar].onRelease = function()
> {
> trace(this.mcName)
> _root[mcName]._x=0;
> }
> }
>
thanks but this does not work.
I think that the problem is that the variables defined in the
for loop do not exist in the scope of
the function.
when the MC is clicked, and the onRelease function says:
_root[mcName]._x=0;
the variable "mcName" is empty.
seb ( [email protected])
http://webtrans1.com | high-end web
design
An Ingenious WebSite Builder:
http://sitelander.com -
Passing Captivate Variables to Embedded swf
Hello,
How can i read a captivate variable in embedded swf file like cpInfoCurrentSlide;
Thanksvar cpRoot:Object = MovieClip(root);
var mainmov:Object = MovieClip(cpRoot.parent.root);
mainmov.cpInfoCurrentSlide
mainmov.rdinfoCurrentSlide
Some things only work with the old rd variables.
This works for 6 and 7, I haven't tested on 8 yet. -
OBIEE 11g How to pass variable from one prompt to another prompt in dashboard page.
How to pass variable from one prompt to another prompt in dashboard page.
I have two prompt in dashboard page as below.
Reporttype
prompt: values(Accounting, Operational) Note: values stored as
presentation variable and they are not coming from table.
Date prompt values (Account_date, Operation_date)
Note:values are coming from dim_date table.
Now the task is When user select First
Prompt value “Accounting” Then in the
second prompt should display only Accounting_dates , if user select “operational”
and it should display only operation_dates in second prompt.
In order to solve this issue I made the
first prompt “Reporttype” values(Accounting, Operational) as presentation
values (custom specific values) and default presentation value is accounting.
In second prompt Date are coming from
dim_date table and I selected Sql results as shown below.
SELECT case when '@{Reporttype}'='Accounting'
then "Dates (Receipts)"."Acct Year"
else "Dates (Receipts)"."Ops
Year" End FROM "Receipts"
Issue: Presentation variable value is not
changing in sql when user select “operation” and second prompt always shows
acct year in second prompt.
For testing pupose I kept this presentation
variable in text object of dashboard and values are changing there, but not in
second prompt sql.
Please suggest the solution.You will want to use the MoveClipLoader class (using its loadClip() and addListener() methods) rather than loadMovie so that you can wait for the file to load before you try to access anything in it. You can create an empty movieclip to load the swf into, and in that way the loaded file can be targeted using the empty movieclip instance name.
-
Using query strings to pass variables...
I'm trying to use the query string method to pass some
variables into a SWF, but I can't seem to get it to work. All of
the documentation I've seen references the object/embed method for
displaying the SWF, but I'm using Dreamweaver's
AC_RunActiveContent.js method to display the SWF. Would this cause
a problem for the query string?
Here's what I'm trying in the HTML that houses it:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../bk.css" rel="stylesheet" type="text/css"
/>
<script src="../Scripts/AC_RunActiveContent.js"
type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','wid th','301','height','240','src','videoplayer','quality','high','pluginspage','http://www.ma cromedia.com/go/getflashplayer','movie','videoplayer'
); //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=7,0,19,0"
width="301" height="240">
<param
name="movie" value="videoplayer.swf?vid=dbc2006" />
<param name="quality" value="high" />
<embed
src="videoplayer.swf?vid=dbc2006" quality="high"
pluginspage="
http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="301"
height="240"></embed>
</object></noscript>
</body>
</html>I've been doing a little research... not being a programmer,
I'm a little out to lunch on this stuff. I now realize that what I
put in the HTML page is meaningless, unless the viewer's browser
won't use JavaScript.
I now know that I need to define my variables in the HTML
page, and have the .js file recongnize and use them.
That's where my lack of knowledge really gets in the way. :)
Does anyone have any thoughts on how to modify the .js file to put
my "?vid=dbc2006" into the string?
Thanks! -
Can I pass variables in the URL string?
I am trying to get some variables into a loaded swf at
runtime. The variables will carry information so the swf can load
the correct xml file. I thought we could pass them through the URL
string like so:
new URLRequest("testing.swf?myVar=varOne
but it just throws an URL cannot be found error. How can I
get variables into my swf at runtime?What you are doing is fine. But you will always get that
error when testing
the movie (Ctrl+Enter). Try it in a browser and it should
work.
BTW, another way of doing the same is to use a URLVariables
object, like so:
var req:URLRequest = new URLRequest("testing.swf");
var vars:URLVariables = new
URLVariables("myVar=varOne&myVar2=varTwo");
req.data = vars; -
Passing variables to loaded external movie
Ok, this problem has beaten me for the last 2 days. It seems
to be extremely simple, I am on main movie and I am using
MovieClipLoader class to load external movie callMe.swf into movie
holder called holder_MC, then from main using onLoadInit or
onLoadProgress listeners I can target dynamic text inside
callMe.swf as holder_MC.myTXT.text = "blablabla" or I can change
frames in callMe.swf by holder_MC.gotoAndStop(5). But HOW TO PASS
VARIABLE myVar to callMe.swf so it executes something there? Using
holder_MC.myVar DOESN'T WORK!!!!!!!!!!!!!!
Thanks for any help,
ZbynekUPDATE... I copied the link to another page with my variables in the image attributes as I posted above. And it works using the values that are cached for those items. Is there any way to do this on the same page as my original link without my users having to change to a different page?
-
How to pass variables between loaders
Hi,
I am trying to load an image, with descriptive text and a back button on the click of a thumbnail of the image. I am using a MovieClipLoader instance to do this.
Here are my problems:
1. I tried loading the image, with the text(which is within an external swf), using the same loader, but since I am placing them dynamically, depending on the dimensions of the image, I need to pass variables between the two. The image loader is taking longer than the text (obviously) but I need the dimensions of the image before I can place the text. How do I do that??
2. I tried using two loaders, with separate listeners, and the problem once again is that the text loads before the image, and is hence placed with default values instead of the values derived from the image. The code is within onLoadInit(). Is it possible for me to get the dimensions of the image from onLoadStart()???
3. There is a back button within the text.swf. I want the image and the text.swf to be unloaded when this button is clicked. How can I achieve that? Can I call loader.unloadClip(target), from within this? Will it recognize the variable?
4. Is there a much easier way to do this, which I am sadly unaware of?
Any help will be appreciated.Tried the onloadstart() function, but it gives target._width and _height as 0. So that is ruled out...any other suggestions?
-
Passing data parameter between SWF files
Hello Xcelsius Gurus,
Is it possible to pass data parameter between SWF files?
If possible, how to achieve it?
Thank you.
JustineHi,
Thank you for the reference. Little bit confused, please let me clarify.
I do not understand how the receiver SWF receieved the data parameter and process.
For example, I have a parent dashboard and a child dashboard. In the parent dashboard, I have set up combo box to filter the data. And I want the data that I have selected in combo box to the child dashboard.
To do this, first I need to setup the flash variable at the parent dashboard to fetch the data I selected.
After this, how to link this data to the child dashboard?
Furthermore, after the child dashboard received the data parameter, I need this data to insert into the spreadsheet so I can filter the data. Is this possible?
Thanks.
Edited by: Justine Liu on Jan 19, 2010 3:11 PM -
Calling functions / setting variables in loaded SWF
You know how you can create a Movieclip object, add a
function or variable to it, then call that function or change that
variable from within the SWF that includes it? I wanna be able to
do that, only with SWFs that are loaded at run time.
My "main" SWF is simply a menu-type thing. The user clicks a
button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
associated with that button, using the AS 3.0 prescribed
Loader()-URLRequest()-addChild() method that everyone always asks
about.
This works great. But now I've got some custom objects and
such (ie., not just strings) within my MAIN.SWF that I'd like to be
able to share with the loaded SWFs. Preferably, I'd like to use an
accessor-type function (ie.,
LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
I'm willing to hack into the object itself (ie.,
LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
what it takes.
I've tried just calling the functions and setting the fields,
but the AS 3.0 compiler doesn't care for that sort of nonsense on
it's generically-defined objects. Notice also that, at run time, a
call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
So my big-brained colleagues, what's the magic?
In advance, thanks for the help!
ScottKglad,
quote:
Originally posted by:
kglad
from that error message it appears your function is expecting
a member of the MyCoolObject class, correct?
and MyCoolObject is not an instance of that class. so, you
need to fix that. ie, create a member of that class and use that
class member as the function parameter.
Heh, that's what the error message says all right. But the
object actually IS a MyCoolObject class object. I stared at this
thing for hours, and MyCoolObject IS an instance of that class. I
tried various casting combinations (including casting it to an
Object and passing that) but had no luck whatsoever.
So I googled this particular runtime error message ("Error
#1034: Type Coercion failed: cannot convert ") and found a ton of
links to other people having a similar issue. Typically, the
problem was just as you said, someone passing a button as a string,
that kinda thing. But one guy had a problem with an object he
derived from the Event class. After hours spent trying to get it to
work, he tried overriding the base class' clone() method and got it
to work:
http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
As for my project, I took a long hard look at the overall
architecture of my project and decided that it was best if all the
"real work" took place in the MAIN.SWF file. This approach would
solve a couple of other problems, and it just makes sense in a
"separate the display from the data" mentality.
So (and this is the interesting part) I changed the API for
the LOADED.SWF to accept String pairs (ie.,
LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
accepting MyCoolObj. Ran it, and Viola, now we're working without
any run time exceptions. After that glorious moment, I created a
couple of other APIs that just accepted base classes (one an int
type, the other a function type) and was happily on my way.
From this, I gather that passing non-base class (ie, derived
class) objects to loaded MovieClips via custom function APIs is...
maybe not as straightforward as we'd expect. In the grand scheme of
things though, not a big deal: As far as I'm concerned AS3 rocks.
Again Kglad, thanks for all the help: Your input on how to do
this was the big push that I needed to get over the last technical
hurdle of this project.
To those who are reading this topic for the "how do I call
functions and/or set variables in a loaded SWF?"
The short answer is to cast the loaded SWF's content object
as a MovieClip and then call the function or alter the variable:
//Load the SWF (you've seen this code a million times)
var LoadedSWFObj:Loader = new Loader();
var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
LoadedSWFObj.load(MyURL);
//This is within your Event.COMPLETE handler:
//Cast it as a MovieClip object and work with that.
var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
// or another way to cast it is:
var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
//Call yer function:
LoadedSWF.CallMe();
Maybe you are looking for
-
Weird behaviour in dragging from tilelist to list
Hi All, I am trying to drag an item from a tilelist into a list but I am encountering this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at components::TileListItem/set data()[C:\Documents and Setti
-
Hello all, I'm trying to animate my text on queue with the voiceover for each slide. Some slides have numbered/bulleted lists. My question is, is it possible to have the bullets "appear" individually, without created seperate text boxes for each bull
-
Calling Remote function tool leads always to a logon screen
Hello, I run an remote function tool in system A. In System B I run a report calling this function module. Each time, I execute the report, a remote logon screen appears. It looks the same like the one you logon the system. You have to specifiy clien
-
Seems kind of simple, but I am wondering how I can exit the execution of an event, like the way I do in Validate (true or false;). Is it exit; or something?
-
http://www.raiseupart.com/artists_Vol2.html I've just started building this site. I don't understand why it's showing up this way on the server b/c in Dreamweaver the file looks perfect. Why is this happening? I can't figure it out and I've never had