Hi there. I have a javascript function that returns the name of a file
to be read by flash. I'm having a bit of a problem setting the 'file'
flash var correctly with this function. I'm using swfobject 2.2. Maybe
a look at my code will clarify things.

 <script type="text/JavaScript" src="swfobject.js"></
script>                  //fetching the filename with ajax
<script type='text/javascript'>
function getStreamname()
{
  if(window.XMLHttpRequest)
  {
   xm= new XMLHttpRequest();
  }
 else
  {
  xm= new ActiveXObject("Microsoft.XMLHTTP");
  }
  xm.onreadystatechange=function()
  {
  if (xm.readyState==4 && xm.status==200)
  {
    return "'" + xm.responseText + "'";//get the filename from the
database.
   }
 }

 xm.open("POST","returnStreamName.php",true);
 xm.send();
 }

  function createPlayer()
  {
   var flashvars = {
                        'file':                getStreamname(), //call
the function that returns the filename

                       'streamer':            'rtmp://192.168.10.1/
live',
                       'provider':              'rtmp',
                       'autostart':        'true'
  };

 var params ={
                      'allowfullscreen':     'true',
                      'allowscriptaccess':   'always',
                      'bgcolor':             '#FFFFFF'
  };
 var attributes = {
                         'id':                  'player1',
                        'name':                'player1'
  };
  swfobject.embedSWF('player.swf', 'mpl', '300', '250', '9', 'false',
flashvars, params, attributes);
}
</script>

-- 
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en.

Reply via email to