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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unloading variable in flash to mp3 player

Status
Not open for further replies.

misslilbit02

Programmer
Jun 25, 2005
8
0
0
US
Hi All,

Thank you so much for a community forum like this one. Ok this is the deal. I'm not program saavy so please be tender.

What I'm tyring to accomplish is having multiple drop down menus on a .htm pg which passes a song (the variable) to my embedded flash player which in turn plays the selected song. Ok so far I think I have a grip on the passing the variable thing (the code is below).

I've gotten confused because I know you have to unload the variable in FLASH but I'm lost in how you pass this variable to the player. I've been using this code to pass the variable:

loadMovie(_root.&sound);

but I keep getting this error in flash:
Scene=Scene 1, Layer=actions, Frame=1: Line 1: Expected a field name after '.' operator.
loadMovie(_root.&sound);

Please help.

So far this is my .htm

<html>
<head>
<script type="text/javascript">
function getVar(variable)
{
document.getElementById('flash').innerHTML = '<object type="application/x-shockwave-flash" data="audioplayer.swf" width="200" height="200">\n'
+'<param name="movie" value="audioplayer.swf">\n'
+'<param name="FlashVars" value="&amp;sound='+variable+'">\n'
+'</object>';
}
</script>
</head>
<body>
<form action="#" method="post">
<select name="menu" onChange="getVar(this.options[this.selectedIndex].value)">
<option value="#">Play Demo</option>
<option value="B01.wma">Bumper 1Demo</option>
<option value="/music/bumpers/B02.wma">Bumper 2Demo</option>
</select>
</form>
<div id="flash">
<object type="application/x-shockwave-flash" data="audioplayer.swf" width="200" height="200">
<param name="movie" value="audioplayer.swf">
<param name="FlashVars" value="&amp;sound=#">
</object>
</div>
</body>
</html>

FLASH:
loadMovie(_root.&amp;sound);
 
First of all, FlashVars are in this format:

<PARAM NAME=FlashVars VALUE="variable1=value1&variable2=value2">

Then in Flash do:

trace(variable1)

...to verify the variable is passed correctly.

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top