Validating Flash

  • Kai
  • Newbie
  • Newbie
  • Kai
  • Posts: 8
  • Loc: Scotland

Post 3+ Months Ago

Hi,

At oyster web one of the tasks we carry out on a site is making sure it is w3 compliant. Brining flash onto the page has always been a problem with the W3.org html valuator, for example the code produced by Macromedia Dreamwaver brings up the 7 errors:

Code: [ Select ]
1. Line 78, column 19: there is no attribute "SRC"
<embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.

2. Line 78, column 38: there is no attribute "QUALITY"
<embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.

3. Line 78, column 57: there is no attribute "PLUGINSPAGE"
...flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashpl

4. Line 78, column 108: there is no attribute "TYPE"
...cromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1

5. Line 78, column 146: there is no attribute "WIDTH"
...application/x-shockwave-flash" width="100" height="100"></embed>

6. Line 78, column 159: there is no attribute "HEIGHT"
...-shockwave-flash" width="100" height="100"></embed>

7. Line 78, column 164: element "EMBED" undefined
...kwave-flash" width="100" height="100"></embed>
  1. 1. Line 78, column 19: there is no attribute "SRC"
  2. <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.
  3. 2. Line 78, column 38: there is no attribute "QUALITY"
  4. <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.
  5. 3. Line 78, column 57: there is no attribute "PLUGINSPAGE"
  6. ...flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashpl
  7. 4. Line 78, column 108: there is no attribute "TYPE"
  8. ...cromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1
  9. 5. Line 78, column 146: there is no attribute "WIDTH"
  10. ...application/x-shockwave-flash" width="100" height="100"></embed>
  11. 6. Line 78, column 159: there is no attribute "HEIGHT"
  12. ...-shockwave-flash" width="100" height="100"></embed>
  13. 7. Line 78, column 164: element "EMBED" undefined
  14. ...kwave-flash" width="100" height="100"></embed>


Searching the web, we could not find a solution. I the past week I have been tackling a piece of JavaScript with a lot of code, when it dawned on me. CDATA.

So here’s the code to do it:

Javascript In head, or better still, an external js file linked i the head (“oyster-flash” being the variable name to indicate the flash file):

Code: [ Select ]
function flash(oyster-flash) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="175">');
document.write('<param name="movie" value="flashdirectory/' + oyster-flash + '.swf');
document.write('<embed src=" flashdirectory/' + oyster-flash + '.swf " quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="175"></embed>');
document.write('</object>');   
}
  1. function flash(oyster-flash) {
  2. document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="175">');
  3. document.write('<param name="movie" value="flashdirectory/' + oyster-flash + '.swf');
  4. document.write('<embed src=" flashdirectory/' + oyster-flash + '.swf " quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="175"></embed>');
  5. document.write('</object>');   
  6. }


On the page (“flash” being the name of the flash file) :

Code: [ Select ]
<script type='text/javascript'>
//<![CDATA[
flash('flash');
//]]></script>
  1. <script type='text/javascript'>
  2. //<![CDATA[
  3. flash('flash');
  4. //]]></script>



The script above gives no errors on the w3 Validator, shortens the on-the-page code and has no effect to the playing of the flash file.

Hope this helps

Kai
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

all good until someone has javascript turned off, this article is handy for writing markup that validates and allows you to embed:

http://www.alistapart.com/articles/flashsatay/

I think it has less code as well.
  • Kai
  • Newbie
  • Newbie
  • Kai
  • Posts: 8
  • Loc: Scotland

Post 3+ Months Ago

I see your point in the javascript side of things. i personally think that disabling javascript lowers the usibility of alot of websites. The top 10 ranked sites on Alexa all have javascript, exept the one that seems to be a doorway page to me.

the diffrence between:
Code: [ Select ]
<script language="JavaScript" src="flash.js" type="text/javascript"></script>
<script type='text/javascript'>
//<![CDATA[
flash('flash');
//]]></script>
  1. <script language="JavaScript" src="flash.js" type="text/javascript"></script>
  2. <script type='text/javascript'>
  3. //<![CDATA[
  4. flash('flash');
  5. //]]></script>


on the page and:
Code: [ Select ]
<object type="application/x-shockwave-flash
data="c.swf?path=movie.swf"
width="400" height="300">
<param name="movie"
value="c.swf?path=movie.swf" />
<img src="noflash.gif"
width="200" height="100" alt="" />
</object>
  1. <object type="application/x-shockwave-flash
  2. data="c.swf?path=movie.swf"
  3. width="400" height="300">
  4. <param name="movie"
  5. value="c.swf?path=movie.swf" />
  6. <img src="noflash.gif"
  7. width="200" height="100" alt="" />
  8. </object>


on the page is 144 characters to 202 characters which is a very minor difference, but once you add in extra parameters, the second gets gains characters on the page, whereas the first stays the same. An example of a typical required perameter for some of the sites i have included flash on is:
Code: [ Select ]
<param name="wmode" value="transparent">,
which makes flash accept a z-index when working with DIVs.

Thank you for your input.
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

Kai wrote:
i personally think that disabling javascript lowers the usibility of alot of websites.


lol I personally think that making a site that requires javascript to work is bad design :lol: looking at it from different side I think lol.
  • Kai
  • Newbie
  • Newbie
  • Kai
  • Posts: 8
  • Loc: Scotland

Post 3+ Months Ago

i totally agree, it is one of the problems with alot of sites. I never said a site that requires javascript to run.

I said lowers usability, not stops usability.
  • Petebadger
  • Novice
  • Novice
  • Petebadger
  • Posts: 19
  • Loc: Scotland

Post 3+ Months Ago

Several good points made in this discussion, from my perspective, after two years in the wilderness, its good to see that there are now solutions to this problem.

Nice one Kai

p.s oh the english language...its a complicated beast.....I mean lowers and stops they mean the same don't they? :oops:
  • awasthiashish
  • Born
  • Born
  • awasthiashish
  • Posts: 2
  • Loc: SYDNEY

Post 3+ Months Ago

Hi
I had similar problem with flash at my website http://www.astragalaxy.com/
which I have resolved using following article
http://www.alistapart.com/articles/flashsatay/

I thought this might help.
Good luck
Ashish
  • madmonk
  • Mastermind
  • Mastermind
  • madmonk
  • Posts: 2115
  • Loc: australia

Post 3+ Months Ago

alistapart.com is good. thanks for sharing mate.
  • barry
  • Graduate
  • Graduate
  • User avatar
  • Posts: 115
  • Loc: scotland

Post 3+ Months Ago

I have been putting flash on mony of my clients site for gaes now and using the flash satty method to make the flash validate

use this code to make it valid and replace the "your file name here"with the file name of your preloader

<OBJECT DATA="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
type="application/x-shockwave-flash" WIDTH="241" HEIGHT="59" >
<PARAM NAME="movie" VALUE="your file name here .swf" />
<PARAM name=quality value=high />
</OBJECT>

If you are validating for XHTML dont forget to uncapitalise all the tags. I took this from a html site i designed so it is caps. (could have been either).

The reason you are using a seperate preloader for loading the main movie and not using a preloader that is part of the main file is as follows:

This method will load the entire movie before you see anything playing so tho make the viewer see the thing working as a normal flash file and see almost instant results you use a preloader that is only about 2 or 3 k so it loads instantly and start preloading the external file into the applet.

Cool

This is not my design
For a far better explanation of this method type

flash satty into the search box on google

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.