views:

31

answers:

2

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);                   

    }
}
+1  A: 

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.

bitc
bitc,thank you for your reply.in fact, the SWF played was in the Flash IDE, and the funny part is that it thinks that even Math.ceil() is a play() function, not more not less. I think Macromedia-and-then-Adobe accompanies ActionScript with overwhelmed forgiveness - thinking something like 'of course, if the programmer checks for bytesLoaded, then he obviously wants to play a movie'. I can't think of any more probable answer.
Luka Ramishvili
A: 

Hey, i think no one has the idea except Adobe/flash people from Macromedia.

Thanks for replying.

Luka Ramishvili