Flash and Asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • apurvaG
    New Member
    • Apr 2007
    • 14

    Flash and Asp.net

    Hi All,

    I have created a swf file and embedded it in my aspx page using following steps:

    1. I have created DIV tag in my aspx page which will hold the swf file
    Code:
    <div id="flashDiv" runat ="server"></div>
    2. In the <Header> of the aspx page I have added reference of my java script file as below, which has a function to create the object tag and embed it in the div.
    Code:
    <script type="text/javascript" src="/scripts/MyJS.js" language="javascript"></script>
    3. "MyJs.js" file has a function which creates the <object> tag using the parametes passed as below:
    Code:
    function loadSWF(code,server,FileVersion)
    {
       var filePath="Flashfile/"+FileVersion+".swf";
       document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" height="100%" width="100%">\n');
       document.write('<param name="movie" value="' + filePath + '"/>\n');
       document.write('<param name="quality" value="high"/>\n');
       document.write('<param name="FlashVars" value="cname=' + code + '"/>\n');
       document.write('<embed height="100%" pulginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" quality="high" src="' + filePath + '" type="application/x-shockwave-flash" width="100%" FlashVars="cname=' + code + '"></embed>\n');
       document.write('</object>\n');
    }


    4. In Page_Load event of my ASPX page I have added following code which calls the "loadSWF" function as below:
    Code:
      
     Dim scriptText As String = Nothing
                scriptText = "<script type=""text/javascript"">loadSWF("config","localhost", "MySwfV1");</script>"
                flashDiv.InnerHtml = scriptText
                Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "CounterScript", scriptText, True)
    Above code works fine expect the hieght and width of the container DIV/flash object is not getting set properly and due to which the flash file looks very tiny like a thumbnail. Earlier the code was written using classic asp page and that time it was working fine and the flash file was getting embedded with proper dimentions, when I have converted the asp file to aspx we started facing the problem.

    Can anyone please help?

    Thanks in advance,
    ApurvaG
Working...