YAY! A New Problem With My Code :)

  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

Okay I have on my first frame of my time line a preloader movieclip I made so it gets that and runs the the code displays my preloader that works find (I think).

Inside the preloader movie clip is my preloader code that looks like this

preloader movieclip frame 1 code:
Code: [ Select ]
percent = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal() * 100);
loadbar_mc.gotoAndStop( percent );
  1. percent = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal() * 100);
  2. loadbar_mc.gotoAndStop( percent );


Note: I have a frame label at frame 1 called loop to send the time line back to frame 1 if not at 100%.

Frame 3 preloader movieclip time line code:
Code: [ Select ]
if (percent == 100){
    _parent.gotoAndPlay("load_interface");
} else {
    gotoAndPlay("loop");
    
}
  1. if (percent == 100){
  2.     _parent.gotoAndPlay("load_interface");
  3. } else {
  4.     gotoAndPlay("loop");
  5.     
  6. }


As you can see it checks to see if my percent var is at 100% if not it goes back to loop and keeps the animation going.(the loadbar animation and the numbers counting). percent is the var name for the dynamic text box to display the numbers counting up.

if percent does equal 100% it goes back up to the frame label load interface, which is located at frame 2 on main timeline, and this point shows the header footer and the menu slide in then after those motion tweens are complete goes on to the first page of on the time line and stops.

Now what is happening is after its loaded and goes to the load_interface label it seems to be stuck in a loop as it moves through the motion tween. So its playing the first few frames of the motion tween then kicking back to the first frame of the motion tween.

What makes this more strange if i change the code:
Code: [ Select ]
if (percent == 100){
    _parent.gotoAndPlay("load_interface");
} else {
    gotoAndPlay("loop");
    
}
  1. if (percent == 100){
  2.     _parent.gotoAndPlay("load_interface");
  3. } else {
  4.     gotoAndPlay("loop");
  5.     
  6. }

to
(changed percent==80 or really anything less then 100)
Code: [ Select ]
if (percent == 80){
    _parent.gotoAndPlay("load_interface");
} else {
    gotoAndPlay("loop");
    
}
  1. if (percent == 80){
  2.     _parent.gotoAndPlay("load_interface");
  3. } else {
  4.     gotoAndPlay("loop");
  5.     
  6. }

this seems to make it work fine. Any explination why that is or what I can do to fix when I keep it at percent == 100. I really have no code on the main time other then stop actions after it plays through loading the first page content. So I cant figure out why I'm getting that weird looping effect. So any info on why this is happening and what I can do to fix it would be very helpful in my learning.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 20 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.