flash movie plays itself when you call any, even unnamed, function in the bytesLoaded==bytesTotal if clause
I actually don't need help, i just want to know your opinion about that weird Flash CS4 (AS3) behavior. there should be something i missed. 1) what happens: flash movie plays on any (even non-existent) function call between if(bytesLoaded==bytesTotal), and doesnot play on commented-out or blank line there. 2) what should be seen instead: no action - i dont call any timeline functions so the movie shouldn't be playing. any warning or error? i dont know, flash is so *-nixy all the time in the way it handles errors. 3) where: in the
if(stage.loaderInfo.bytesLoaded==stage.loaderInfo.bytesTotal)
clause on the first frame (AS3)
I think adobe has taken responsibilty on itself to guess that if we use bytesLoaded and bytesTotal, then we want to play movie :|. what if i want to ceil a number and dont want to play it?
i dont use custom document class so i use root.* instead of MovieClip(root).*
---this is the AS3 code on the first frame, and embedded video in the next 1999 frames
stop();
root.addEventListener(Event.ENTER_FRAME,RootOnEnterFrame);
function RootOnEnterFrame (evt:Event) {
if(stage.loaderInfo.bytesLoaded==stage.loaderInfo.bytesTotal){
//anyfunctionname(anynumber);
Math.ceil(1599);
funcdoesnotexists(7);
}
}开发者_运维百科
The problem here is that webservers do not always tell the browser how big the file is. Unfortunately Flash interprets this as bytesTotal
to be 0
. And of course, 0 == 0
is true.
You can either let your swf know the size beforehand or configure the webserver to send this info. The former is the most common way to get around this.
Hey, i think no one has the idea except Adobe/flash people from Macromedia.
Thanks for replying.
精彩评论