|
-
Peace - Just in Heaven
Preloader : Flash 7 on AS 2
I got a Preloader with the following action on it -
It used to work fine with Flash 6 on AS1.
Now when i try to publish it in Flash 7 on AS 2.
It does not work. Any idea how to get it working guys ?
Thanks in advance !
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = Math.round(percent);
PP = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndPlay(2);
}
}
An eye for an eye makes the whole world blind
- The Mahatma.
-
Peace - Just in Heaven
Im still using Flash Mx2004. Please can anybody tell me a way to get around this problem
An eye for an eye makes the whole world blind
- The Mahatma.
-
Flashmatics
try
stop();
this.onEnterFrame = function()
{
bytesLoaded = _root.getBytesLoaded();
bytesTotal = _root.getBytesTotal();
percent = Math.round((bytesLoaded/bytesTotal)*100);
per = percent+"%";
loadBar._width = percent;
if (percent>=100)
{
delete this.onEnterFrame;
gotoAndPlay(2);
}
};
-
Peace - Just in Heaven
Thanks for Replying !
Let me check if this works !
An eye for an eye makes the whole world blind
- The Mahatma.
-
Peace - Just in Heaven
Well Im still not able to get this to work ! Any ideas guys ?
An eye for an eye makes the whole world blind
- The Mahatma.
-
Banned
Remove the code that you had before and write this code on the first frame of your main timeline:
PHP Code:
_root.onEnterFrame=function(){
var loaded=Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100)
PP.text = loaded+"%";// this line will work if 'PP' textbox is in your main timeline...
//...if you have PP texbox inside a movieclip then write...
//mc_instanceName.PP.text=loaded+"%"
loadBar._width = loaded;// Again, this line will work if loadBar movieclip is in your main timeline...
//... if you have it inside a movieclip then write...
//mc_instanceName.loadBar._width = loaded
if (loaded==100) {
delete this.onEnterFrame;
}}
Note that, PP has to be the textbox 'instance name' and not a 'var' name
-
Peace - Just in Heaven
I pasted this code -
=============================
stop();
_root.onEnterFrame=function(){
var loaded=Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100)
trace(_root.getBytesLoaded());
trace(_root.getBytesTotal());
trace(loaded);
PreLoader.PP.text = loaded+"%";
PreLoader.loadBar._width = loaded;
if (loaded>99) {
delete this.onEnterFrame;
//gotoAndPlay(2);
}}
==============================
Looking at the Traces -
I can see -
130871
130871
25
130871
130871
25
130871
130871
25
130871
130871
25
-------------------------------
So the Bytes Loaded and Bytes Total is the same and hence the code is not working ! Anyway to get over this ?
An eye for an eye makes the whole world blind
- The Mahatma.
-
Banned
make the condition...
Code:
if(_root.getBytesLoaded()==_root.getBytesTotal()){
gotoAndPlay(2);
trace("complete")
delete this.onEnterFrame;
}
-
Peace - Just in Heaven
No I dont think the Preloader is working.
Its not updating properly.
Do you have any Preloader ?
An eye for an eye makes the whole world blind
- The Mahatma.
-
Banned
Thats really strange. I cant believe that your swf failed to get into that 'IF condition'. Impossible
Did you upload and check??
I think it has to be some other kind of silly error which you might have forgotten to notice.
-
Banned
...And btw, is this your 'main' swf or 'child' swf?
This preloading code will not work on a child swf
-
Peace - Just in Heaven
stop();
onEnterFrame=function(){
var a = _root.getBytesLoaded();
var b = _root.getBytesTotal();
trace(a);
trace(b);
var load = (a/b);
//trace(_root.getBytesLoaded());
//trace(_root.getBytesTotal());
trace(load);
loaded = Math.round(load*100);
PreLoader.PP.text = loaded+"%";
PreLoader.loadBar._width = loaded;
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
gotoAndPlay(2);
trace("complete");
delete this.onEnterFrame;
}
}
Althoug this works - i think its wrong.
Coz the trace shows
trace(_root.getBytesLoaded());853779
trace(_root.getBytesTotal()); 853779
at the first instance itself
Separately if i do - it shows
(_root.getBytesLoaded()); 130233
(_root.getBytesTotal()); 853881
An eye for an eye makes the whole world blind
- The Mahatma.
-
Banned
Upload and test your preloader. I cant find anything wrong with the preloader code given to you.
Btw, this preloading code will not work if you are using it on a child swf. So, is this a 'main' swf or 'child' swf?
Last edited by deepakflash; 01-14-2009 at 12:03 PM.
-
Peace - Just in Heaven
This is Main swf - so that is not a problem really. Will upload and check it. Thanks a lot for your time and help ! Have fun
An eye for an eye makes the whole world blind
- The Mahatma.
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
|