Solved

Passing Parameters to Flash

Posted on 2006-06-12
7
285 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
  • 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

Technology Partners: 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!

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

713 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