Results 1 to 2 of 2

Thread: Randomize flash background

  1. #1
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default Randomize flash background

    How to make a randomize flash background?
    I have a script to randomize image

    Code:
    <style type="text/css">
    body {
    	background-repeat:no-repeat;
    	background-position:center top;
     }
    </style>
    
    <script type="text/javascript">
    
       var num;
       var temp=0;
       var speed=20000; /* this is set for 5 seconds, edit value to suit requirements */
       var preloads=[];
    
    /* add any number of images here */
    
    preload(
            'images/bg_home_1.jpg',
            'images/bg_home_6.jpg',
            'images/bg_home_7.jpg'
           );
    
    function preload(){
    
    for(var c=0;c<arguments.length;c++) {
       preloads[preloads.length]=new Image();
       preloads[preloads.length-1].src=arguments[c];
      }
     }
    
    function rotateImages() {
       num=Math.floor(Math.random()*preloads.length);
    if(num==temp){
       rotateImages();
     }
    else {
       document.body.style.backgroundImage='url('+preloads[num].src+')';
       temp=num;
    
    setTimeout(function(){rotateImages()},speed);
      }
     }
    
    if(window.addEventListener){
       window.addEventListener('load',rotateImages,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',rotateImages);
      }
     }
    </script>
    But it don't work when i try to change the image / .jpg with flash / .swf
    Thx in advanced...
    _____________________

    David Demetrius // davejob
    _____________________

  2. #2
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    so is there any suggestion, i try a lot of different thing to make this work. But it always fail.

    i still use image random, till i found the flash randomize script

    this is my website, if you need some clue about the problem

    http://www.imaxxo.net/aryaduta

    Thx in advanced
    _____________________

    David Demetrius // davejob
    _____________________

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
  •