Solved

Passing Parameters to Flash

Posted on 2006-06-12
7
284 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Array is not working ( AS2 ) 4 158
free flash maker 5 216
How to add jQuery and JavaScript(s) into Dreamweaver? 1 279
How do I have music file play continuously on a website? 6 104
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 …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

809 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