PDA

View Full Version : problem in show swf file randomly



sandra
05-28-2007, 03:02 PM
I have a problem in my page with show my swf file randomly. i used bellow code :

<script type="text/javascript">
(function(){
var theSwf=["images/ad/ad_screencooling-4.swf", "images/ad/ad_screencooling.swf", "images/ad/ad_kaspersky2.swf"];
theSwf.sort(function() {return 0.5 - Math.random();})

document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n\
codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"\n\
width="300" height="60">\n\
<param name="movie" value="'+theSwf[0]+'"> \n\
<param name="quality" value="high">\n\
<param name="wmode" value="transparent">\n\
<param name="menu" value="false">\n\
<!--[if !IE]> <-->\n\
<object data="'+theSwf[0]+'"\n\
width="362" height="287" type="application/x-shockwave-flash">\n\
<param name="quality" value="high">\n\
<param name="wmode" value="transparent">\n\
<param name="menu" value="false">\n\
<param name="pluginurl" value=" http://www.macromedia.com/go/getflashplayer">\n\
FAIL (the browser should render some flash content, not this).\n\
</object>\n\
<!--> <![endif]-->\n\
</object>\n');
})();
</script>



so
i used it just in htm page not in asp. do u know the reason?
also this script just work in ie and the firefox didn't support it. (fire fox show that swf files randomly with wrong size but ie show it completely. \
Would you please help me to solve this problem?

benslayton
05-28-2007, 04:59 PM
your better bet would probally be PHP, or ASP which it looks like you have from your original post. But you will probally get most help on PHP here since its what most people know...

jscheuer1
05-28-2007, 05:47 PM
this script just work in ie and the firefox didn't support it. (fire fox show that swf files randomly with wrong size but ie show it completely. \
Would you please help me to solve this problem?


Well, the script actually looks OK. The problem with the size of the flash display is due to the fact that you have different dimensions in the two object tags:


width="300" height="60">\n\

and:


width="362" height="287" type="application/x-shockwave-flash">\n\

The first line is used by IE and the second by all others. If IE shows the correct size, change the second line to:


width="300" height="60" type="application/x-shockwave-flash">\n\

Incidentally, if this were to be made an external script, you wouldn't have that 'click to activate' stuff. And, it would be a good idea to include a tag set for non-javascript enabled browsers enclosed in <noscript></noscript> tags (without the \n\'s) that features only one of the possible ads in the 'source' entry points:


<param name="movie" value="images/ad/ad_screencooling-4.swf">

and:


<object data="images/ad/ad_screencooling-4.swf"

respectively.

sandra
05-29-2007, 05:25 AM
Well, the script actually looks OK. The problem with the size of the flash display is due to the fact that you have different dimensions in the two object tags:


width="300" height="60">\n\

and:


width="362" height="287" type="application/x-shockwave-flash">\n\

The first line is used by IE and the second by all others. If IE shows the correct size, change the second line to:


width="300" height="60" type="application/x-shockwave-flash">\n\

Incidentally, if this were to be made an external script, you wouldn't have that 'click to activate' stuff. And, it would be a good idea to include a tag set for non-javascript enabled browsers enclosed in <noscript></noscript> tags (without the \n\'s) that features only one of the possible ads in the 'source' entry points:


<param name="movie" value="images/ad/ad_screencooling-4.swf">

and:


<object data="images/ad/ad_screencooling-4.swf"

respectively.

Thanks john for your useful guidance.

sandra
05-29-2007, 06:06 AM
It works correctly right now. just a problem :
whenever i used this script code in asp page, it doesn't work but the script code work correctly if i change my page to htm instead of asp.
what should i do?

jscheuer1
05-29-2007, 06:28 AM
Well, there really isn't any reason why just having it on an asp page would stop it from working. But, if you are having a problem, use it on an htm page if that works.

Now, if you are using it as a part of an asp include, you have to make sure the paths are valid for the generated code, use absolute paths if there is any doubt. And, there can be other problems with scripts and includes. It really is better (easier) if using a script on several pages to use it as an external script, including it that way, rather than as an include or a part of an include.

To be any more specific, I would need a link to your page.

sandra
05-29-2007, 06:43 AM
Thanks for your prompt response.
it was work on htm page. i used that script code as a include page (in htm and asp page. both of them) like you said but it doesn't work either.

jscheuer1
05-29-2007, 07:44 AM
Actually, I said that if using it as an include doesn't work, don't use it as an include.

sandra
05-29-2007, 12:05 PM
thanks alot for your guidness. :)