GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 2,535

0 members and 2,535 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2006
    Location
    Land of far far away!
    Posts
    560

    Thumbs up

    ok... so i m making this movie, right? i m making the preloader and i am like || this close to making it work :P but i need someone's help because the script isnt working properly. here is the script i put in frame one of layer 1 of the preloader scene :

    Code:
    total_bytes = _root.getBytesTotal();
    loaded_bytes = _root.getBytesLoaded();
    percent_done = int((loaded_bytes/total_bytes)*100);
    bar.gotoAndStop(percent_done);
    if (loaded_bytes == total_bytes) {
    ****gotoAndStop(2);
    } else {
    ****gotoAndPlay(1);
    }
    frame 2 has the play button. so whats happening is that when i start the movie it skips the preloader :/. only loads part of the movie and comes to frame 2, only shows the preloader for like 1 sec. the movie is 28 scenes long (dont ask y), it has hundreds of symbols, like movie clips, graphics, and buttons; its not suppose to take like 1 sec to load the whole movie. if you are good at flash or know how to work a preloader plz tell me thnx. .
    Virulent "Thank You come again!"
    http://virulentviper.deviantart.com/

  2. #2
    Join Date
    Jul 2005
    Location
    Calgary, Canada
    Posts
    2,566

    Default

    Could be in your code.

    Like your if/else statements..

    First of all....
    What does gotoAndStop() do?
    What does gotoAndPlay() do?

    I'll assume that gotoAndPlay() plays the movie :P, and if that is the case, then it will execute without actually loading the bytes since its in the else construct. So thats probably why it will play without finishing loading.

    It's MORPHIN' time!
    github
    deviantART
    Last.FM
    carrotderek

  3. #3
    Join Date
    Feb 2006
    Location
    Land of far far away!
    Posts
    560

    Default

    <div class='quotetop'>QUOTE(Shurai &#064; Apr 22 2006, 08&#58;29 PM) [snapback]166522[/snapback]</div>
    Could be in your code.

    Like your if/else statements..

    First of all....
    What does gotoAndStop() do?
    What does gotoAndPlay() do?

    I&#39;ll assume that gotoAndPlay() plays the movie :P, and if that is the case, then it will execute without actually loading the bytes since its in the else construct. So thats probably why it will play without finishing loading.
    [/b]
    ok.. i will explaing you the whole code.

    this is the whole code:
    Code:
    total_bytes = _root.getBytesTotal&#40;&#41;;
    loaded_bytes = _root.getBytesLoaded&#40;&#41;;
    percent_done = int&#40;&#40;loaded_bytes/total_bytes&#41;*100&#41;;
    bar.gotoAndStop&#40;percent_done&#41;;
    if &#40;loaded_bytes == total_bytes&#41; {
    ****gotoAndStop&#40;2&#41;;
    } else {
    ****gotoAndPlay&#40;1&#41;;
    }
    this:
    Code:
    total_bytes = _root.getBytesTotal&#40;&#41;;
    tells flash to get the total number of bytes of the file

    this:
    Code:
    loaded_bytes = _root.getBytesLoaded&#40;&#41;;
    tells flash to get the number of bytes already loaded

    this:
    Code:
    percent_done = int&#40;&#40;loaded_bytes/total_bytes&#41;*100&#41;;
    tells flash to write 0.100 % in a text box on the stage.

    this:
    Code:
    bar.gotoAndStop&#40;percent_done&#41;;
    tells the load bar to to show frames 1-100 of the loade bar movie clip.

    this:
    Code:
    if &#40;loaded_bytes == total_bytes&#41; {
    ****gotoAndStop&#40;2&#41;;
    }
    tells flash to see if total bytes and the number of bytes loaded is equal or not, and if it is, it tells it to go to and stop at frame 2 of scene 1.

    this:
    Code:
    else {
    ****gotoAndPlay&#40;1&#41;;
    }
    tells flash to go to and play frame 1 of scene one if the total bytes and bytes loaded isnt same.

    so far to me it looks goo dbut if anyone knows better plz tell me how to fix my problem.

    i might know what the problem is but i donno one of the code component (if it esists) to fix it..... does anyone know a script component which is the opposite of "=="? i.e == means "equal" so the other one should mean "does not equal".........
    Virulent "Thank You come again!"
    http://virulentviper.deviantart.com/

  4. #4
    Join Date
    Jul 2005
    Location
    Calgary, Canada
    Posts
    2,566

    Default

    forlfrof all you needed to do was tell me what those two objects do :P The only reason I replied was that actionscript syntax looks similar to other languages I&#39;ve dealt with.

    i might know what the problem is but i donno one of the code component (if it esists) to fix it..... does anyone know a script component which is the opposite of "=="? i.e == means "equal" so the other one should mean "does not equal".........
    [/b]
    &#33;= is not equals in normal coding conventions.

    <div class='quotetop'>QUOTE(Virulent &#064; Apr 22 2006, 07&#58;57 PM) [snapback]166528[/snapback]</div>
    this:
    Code:
    percent_done = int&#40;&#40;loaded_bytes/total_bytes&#41;*100&#41;;
    tells flash to write 0.100 % in a text box on the stage.
    [/b]
    The fact that the &#39;int&#39; is there specifies that there isn&#39;t a decimal point.
    12.3 loaded bytes/100 total bytes = 0.123*100 = 12.3% = int(12.3) = 12

    I think I figured it out...
    There is definitely a problem with this part:

    Code:
    bar.gotoAndStop&#40;percent_done&#41;;** //go to current percentage, innocent enough..
    
    if &#40;loaded_bytes == total_bytes&#41; {****//will never get taken since the current never reaches total
    ****gotoAndStop&#40;2&#41;;
    
    } else {************************** //will always be taken
    ****gotoAndPlay&#40;1&#41;;********//jump back to first frame?&#33;?&#33;??&#33; This is a very disgusting way of &#34;looping?&#34; and doesn&#39;t work.
    }
    Can you even do loops in Flash since there are frames?? I dunno. Making 100 frames is a waste of time. You can scale the progress bar size you know.

    Try this bit:
    Code:
    if&#40;percent_done &#33;= total_percent&#41;{**************** //total_percent = 100;
    ********setProperty&#40;bar,**_xscale**, percent_done&#41; 
    }
    
    else{
    ********goAndStop&#40;2&#41;;
    Give it a shot. You&#39;ll have to play around with it muah.
    It's MORPHIN' time!
    github
    deviantART
    Last.FM
    carrotderek

  5. #5
    Join Date
    Feb 2006
    Location
    Land of far far away!
    Posts
    560

    Default

    //jump back to first frame?&#33;?&#33;??&#33; This is a very disgusting way of "looping?" and doesn&#39;t work.[/b]
    lol i found this this code in all tuts i saw :P.

    yea i know i can scale it but i wanted it to be more smoother :P.

    btw i dont get this:

    "total_percent"....... whats that for? is it same as total_bytes? btw percent_done is the instance name of the dynamis text inwhich the percent is shown also the var of the text :P.

    i donno.. i will try it later lol. i m too lazy to do i right now. thnx for ur hep tho .
    Virulent "Thank You come again!"
    http://virulentviper.deviantart.com/

  6. #6
    Join Date
    Jul 2005
    Location
    Calgary, Canada
    Posts
    2,566

    Default

    Yup, total_percent is just a constant I made up.

    You&#39;ll probably need it if you choose to do scaling. Its just 100 XD
    It's MORPHIN' time!
    github
    deviantART
    Last.FM
    carrotderek

  7. #7
    Join Date
    Feb 2006
    Location
    Land of far far away!
    Posts
    560

    Default

    <div class='quotetop'>QUOTE(Shurai &#064; Apr 23 2006, 12&#58;00 AM) [snapback]166536[/snapback]</div>
    Yup, total_percent is just a constant I made up.

    You&#39;ll probably need it if you choose to do scaling. Its just 100 XD
    [/b]
    right so is this needed in the code?

    Code:
    //total_percent = 100;

    lol i am a lil confused... cant you post the whole code i should put? i donno what to remove from my code and where to add what u gave me. thnx .
    Virulent "Thank You come again!"
    http://virulentviper.deviantart.com/

  8. #8
    Join Date
    Feb 2006
    Location
    Land of far far away!
    Posts
    560

    Default

    <div class='quotetop'>QUOTE(Shurai &#064; Apr 22 2006, 11&#58;36 PM) [snapback]166533[/snapback]</div>
    forlfrof all you needed to do was tell me what those two objects do :P The only reason I replied was that actionscript syntax looks similar to other languages I&#39;ve dealt with.
    &#33;= is not equals in normal coding conventions.
    The fact that the &#39;int&#39; is there specifies that there isn&#39;t a decimal point.
    12.3 loaded bytes/100 total bytes = 0.123*100 = 12.3% = int(12.3) = 12

    I think I figured it out...
    There is definitely a problem with this part:

    Code:
    bar.gotoAndStop&#40;percent_done&#41;;** //go to current percentage, innocent enough..
    
    if &#40;loaded_bytes == total_bytes&#41; {****//will never get taken since the current never reaches total
    ****gotoAndStop&#40;2&#41;;
    
    } else {************************** //will always be taken
    ****gotoAndPlay&#40;1&#41;;********//jump back to first frame?&#33;?&#33;??&#33; This is a very disgusting way of &#34;looping?&#34; and doesn&#39;t work.
    }
    Can you even do loops in Flash since there are frames?? I dunno. Making 100 frames is a waste of time. You can scale the progress bar size you know.

    Try this bit:
    Code:
    if&#40;percent_done &#33;= total_percent&#41;{**************** //total_percent = 100;
    ********setProperty&#40;bar,**_xscale**, percent_done&#41; 
    }
    
    else{
    ********goAndStop&#40;2&#41;;
    Give it a shot. You&#39;ll have to play around with it muah.
    [/b]
    it didnt work....... it was weired.. the load bar disappeared lol.
    Virulent "Thank You come again!"
    http://virulentviper.deviantart.com/

  9. #9
    Join Date
    Jul 2005
    Location
    Calgary, Canada
    Posts
    2,566

    Default

    Code:
    total_bytes = _root.getBytesTotal&#40;&#41;;
    loaded_bytes = _root.getBytesLoaded&#40;&#41;;
    percent_done = int&#40;&#40;loaded_bytes/total_bytes&#41;*100&#41;;
    if&#40;percent_done &#33;= 100&#41;{****
    ********setProperty&#40;bar,**_xscale**, percent_done&#41;
    }
    
    else{
    ********goAndStop&#40;2&#41;;
    Try that *//total_percent = 100* was just a comment.
    It's MORPHIN' time!
    github
    deviantART
    Last.FM
    carrotderek

Similar Threads

  1. Flash MX
    By -_- in forum Support
    Replies: 4
    Last Post: 06-26-2005, 02:21 PM
  2. Any game experts please
    By streetsoulja in forum The Void
    Replies: 17
    Last Post: 04-19-2005, 04:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1