473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't seem to figure out how to get the ".complete" to return true or false...

Okay... so I'm generating a custom Slideshow tool for my friend... and I never seem to get any replies from Webberdev, so here I am, posting on a completely new forum...

Anyways, the code is here: http://moltx.name/index_code.php?f=....p&u=1183295841
The page is here: http://help.moltx.name/sites/darkvir...&image=sample2


I've turned off the images from showing... just in the functions "preloadImages" I can't seem to get document.preloadProgressBar.complete or any of the other items with .complete at the end of them to return true or false... I've rearanged the code a ton, and still have gotten an error saying the code is null.
Jul 1 '07 #1
7 1633
Logician
210 100+
I've turned off the images from showing... just in the functions "preloadImages" I can't seem to get document.preloadProgressBar.complete or any of the other items with .complete at the end of them to return true or false... I've rearanged the code a ton, and still have gotten an error saying the code is null.
Have you checked that document.getElementById is actually returning a reference to an image?
Jul 1 '07 #2
(Can't believe that I got a response. =D)

It is returning a result, but my problem relies with preloading -this- part of the function:
Expand|Select|Wrap|Line Numbers
  1.         else if(this.preloaderLoading)
  2.             {
  3.                 var preloaderProgressBar;
  4.                 this.preloaderProgressBar = new Image();
  5.                 this.preloaderProgressBar.src = "./images/bar.png";
  6.                 document.preloaderProgressBar = new Image();
  7.                 document.preloaderProgressBar.src = this.preloaderProgressBar;
  8.                 var preloaderLeft;
  9.                 this.preloaderLeft = new Image();
  10.                 this.preloaderLeft.src = "./images/left.png";
  11.                 document.preloaderLeft = new Image();
  12.                 document.preloaderLeft.src = this.preloaderLeft;
  13.                 var preloaderRight;
  14.                 this.preloaderRight = new Image();
  15.                 this.preloaderRight.src = "./images/right.png";
  16.                 document.preloaderRight = new Image();
  17.                 document.preloaderRight.src = this.preloaderRight;
  18.                 var preloaderTop;
  19.                 this.preloaderTop = new Image();
  20.                 this.preloaderTop.src = "./images/top.png";
  21.                 document.preloaderTop = new Image();
  22.                 document.preloaderTop.src = this.preloaderTop;
  23.                 var preloaderBottom;
  24.                 this.preloaderBottom = new Image();
  25.                 this.preloaderBottom.src = "./images/bottom.png";
  26.                 document.preloaderBottom = new Image();
  27.                 document.preloaderBottom.src = this.preloaderBottom;
  28.                 var preloaderLoaded;
  29.                 this.preloaderLoaded = new Image();
  30.                 this.preloaderLoaded.src = "./images/loaded.png";
  31.                 document.preloaderLoaded = new Image();
  32.                 document.preloaderLoaded.src = this.preloaderLoaded;
  33.                 var preloaderUnLoaded;
  34.                 this.preloaderUnLoaded = new Image();
  35.                 this.preloaderUnLoaded.src = "./images/unloaded.png";
  36.                 document.preloaderUnLoaded = new Image();
  37.                 document.preloaderUnLoaded.src = this.preloaderUnLoaded;
  38.                 imagePreloader(false, this.id, false, false);
  39.             }
  40.         else
  41.             {
  42.                 if(document.preloaderProgressBar.readyState
  43.                 && document.preloaderLeft.readyState
  44.                 && document.preloaderRight.readyState
  45.                 && document.preloaderTop.readyState
  46.                 && document.preloaderBottom.readyState
  47.                 && document.preloaderLoaded.readyState
  48.                 && document.preloaderUnLoaded.readyState)
  49.                     {
  50.                         imagePreloader(true, this.id, false, false);
  51.                     }
  52.                 else
  53.                     {
  54.                         setTimeout("imagePreloader(false, "+this.id+", false, false);", 25);
  55.                     }
If you notice where it says readyState, I tried that instead of complete, but the thing is...

<body onload="initialize();"> calls the initialize function.
The initialize function calls the imagePreloader function:
imagePreloader(false, window.currentImageId, false, true);
The last true at the end makes this.preloaderLoading = true.
Which then sends it into that first part...
Then it calls itself again:
imagePreloader(false, this.id, false, false);
And since all conditions are false in the "if" statement, it goes to the last else.
The last else has an "if" statement in itself.
The if statement checks if all of the images preloaded it the else if statement in the first part of this code on this post... but the problem is... it gets stuck there, if someone could rework this code so that the:
Expand|Select|Wrap|Line Numbers
  1.                 if(document.preloaderProgressBar.readyState
  2.                 && document.preloaderLeft.readyState
  3.                 && document.preloaderRight.readyState
  4.                 && document.preloaderTop.readyState
  5.                 && document.preloaderBottom.readyState
  6.                 && document.preloaderLoaded.readyState
  7.                 && document.preloaderUnLoaded.readyState)
returns true... that would be one more step towards finishing this...
...because that's -where- it's stopping, not in the first part of imagePreloaded if statement, because that is skipped entirely.

BTW I added line numbers to the right of the code viewer on my site... if that helps some...
Jul 2 '07 #3
acoder
16,027 Expert Mod 8TB
Instead of using readyState, use the non-standard complete property.
Jul 12 '07 #5
.readyState and .complete aren't working atm.
=/
Jul 27 '07 #6
Figured out the issue to this like a year later!

I should be assigning the images I have an event (like I did in my ShinyLink program I just posted an issue I was having with about).

Expand|Select|Wrap|Line Numbers
  1. var image = new Image ();
  2. image.src = './image.jpg';
  3. image.onload = function ()
  4. {
  5. // What to do.
  6. }
I got a test script using this new knowledge at this location:
http://help.moltx.name/sites/darkvir...deshow_v2.php5
Aug 5 '08 #7
acoder
16,027 Expert Mod 8TB
Not sure why I didn't suggest that a year ago. Anyway, glad you've finally got it working and thanks for posting.
Aug 5 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
3
by: ABC | last post by:
Which property or function can return the Page's URL in C#?
1
by: Daniel | last post by:
is there any limit to how long of a string SqlDataReader.GetString() can return?
16
by: saurabhnsit2001 | last post by:
The following program doesn't "seem" to print "hello-out". (Try executing it) #include <stdio.h> #include <unistd.h> int main() { while(1) { fprintf(stdout,"hello-out");
15
by: Sunburned Surveyor | last post by:
I'm a Java developer in the process of writing a class library in C#, so please bear with me. I'm trying to write a method that can return a generic Object OR a Decimal value. In Java I would...
2
by: thomas | last post by:
#include<iostream> #include<vector> #include<map> #include<set> #include<iterator> #include<string> #include<algorithm> using namespace std;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.