Solved

Passing Parameters to Flash

Posted on 2006-06-12
7
287 Views
Last Modified: 2010-04-03
Hello,

Currently,
The object tag looks like the following:
 

<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="800" height="600" ID="Lesson_01">

  <param name="movie" value="flash/lesson01.swf">

  <param name="quality" value="high">

  <param name="menu" value="false">

  <param name="loop" value="0">

  <embed src="flash/lesson01.swf" width="800" height="600" loop="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false">

</embed>

</object>

 

But the param tag for the movie URL should look like below

 

<param name="movie" value="flash/lesson01.swf?http://intnycdev01.corp.domainname.com/portal/server.pt/gateway/PTARGS_0_0_667_0_0_43/http%3B/intnycdev02.corp.domainname.com/Portlets20/CBTTraining/portlet.aspx?lessonID=1">

 

The code in the actionscript should look like such

 

// This returns the querystring elements
myURL = this._url;
myPos = myURL.indexOf("?");
myParams = myURL.substring(myPos+1,myURL.length);
 

 
Then use the myParams variable in the last frame of the movie to call getURL(myParams);


Are we making any mistakes here? is the above possible?

any advice is appreciated.

thanks.
0
Comment
Question by:swisscommerce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 9

Expert Comment

by:ddlam
ID: 16886598
The URL may contains some character like %, ", ', ? which destroy the structure of your URL
but what is the problem do you encounter?

You can trace myURL, myPos or myParams as:

_root.createTextField("tracer", 100, 10, 10, 600, 100);
_root.tracer.text = myParams;
0
 

Author Comment

by:swisscommerce
ID: 16886795
ddlam,

thanks for prompt writing.

Basically the main question here is if it is possible to pass parameters to a flash movie in general.

The values will be passed from an ASPX page.


If so, would you have some sort of example code that we can see to understand the concept?
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16887069
Yes,

variables can be passed to flash movie as querystring...

you are going right way...

you only need to care about all rule which applies to querystring variables, thats all

Rgds
Aneesh
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:swisscommerce
ID: 16888879
Do you know what is the code(actionscript) used in the flash movie to read the parameters passed in to the flash movie?

any examples will do it, even if it is not related to the above case.

at the end of each swf file movie some parameters are passed to he flash movie so that we can tell if the user has viewed the file or not before going to movie 2 etc.

also when user stops in the middle of the movie without completing all 10 movies, he will be redirected to the last completed viewed movie by that user.

all parameters are sent from an ASPX file.

thanks for any advice.

i think a sample code/example will be very helpful in this case.
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16890781
you can simply receive all variables on first frame, which there same name as you have passed it..

in simple words, no need to parse it..

for example, if you have passed the variables as following:
<param name="movie" value="flash/lesson01.swf?var1=hello&var2=how r u" />

then you can simple use that in actionscript as following:
----------------
trace(var1);
trace(var2);
---------------

Rgds
Aneesh
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 16890823
another point:

you must have to pass variables in both <object> and <embed> tags,
as <object> tag is being used by IE and all Mozilla based browser only support <embed> tag...

for example:
-------
in <object> tag:
<param name="movie" value="flash/lesson01.swf?var1=hello&var2=how r u" />

in <embed> tag:
movie="flash/lesson01.swf?var1=hello&var2=how r u"

I hope it would be clear

Rgds
Aneesh
0
 

Author Comment

by:swisscommerce
ID: 16951291
thanks Aneesh, this was very useful.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question