Some codes wrote by my self

Discussion in 'JavaScript' started by AoaoSo, Apr 5, 2006.

  1. #1
    Play flash and mpeg easily in your pages.

    
    function FPly(url,wt,ht){
    url=url.toLowerCase();
    if(url.indexOf('.swf')>0){
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+wt+'" height="'+ht+'" align="middle">');
    document.write('<param name="movie" value="'+url+'" \/><param name="quality" value="high" \/><param name="menu" value="false">');
    document.write('<embed src="'+url+'" quality="high" width="'+wt+'" height="'+ht+'" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" \/><\/object>');
    }
    if(url.indexof('.wma')>0||url.indexof('.wmv')||url.indexof('.mp3')||url.indexof('.mpeg')){
    document.write('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" width="'+wt+'" height="'+ht+'"><param name="filename" value="'+url+'"/>');
    document.write('<embed src="'+url+'" playcount="1"  width="'+wt+'" height="'+ht+'"></embed></object>}
    if(url.indexof('.rm')>0){
    document.write('<embed name="rplayer" type="audio/x-pn-realaudio-plugin" src="'+url+'" controls="ControlPanel,StatusBar" width="'+wt+'" height="'+ht+'" autostart="true" loop="true"><\/embed>');
    }
    }
    
    Code (markup):
    you can play some media(swf,mpeg,rm,rmvb,mp3,wmv) by using

    <script>
    FPly(banner.swf,468,60);
    FPly(shake.mpeg,400,300);
    </script>
     
    AoaoSo, Apr 5, 2006 IP
    angellica2017 likes this.
  2. cashboy

    cashboy Peon

    Messages:
    66
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    thanks AoaoSo for the great share.... I always wondered how vbarcade coding is done... u just solved the mystery... it is the great one!
     
    cashboy, Apr 21, 2006 IP
  3. melster

    melster Guest

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hate to be a pain, but can you explain this for the dummies .... ?
     
    melster, Sep 18, 2006 IP
  4. pkrumins

    pkrumins Well-Known Member

    Messages:
    74
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    128
    #4
    thanks for sharing!
     
    pkrumins, Sep 23, 2006 IP
  5. Evoleto

    Evoleto Well-Known Member

    Messages:
    253
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Good contribution. Also if you store the JS code in an external file and loading it into the HTML code would also in most cases get rid of the "Click this element to activate it" nasty message:

    
    <script type='text/javascript' src='loader.js'></script>
    // paste the FPly() function code in loader.js
    
    <script type='text/javascript'>
    FPly(banner.swf,468,60);
    FPly(shake.mpeg,400,300);
    </script>
    
    Code (markup):
    I'm using this technique successfully in serveral sites after spotting it in an Adobe Devpaper.
     
    Evoleto, Sep 23, 2006 IP