Render the .swf file as an ASP.Net header.

I have ASP.NET 2.0 with C # 2005 as my programming language. I am using CSS for layout. I am currently using a simple / static .Gif as my header. I would like to improve the look and feel by using some animation in the header. I used some flash utilities to create my required animated banner. But since I was not able to use the .swf file directly, I converted it to a .Gif that I can use and display. The problem is that the original .swf file is about 75 Kb in size, while the converted .Gif file is huge (about 4.5 Mb). I want to show the original .swf file to improve speed.

I used a CSS stylesheet to display an animated .Gif banner. I don't know how I can use the .Swf file directly.

I ask you to notify me.

Thanks.

Lalit Kumar Barik

0


a source to share


2 answers


I didn't do this, but I found the example code CodeProject .

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="200" height="100">
    <param name="movie" value="<% =swfFileName%>" />
    <param name="quality" value="high" />
    <embed src="<% =swfFileName%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="100"></embed>
</object>

      



I think this will help you get started with this. Obviously you need to replace with a <% =swfFileName%>

link to the .swf file you want to play.

0


a source


You can search for SWFObject, this is a very good standard way to embed flash ... google search swfobject here is the code / markup ...

STEP 1: Insert both Flash content and alternate content using standard compliant markup

Basic markup SWFObject uses the nested object method (with Internet Explorer's own conditional comments) to provide optimal cross-browser markup-only support, while being standards compliant and supporting alternative content

  SWFObject - step 1      

  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
    <param name="movie" value="myContent.swf" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420">
    <!--<![endif]-->
      <p>Alternative content</p>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>

</div>

      

NOTE. The nested object method requires the definition of a double object (an external object targeting Internet Explorer and an internal object targeting all other browsers), so you need to define the object attributes and the nested pair elements twice.

Required attributes:

* classid (outer object element only, value is always clsid:D27CDB6E-AE6D-11cf-96B8-444553540000)
* type (inner object element only, value is always application/x-shockwave-flash)
* data (inner object element only, defines the URL of a SWF)
* width (both object elements, defines the width of a SWF)
* height (both object elements, defines the height of a SWF) 

      

Required param element:

* movie (outer object element only, defines the URL of a SWF) 

      

NOTE. We do not recommend using the codebase attribute to specify the URL of the Flash Plugin Installer on Adobe servers, as this is prohibited by specifications that restrict its access to the current document domain only. We recommend using alternative content with a subtle message that the user can get a richer experience by downloading the Flash plugin instead. How can you use HTML to customize your Flash content?

The following commonly used optional attributes can be added to an object element:

* id
* name
* class
* align 

      



You can use the following optional Flash parameter elements (more info):

* play
* loop
* menu
* quality
* scale
* salign
* wmode
* bgcolor
* base
* swliveconnect
* flashvars
* devicefont (more info)
* allowscriptaccess (more info here and here)
* seamlesstabbing (more info)
* allowfullscreen (more info)
* allownetworking (more info) 

      

Why should you use alternative content?

The object element allows you to insert alternative content into it, which will be displayed if Flash is not installed or supported. This content will also be picked up by search engines, making it a great tool for creating search engine powered content. To summarize, you should use alternative content when you want to create content that is accessible to people who browse the web without plugins, create search engine-enabled content, or inform visitors that they can have a richer user experience by downloading the Flash module.

STEP 2: Include the JavaScript SWFObject library at the beginning of the HTML page

The SWFObject library consists of one external JavaScript file. The SWFObject will be executed as soon as it is read, and will perform all DOM manipulations immediately after the DOM is loaded - for all browsers that support this, like IE, Firefox, Safari and Opera 9+ - or otherwise, as soon as the onload event fires:

  SWFObject - step 2   

<script type="text/javascript" src="swfobject.js"></script>

      

                     ->                       

Alternative content

      ->                      

STEP 3: register your Flash content with the SWFObject library and tell SWFObject what to do with it

First, add a unique identifier to the external object tag that defines your Flash content. Second, add the swfobject.registerObject method:

  • The first argument (String, required) specifies the identifier used in the markup.
  • The second argument (String, required) specifies the Flash Player version your content is published to. It activates Flash SWF version detection to determine whether to show Flash content or force alternate content by performing DOM manipulation. Although Flash version numbers usually consist of a major.minor.release.build file, SWFObject only looks at the first 3 numbers, so both are "WIN 9,0,18,0" (IE) or "Shockwave Flash 9 r18" (all other browsers) will be translated to "9.0.18". If you want to test only the major version, you can omit the minor and graduation numbers, for example "9" instead of "9.0.0".
  • The third argument (String, optional) can be used to activate Adobe express install and specifies the URL of your quick install SWF file. Express Install displays a standardized download dialog for Flash plugins instead of Flash content when the required plugin version is not available. The expressInstall.swf file is packaged with the project by default. It also contains the corresponding expressInstall.fla and AS files (in the SRC directory) so that you can create your own custom express installation functions. Please note that express installation will only run once (on first launch), that it is only supported by Flash Player 6.0.65 or higher on Win or Mac platforms, and requires a minimum SWF size of 310x137px.
  • The fourth argument (JavaScript function, optional) can be used to define a callback function that is triggered by both the success and failure of embedding the SWF file (see API documentation)

           SWFObject - step 3          

      <script type="text/javascript">
      swfobject.registerObject("myId", "9.0.115", "expressInstall.swf");
      </script>
    
    </head>
    <body>
      <div>
    
        <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
    
          <param name="movie" value="myContent.swf" />
          <!--[if !IE]>-->
          <object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420">
          <!--<![endif]-->
            <p>Alternative content</p>
          <!--[if !IE]>-->
          </object>
          <!--<![endif]-->
        </object>
      </div>
    </body>
    
          

0


a source







All Articles