Solved

Passing Parameters to Flash

Posted on 2006-06-12
7
283 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
YouTube Link 10 358
Action Script coding 1 174
Open Source MP4 Flash Player 2 178
Converting CFGRID from Flash to HTML in Coldfusion 1 96
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now