Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pre-loader help

Status
Not open for further replies.

atray04

Programmer
Dec 29, 2003
112
US
I am working on a menu system for my website and I am having trouble going from the loader to the menu. When I run the loader it crashes in flash. And when I run the debugger it appears to work, but runs the whole loader even if the movie has been downloaded. Instead of going to the menu as soon as it has downloaded. Heres my code. thanxs for the help

-ATray

//create loop that goes through frames until file has been //downloaded
stop();
var complete:Boolean = false;
i=1; //frame 1
totalFileSize = _root.getBytesTotal();
while(!complete) {
trace(complete);
trace(i);

// see how much has been loaded so far
bytesLoaded = _root.getBytesLoaded();

// convert to a value from 0 to 1
amountLoaded = bytesLoaded/totalFileSize;

// convert to a value from 0 to 100
percentLoaded = int(100*amountLoaded);

if (i==39)
i = 1;
i = i + 1;
if (amountLoaded >= 1.0) {
trace("finished");
percent.text = percentLoaded + "%";
complete = true;
}
percent.text = percentLoaded + "%";
trace(i);
gotoAndPlay(i);
}
gotoAndPlay("Light", 1);
 
Could be that you are missing a {

Code:
stop();
var complete:Boolean = false;
i=1; //frame 1
totalFileSize = _root.getBytesTotal();
while(!complete) {
   trace(complete);
   trace(i);
   // see how much has been loaded so far
   bytesLoaded = _root.getBytesLoaded();
   // convert to a value from 0 to 1
   amountLoaded = bytesLoaded/totalFileSize;
   // convert to a value from 0 to 100
   percentLoaded = int(100*amountLoaded);
   if (i==39) [b][COLOR=red]{[/color][/b]
       i = 1;
       [b][COLOR=red]i++;[/color][/b]
       if (amountLoaded >= 1.0) {
          trace("finished");
          percent.text = percentLoaded + "%";
          complete = true;
        }
        percent.text = percentLoaded + "%";
        trace(i);
        gotoAndPlay(i);
    }
    gotoAndPlay("Light", 1);


[conehead]
 
no, I do not need a bracket there. Since the if statement is just one line there is no need for brackets.
 
Afraid you are wrong there. Correct formatting of an if statement includes a bracket.

Code:
if(condition){
   //do something
}

If it was a one line statement it should be
Code:
if(condition){//do something}

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top