-
The preloader question, but I need help please (MX 2004)
I haven't used flash since Flash 5 and I just got MX 2004. I'm trying to make a preloader that loads external jpegs into a empty container with a action scripted percentage bar. I'm trying to make the preloader as simple as possible. Here is what I have so far but something is wrong I just can't see the problem.
--------------------------------------------------------------------------------------
• Code on _root
baseSize = container.getBytesTotal();
--------------------------------------------------------------------------------------
• Code on empty container
onClipEvent (load) {
loading = true;
}
onClipEvent (enterFrame) {
if (loading) {
if (this.getBytesTotal()>_root.baseSize) {
percent = this.getBytesLoaded()/this.getBytesTotal()*100;
trace (percent);
_root.loadingBar.bar._xscale = percent;
if (percent == 100) {
loading = false;
_root.loadingBar._visible = false;
}
}
}
}
--------------------------------------------------------------------------------------
•_code on loadingBar
onClipEvent (load) {
_visible=fasle;
}
--------------------------------------------------------------------------------------
• code on bar
onClipEvent (load) {
this._xscale = 0;
}
--------------------------------------------------------------------------------------
• code on the button
on (press) {
_root.container.loadMovie("external_image.jpg");
_root.loadingBar.bar._xscale = 0;
_root.loadingBar._visible = true;
--------------------------------------------------------------------------------------
-
GParis answered you on that one!
Think you'll get a better anser on this forum?
-
I understand and know gparis see's the problem and he did answer me but I need a little more direction to help me through this.
After reading what gparis wrote it seems I need to figure out how to script
if (this.getBytesTotal()>THE TOTAL BYTES IN THE CONTAINER)
but right now the script is
if (this.getBytesTotal()>_root.baseSize)
basically saying the same this
if (this.getBytesTotal()>this.getBytesTotal)
I'm just looking for someone to push me a little harder in the right direction.
Thanks,
M
-
GParis is a she!
Why so many ifs?
-
This alone works fine for me...
Code:
onClipEvent (load) {
// loading = true;
}
onClipEvent (enterFrame) {
//if (loading) {
//if (this.getBytesTotal()>_root.baseSize) {
percent = this.getBytesLoaded()/this.getBytesTotal()*100;
trace (percent);
_root.loadingBar.bar._xscale = percent;
if (percent == 100) {
//loading = false;
_root.loadingBar._visible = false;
//}
//}
}
}
-
Really Gparis is a SHE — ooops... I never knew girls could be so talented. I've been enlightened. I don't have flash on this computer but I'll try omitting the code you // out.
Thanks,
M
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|