Be Aware : FLASH Is Not Multithreading

Be Aware!!!, There is a very big limitation in Flash and that is because it is not multithreading. Even when you have independent Timelines, no matter which one, if you stop by code any one of them in a Layer, or Depht or Level, the whole Flash Movie will stop.
For example if you code in a script a loop like for i = 0 to 1 < 2000000 i++, you will see your Flash Movie die for some seconds.
Of course it is incredible that macromedia does not advert anyone of such a limitation, and be sure that the first MSFlash will killl Flash just because multithreading is a must in multimedia.
For those who not know about multithreading, lets give and exmaple.
First you have a roating wheel movie in the library.
Then you add to the stage the wheel from first frame, and make it exist all along up to frame 200, for all that time the wheel will rotate in its own timeline, taht is, if you at frame 100 in the main time line place a stop(), ok, the movie will stop, but the will reamins rotating doesn´t it? yes.
But if in that frame you put a heavy AS code like the “for” loop countig up to 2000000, your wheel will be dead and every thing else in your Flash, and it should not if flash were multithreading, that is, playing the movie wheel timeline in its own thread. It woul be ok if the current Timeline stops takeing out of sync your movie, but not the other timelines,
So please, never mention again independent timelines, becasue they are not, at most call them multitasking timelines.

Excuse my english, but I really need comments on this.
Thanks
Oscar
dlogica@lodemas.com

lol your having a laugh right?
the reason your whole movie dies isbecause youve tied your processor up. your processor simply cant deal with your code and anything else in the movie. its like you are trying to find the 400th square of the nth term where its starting value is 2 (ie. first square would be 4, second square would be 16, third square would be 256 etc etc) you cant do that in your head AND explain astrophysics to someone, whilst drawing a cartoon of Popeye…
why on earth are you complaining??? :h:

Prophet.

:sigh:

NO!!! never say that … May be I did not explained the right way. But if the processor were saturated, you could not hear at the same time the music, neither use your messenger, or do a trace in your Photoshop drawing, doesn´t it?, Why you can while your movie is freeze?, because Windows is an multitask, multithread OS.
WAIT!!! and that is not the worst thing, if you compile you movie, test, and you will see, if you open other flash movies (swfs), you will see that all of them will stop too. Why?, because FlashRuntime does not do neither multithread even for independent swfs playing on your screen.
Anyway, Thanks
Oscar

  1. no one claimed Flash to multithread. That behavior is NECESSARY for Flash to function as it should

  2. Multiple swfs running at the same time will run independantly of each other. Often, with Macs, however, swfs will pause or slow down if not focused to help with speed issues.

Senocular, with all my respects for you. It is strange to me your answer. Did you tested what your’e saying?, So please, do the test, and see you alternate, independent, as you say, swf files freeze.

Second. I never said somebody claimed Flash is multithread, I did say, Be Aware, Flash should be clear when they talk about Independent TimeLines when they are not, even in independent swfs playing in your screen. To me, anybody would understand independent timelines, in the way as we see them apparently work, when in fact they are not.

In fact, Flash does not plays AS in a sequential manner at all, many actions in a script are queued and executed till the end of the script, no matter what you do, they will be executed only till the end of the script (most of them if not all). Sounds strange I know, but that is how Flash works.
If in the middle of a script, you tell Flash to attach a movie, or go to another frame, or load a movie, etc. it won’t do it till the end of the script. Be clear, won´t doit neither when it jumps to another frame (neither, before, in between, or after), and you can probe that in a script stopped (stop()) which will never jump to next frame. Eith! wait, but can say, every body like me, are dummies who program most of the script onEnterFrame events, mmm. That´s true, the event is inside the Flash timer for jumping frames (at the pace you selected fps), no matter if there is a frame or not to jump to in the whole movie because they are maybe there, but stopped.
Explained in an abstract way, in Flash, you are not programing to tell Flash what to do, in the other side, Flash is not asking you what to do, so that why programmers use onEnterFrame, to tell Flash, Eith, don’t ignore me, here I am, run this code, and because that may not be what we need, simply because onEnterFrame its gonna happen according to the fps we selected, which for the computer speed it is an eternity, Flash gave you the chance to ask for code execution in a more direct a a faster fequence mode, named setInterval you want me to pay attention to your code and execute it, And because Flash does not refresh the Status of all objects in the Stage untill it jumps to another frame, then gave a chance to do it at your petition with updateAfterEvent, but neither of these options, changes the fact that your many of your petitions (in script code) will be executed till the end of such script.

Thanks anyway for comments
Oscar

ok then, you write a multithreaded version of flash and give it to the world on a plate.

then see what the programmers and designers think of it, see whether they choose the “silly, useless, slow” Flash MX or the “amazing, incredible, very little logic, run everything at once whether you tell it to or not, that melts your processor because it hijacks its entire capacity rather than a sensible alotted amount, that can execute 2 million lines of code at once (referring to your earlier for loop example)” dlogica MX. :huh:

u dont like it, dont use it.
Flash has its own programming concepts and basics, just like every other programming language. it has its downsides in that its not foolproof :wink: but then you just have to learn how to use it properly and your fine!

Prophet.

Well, I thought you were, if not proffesionals at least mature enough to have respect to other’s people knowledge and points of view. But it is much your ego, and go so far, most of your writtings are copies of others sites, but beyond that you alter my poll writting, and that is enough to know the kind of people you are.
In no way a program will melt any processor, I never named silly, useless, slow to Flash but I do for you, you are doing it, and in the wrong way endorsing those your toughts to me.
The code is a test just to prove the lack of multithreading in Flash, and to explain its behavior in many cases. So please, don’t be stupid, I don ask you to apologize, just correct your mistakes and my poll.

dont suppose youveheard of certain language concepts as sarcasm and exaggeration then?

if “most of your writtings are copies of others sites” then that is entirely coincidental as this is the first such post i have ever come across.

and personally i think its stupid (but hey, maybe thats just me)
so cant you respect my opinion?

and shouldt you rather than simply respecting other peoples knowledge (ill be referring to the great and… bordering holy :wink: senocular here) but also respecting basics of programming languages: every language has to have a basis, this is Flashs. when used properly, it works very well. when abused/used improperly, it does not.

and apologies if this sounds too “immature” or aggressive or owt but i like a good debate and i was trying to coax some real response from you…

btw, for your information, im not professional and im only 17 so there you go :wink:

Prophet.

PS regarding your poll. ill assume it was edited in order to keep polls fair. every forum ive seen has such rules in place: if a poll is not fair, it will be edited to make it so. I didnt vote earlier because i thought it was missing the last option on there (which a fair few big names have voted for as well). it is not necesarily an attack on you, but rather an option to say no, you are wrong and flash is perfectly fine as it is which was not on your original list of polling options. the closest you had was regarding multimedia in general which is unfair as there are several multimedia applications which im sure would not functin correctly without multithreading. BUT this is regarding Flash, not multimedia in general.

okokok
For anyone who’s interested, here’s how Flash works.

Flash has “independant timelines” that play their frames based on a commonly shared frame rate - independant playback. Should one movie clip containing another movie clip stop, the movie clip within will not stop as it plays independantly of the movie clip its within.

All actionscript within Flash runs sequentially based on an order of execution. Since Flash is frame-based, actionscript execution is directly related to frame playback. Each frame a movie clip plays, the actionscript defined for that movie clip execuetes as needed.

Now, should some process in any movie clip in a single frame bog down the cpu, the secquence of actionscripts will be stalled. No further actionscript will be run because it has to wait for the script before it to complete. Since actionscripts are executed on a frame by frame basis, a heavy script will prevent frame progression as that script is part of that frame and must be completed before the frame can move on. And since all movie clips operate under the same frame rate, no one movie clip is allowed to stray from the syncing that frame rate is used to enforce. In other words, if a 2 movies are on the main timeline for the same amount of time, you would expect them to have played (or “witnessed” since playback could be stopped) the same number of frames.

So if one has some heavy script that won’t be executed within a frame’s time, the frame rate will pause in order to let that script complete, thereby maintaing syncronization.

Its just how Flash works. Understand it, accept it, work around it if its not what you want to happen.

I personally don’t need multithreading, but at the same time, maybe some other people do need it. I think that it is existant in some other languages. Going out of sync in flash is not the best solution, but why not let it at least as an option… that’s my modest silly opinion at least! :stuck_out_tongue:

thats what i meant… just better worded :wink: LOL!

Prophet.

PS how did Brandon? vote 3 times? :h: