I created a small animation on a new layer that loops as the preloader is working. Is there a way to have this animation be in sequence with the Preloader bar?
For example… as the percent loaded equals 33%, the animation would jump to specific point… As the Proloader loaded 66% the animation would jump to a second point. etc.
[AS]bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent100;
this.loadText = Math.round(getPercent100)+"%";
if(getPercent100 <= 33){
Actions for if the preloader less or equal than 33
}
if(getPercent100 <= 66){
Actions for if the preloader less or equal than 66
}
if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}[/AS]
By the way, search the forum, I’ve already answered this question before.
This way, you are dealing with code instead of a FMX component. This preloader works within the first two frames of the movie that loops until the movie’s loaded. Beacuse of this, your animation would have to be in another movieClip. Once you make that movieClip, give it the instance name of ‘foo’. Then you can make actions like this (for instance) :
if ((getPercent*100)>33){
_root.foo.gotoAndStop("partNumberOne");
}
if ((getPercent*100>66){
_root.foo.gotoAndStop("partNumberTwo");
}
//...etc...etc...
‘partNumberOne’ and ‘partNumberTwo’ would be either the frame names or numbers in foo that you would want to go to.