Solved

Passing Parameters to Flash

Posted on 2006-06-12
7
281 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Rotating Adobe pdf document 4 300
Open Source MP4 Flash Player 2 160
EMET 5.2 / Adobe Flash 2 219
File drag and drop 6 127
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 …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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 record live broadcast.

705 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

15 Experts available now in Live!

Get 1:1 Help Now