Results 1 to 9 of 9

Thread: problem in show swf file randomly

  1. #1
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem in show swf file randomly

    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="clsid27CDB6E-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?

  2. #2
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    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...

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by sandra View Post
    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:

    Code:
    width="300" height="60">\n\
    and:

    Code:
    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:

    Code:
    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:

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

    Code:
    <object data="images/ad/ad_screencooling-4.swf"
    respectively.
    Last edited by jscheuer1; 05-29-2007 at 05:40 AM. Reason: Fix typo in last code block
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Thank you

    Quote Originally Posted by jscheuer1 View Post
    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:

    Code:
    width="300" height="60">\n\
    and:

    Code:
    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:

    Code:
    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:

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

    Code:
    <object data="images/ad/ad_screencooling-4.swf"
    respectively.
    Thanks john for your useful guidance.
    Last edited by jscheuer1; 05-29-2007 at 05:40 AM. Reason: Fix quoted typo (see previous post)

  5. #5
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thank you and another question

    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?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Actually, I said that if using it as an include doesn't work, don't use it as an include.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    thanks alot for your guidness.

Bookmarks

Posting Permissions

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