embeding flash with javascript

Discussion in 'JavaScript' started by dabontv, Sep 9, 2006.

  1. #1
    I was wondering if there was a way to embed a .swf file using java instead of html. I remeber ready somewhere that you could, but I can't find it and I want to find out.
     
    dabontv, Sep 9, 2006 IP
  2. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, there is a way.

    This is the way I have embedded flash on my website's intro:

    
    <script type="text/javascript" language="javascript"><!--
    var flashwidth		= "800"
    var flashheight		= "400"
    var color	             = "0000FF"
    
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" id="YOUR_MOVIE">');
    document.write('<PARAM NAME="movie" VALUE="YOUR_MOVIE.swf">');
    document.write('<PARAM NAME="quality" VALUE="high">');
    document.write('<PARAM NAME="wmode" VALUE="transparent">');
    document.write('<PARAM NAME="bgcolor" VALUE="#'+color+'">');
    document.write('<EMBED src="YOUR_MOVIE.swf" quality="high" wmode="transparent" bgcolor="#'+color+'"  WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" NAME="YOUR_MOVIE" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
    document.write('</EMBED>');
    document.write('</OBJECT><br>');
    //-->
    Code (markup):
    change YOUR_MOVIE for your own file name and ID.
     
    Pat Gael, Sep 9, 2006 IP
  3. dabontv

    dabontv Active Member

    Messages:
    277
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #3
    alright, thanks a lot
     
    dabontv, Sep 9, 2006 IP
  4. ashiezai

    ashiezai Peon

    Messages:
    927
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #4
    May i know what is the rational behind this?
    Why can't just use the plain and simple html? And advantage of this?
     
    ashiezai, Sep 9, 2006 IP