Results 1 to 5 of 5

Thread: Flying image script - pause between planes

  1. #1
    Join Date
    Dec 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Flying image script - pause between planes

    Since I am unfamiliar with Javascripting, I haven't got a clue on how to make the plane come by once every X seconds instead of continiously.

    As you can see at the demo page, this script will freak people out the way it is now:
    http://dynamicdrive.com/dynamicindex4/xoomimage.htm

    I'm sure someone knows an easy solution for this.

    Thanx for thinking with me...

  2. #2
    Join Date
    Dec 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OK, let's try this again......

  3. #3
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Try this code, it's absolutely horrific coding on my behalf but it should work:

    HTML Code:
    <html><head></head>
    
    <body onload="Ypick()">
    <script language="VBScript">
    on error resume next
    if parent.navButtonStatus <> 3 then
    	if err.number <> 0 then
    		call parent.ThereIsAnError
    	end if
    end if 
    </script>
    <script language="JavaScript">
    
    /*
    Flying Image Script- 
    By Dylan Coldblatt (codeboy14@yahoo.com)
    Submitted to Dynamicdrive.com for featuring in it's archive
    For full source code, installation instructions,
    100's more DHTML scripts, and Terms Of
    Use, visit dynamicdrive.com
    */
    
    	var yend;
    	var ystart;
    	var ydiff;
    	var xincrement;
    	var yincrement;
    	var screenwidth;
    	var screenheight;
    
    function Ypick(){
    ball.width=100;
       if (!document.all)
       return
    	screenwidth = screensize.offsetWidth;
    	screenheight = screensize.offsetHeight;
    	xincrement = (screenwidth/10);
    	ystart = Math.round(Math.random()*(screenheight-92));
    	yend = Math.round(Math.random()*(screenheight-92));
    	document.all.ball.style.top=ystart;
    	document.all.ball.style.left=-100;
    	if (ystart > yend){
    		ydiff = (ystart-yend);
    		yincrement = (ydiff/xincrement);
    		Moveneg();
    	}
    	else {
    		ydiff = (yend-ystart);
    		yincrement = (ydiff/xincrement);
    		Movepos();
    	}
    }	
    function Moveneg(){
    	if (screenwidth > parseInt(document.all.ball.style.left)) {
            with (document.all.ball) {
    		style.left = parseInt(style.pixelLeft + 10);
    		style.top = parseInt(style.pixelTop - yincrement);
    		}
            setTimeout('Moveneg()',20);
        }
    	else {
    		with (document.all.ball) {
    		style.left = parseInt(style.pixelLeft - screenwidth);
    		style.top = parseInt(style.pixelTop - yend);
    		}
    		setTimeout('Ypick()',2000);
    		ball.width=1;
    	}
    }
    function Movepos(){
    	if (screenwidth > parseInt(document.all.ball.style.left)) {
            with (document.all.ball) {
    		style.left = parseInt(style.pixelLeft + 10);
    		style.top = parseInt(style.pixelTop + yincrement);
    		}
            setTimeout('Movepos()',20);
        }
    	else {
    		with (document.all.ball) {
    		style.left = parseInt(style.pixelLeft - screenwidth);
    		style.top = parseInt(style.pixelTop - yend);
    		}
    		setTimeout('Ypick()',2000);
    		ball.width=1;
    	}
    }
    </script>
    <div id="screensize" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%"></div>
    <p><img id="ball" SRC="http://dynamicdrive.com/plane.gif" style="container:in-flow;position:relative;left:-100;top:0;visibility:show">
    </body>
    
    </html>
    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  4. #4
    Join Date
    Dec 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanx very much!!!

    Can you perhaps do the same with the "Flying planes" script???

  5. #5
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Woops, forgot to mention
    This line: setTimeout('Ypick()',2000);
    Is one of the lines I customized. 2000ms is what it waits to display another plane. Make this number larger for a longer delay.

    Please link to the script you want modified.

    Merry Christmas
    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

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
  •