A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: What's the best way to insert a simple .swf?

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    3

    Question What's the best way to insert a simple .swf?

    Hi guys,

    I've got an easy question. I've finished my flash file. I created it with Flash CS3. I didn't use any scripting, dynamic stuff, etc.. It's a simple flash movie of vectors/tweening.

    I want to insert it in my homepage, but when I publish it, I get quite a lot of code. I've been looking around & I see some sites that have all this javascript & some that don't.

    Could someone help me identify the correct way to embed my .swf file? I'm not a fan of .js since it doesn't work if it's turned off in a user's browser. I want my .swf file to play as long as the visitor has Flash 8 or higher installed. And if they don't, I want to display a .png instead.

    Under publish settings/Flash I set:
    Version: 8
    (the rest I left at default)

    Under publish settings/HTML I set:
    Template: Flash only
    Detect Flash Version: I checked. Should I uncheck it?
    Window mode: Transparent windowless (I want a transparent bg)

    And I have a PNG tab...

    I've noticed the code it generates includes some .js & other stuff
    Code:
    <script language="javascript"> AC_FL_RunContent = 0; </script>
    <script language="javascript"> DetectFlashVer = 0; </script>
    <script src="AC_RunActiveContent.js" language="javascript"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 8;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Revision of Flash required
    var requiredRevision = 24;
    // -----------------------------------------------------------------------------
    // -->
    </script>
    Then has some if statements
    Code:
    if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
    	alert("This page requires AC_RunActiveContent.js.");
    This will only alert if this .js isn't on my server, right? Visitors don't need it?

    Code:
    } else {
    	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    	if(hasRightVersion) {  // if we've detected an acceptable version
    		// embed the flash movie
    		AC_FL_RunContent(
                  ....
    Is this the code that's ran if they don't have flash, or have a really old version:
    Code:
    } else {  // flash is too old or we can't detect the plugin
    		var alternateContent = 'Alternate HTML content should be placed here.'
    			+ 'This content requires the Adobe Flash Player.'
    			+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
    		document.write(alternateContent);  // insert non-flash content
    	}
    Am I supposed to manually put an alternate image here?

    Then why is this here:
    Code:
    <noscript>
    	// Provide alternate content for browsers that do not support scripting
    	// or for those that have scripting disabled.
      	Alternate HTML content should be placed here. This content requires the Adobe Flash Player.
      	<a href="http://www.macromedia.com/go/getflash/">Get Flash</a>
    </noscript>
    It sounds like the .swf won't play if .js is disabled, & that's what this code's for?

    Is all this necessary?

    Thanks for your help,
    -David

  2. #2
    Juvenile Delinquent CVO Chris's Avatar
    Join Date
    Jul 2002
    Location
    Ulster, UK
    Posts
    520
    Put all that in your web page and put the HTML for the PNG file you have between the <noscript> tags.

    ie:
    <noscript>
    <img src="YOURFILE.png" alt="" />
    </noscript>

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    3
    I've been playing with this code all day. Is it standard practice to not display the .swf if the visitor has javascript disabled?

    I can't seem to find a cross-browser method. Oddly enough, Firefox is the browser that's not cooperating.

    Thanks,
    -David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center