views:

2558

answers:

3

I have an ASP. Net 2.0 website with C# 2005 as the programming language. I am using CSS for the layout. Currently I am using a plain/static .Gif image as my header. I would like to enhance the look by using some animation in the header. I used some flash utilities to design my required animated banner. But since I was unable to use the .swf file directly I converted it to .Gif which I am able to use and display. The problem is the original .swf file was of the size around 75 Kb whereas the converted .Gif file is huge (around 4.5 Mb). I want to display the original .swf file to improve speed.

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

Kindly guide me.

Thank You.

Lalit Kumar Barik

A: 

I haven't done this, but I found some sample code on 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 should help you get started with it. Obviously you have to replace <% =swfFileName%> by a reference to the .swf file you want to play.

Cloud
A: 

copy original swf file to ur project folder open html file which is created with swf file from flash copy code from to paste it in to the asp.net page on which u want that animation .in that pasted code just modify the source of swf file ...it will definetly run...

A: 

You can look up SWFObject it is a very good standard way to embed flash... google search swfobject here is the code / markup...

STEP 1: Embed both Flash content and alternative content using standards compliant markup

SWFObject's base markup uses the nested-objects method (with proprietary Internet Explorer conditional comments) to ensure the most optimal cross-browser support by means of markup only, 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-objects method requires a double object definition (the outer object targeting Internet Explorer and the inner object targeting all other browsers), so you need to define your object attributes and nested param 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 advise not to use the codebase attribute to point to the URL of the Flash plugin installer on Adobe's servers, because this is illegal according to the specifications which restrict its access to the domain of the current document only. We recommend the use of alternative content with a subtle message that a user can have a richer experience by downloading the Flash plugin instead. How can you use HTML to configure your Flash content?

You can add the following often-used optional attributes to the object element:

* id
* name
* class
* align 

You can use the following optional Flash specific param 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 nest alternative content inside of 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-friendly content. Summarizing, you should use alternative content when you like to create content that is accessible for people who browse the Web without plugins, create search-engine-friendly content or tell visitors that they can have a richer user experience by downloading the Flash plug-in.

STEP 2: Include the SWFObject JavaScript library in the head of your HTML page

The SWFObject library consists of one external JavaScript file. SWFObject will be executed as soon as it is read and will perform all DOM manipulations as soon as 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 id to the outer object tag that defines your Flash content. Second add the swfobject.registerObject method:

  1. The first argument (String, required) specifies the id used in the markup.
  2. The second argument (String, required) specifies the Flash player version your content is published for. It activates the Flash version detection for a SWF to determine whether to show Flash content or force alternative content by doing a DOM manipulation. While Flash version numbers normally consist of major.minor.release.build, SWFObject only looks at the first 3 numbers, so both "WIN 9,0,18,0" (IE) or "Shockwave Flash 9 r18" (all other browsers) will translate to "9.0.18". If you only want to test for a major version you can omit the minor and release numbers, like "9" instead of "9.0.0".
  3. The third argument (String, optional) can be used to activate Adobe express install and specifies the URL of your express install SWF file. Express install displays a standardized Flash plugin download dialog instead of your Flash content when the required plugin version is not available. A default expressInstall.swf file is packaged with the project. It also contains the corresponding expressInstall.fla and AS files (in the SRC directory) to let you create your own custom express install experience. Please note that express install will only fire once (the first time that it is invoked), that it is only supported by Flash Player 6.0.65 or higher on Win or Mac platforms, and that it requires a minimal SWF size of 310x137px.
  4. The fourth argument (JavaScript function, optional) can be used to define a callback function that is called on both success or failure of embedding a SWF file (see API documentation)

    SWFObject - step 3

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

CraigJSte