Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set filename through <Param> tag?

Status
Not open for further replies.

Twinster

Programmer
Aug 18, 2008
12
0
0
SE
Hey Guys!
I have a fairly simple question, I think. I am creating a flash project where the flash movie loads an mp3 file externally.

What I mean is. When i include the flash movie (Object) into the html document I want to be able to set the filename through a <Param> tag.

Meaning, I want to be able to use the same flash object (movie) but being able to set the mp3 file for each movie.

Kind of like this:

<object type="application/x-shockwave-flash" data=" width="290" height="24" id="audioplayer1">
<param name="movie" value=" />
<param name="FlashVars" value="playerID=1; soundFile=music.mp3" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="bgcolor" value="#FFFFFF" /></object>



So what I wanna do basically is to be able to set some variable in the flash movie by setting them in the <param> tag. And I would like to know how to achieve this. What do I have to do in flash actionscript.

I want to be able to use the flash movie several times on the same page setting just the playerID variable to distinguish them from each other.

Thanks in advance guys! Hope to a quick answer.
Best,
Richard
 
Thanks, but this piece of code was just an example. What I don't know is how to make Flash read this external variable. How can I achieve this?

Thanks again and if you can elaborate a little bit more and maybe add some action script examples or something? I would greatly appreciate it!

Best Regards,
Richard
 
What's wrong with this??
Why can't I hear any music when I click play?
Am I using the FlashVars in a wrong way?
Can someone tell me what to do?

In Flash;

var the_song:Sound = new Sound();
var songName:String = this.root.loaderInfo.parameters.songFile;


play_btn.onRelease = function(){
the_song.loadSound(songName, true);
the_song.start();
}
stop_btn.onRelease = function(){
the_song.stop();
}



In HTML
<html>
<head>
<title>Player Test</title>
</head>
<body topmargin="0" bgcolor="#000000" leftmargin="0">
<Font Color="#FFFFFF">
<center>
<br>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" width="100" height="30" id="SitePlayer" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="SitePlayer.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="SitePlayer.swf" quality="high" bgcolor="#000000" width="100" height="30" name="SitePlayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" />
<param name="FlashVars" value="songFile=Sample.mp3" />
</object>

</center>
</Font>
</body>
</html>
 
Hey!
Yeah, I kind of figured out what the problem was. I tried to write the AS in AS3 when I only had AS2. Which of course created a problem of incompatibility issues. I am trying on a AS3 software now just to see what I can come up with.

Stay tuned...round 2! ;)

Thanks!
Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top