This was posted in the scripting and backend forum... but I think it would benifit more people here. I've picked out a few interesting paragraphs below, but take some time to read the whole article, its very interesting.
the old "obsolete" flash 4 syntax still performs faster than nice dot scripts
Why is flash 5-style coding slower than old flash 4 actions? Casper Shuirink found out the funny practice of flash player 5: new classes and methods are created internally using actionscript! Including string algorithms, array and movieclip methods - everything. Most of them are wrapped around flash 4 actions. Look into Caspers's findings. And again: it's not a visual representation, it's actual script used internally in flash 5.
The worst example: myMC.gotoAndStop(), which is 25 times slower than tellTarget("myMC") gotoAndStop().
Use tellTarget instead of with where possible.
Avoid multiple parallel hitTest() functions in events - often seen in games. If the player is killed after any touch with an enemy, and you have 100 duplicated enemy clips, don't include any code in the enemy clip enterFrame event. Create the new mc and insert the enemy clip here. Then duplicate inside of this parent clip. Now you can check with only one hitTest() if the collision takes place. If you need to, use some custom math then to calculate what enemy was hit. Since most of the time no collision occurs, you'll make a really big improvement in fps.
Originally posted by random10122 It does seem odd that macromedia would knowingly make their code slower in a newer version - especially as it is so bad already!!!
Yup... I think its lazy coding... I don't want to get on macromedia's back here, I know it must be hard to rewrite the whole flash browser plugin, then again for different os's and again for different browsers, but most of the problems in the swf plugin are poor, or badly implemented, code related.
Its also a speed issue, Macromedia launching a new version of flash every year or two must put some strain on their programmers, swfs must be back compatible as well, so I guess its just easier to slap more code on top of the old code.
I'd rather not use telltarget either... but if it helps speed up my flash movies then I guess thats what I'll have to do!
Limehouse, Ontario - Never heard of it? Not surprised.
I kind of see it like this.
Macromedia ways the pros and cons of writing all actionscript functions in C, and then decide. Since Flash is used to build games by a small part of the community, and in that community even fewer build games requiring fast calculations, its just not worth it.
Director on the other hand is.
The future belongs to those who prepare for it today.
Flash 6 player has changed alot of the way it handles things...
Alot of the classes have been rewritten in c++ instead of actionscript, and all the old function has been deprecated, as far as I have heard, in regards to the . syntax vs flash4 syntax, Flash 6 player has eliminated the slowness that Flash 5 has.
In regards to Actionscript vs. other languages, it is alot slower, that is for sure.
Apart from what alot of people think. Macromedia arent the bastards that you think they are...
Director and Flash are two completely differnet platforms. Flash is more web-based, director (even thought having a web-based plugin) is aimed at standalone applications.
Macromedia arent slowing flash down to improve sales for director, it would be obsurd to do such a thing.
If Macromedia doesnt want Flash to be near Director, they would not have implemented actionScript to how it is today, infact they wouldnt have improved it over Flash 3... The proof is in the fact that Macromedia continue to improve Flash actionScript through each version.
And finally, while i'm here... I'd like to point out that tellTarget is a piece of junk, heralding from the days in Flash3, when you wanted to control another movieClips play-head (play, stop, gotoandplay/stop) thats all telltarget used to do, I'm sure macromedia would have killed it in flash4 were in not that they didnt have another way of doing things... Sure I dont agree that they should have made the dot syntax of flash5 telltarget in disguise, but none the less, Flash 6 player is great, and is alot more speedy in comparison.
Originally posted by mosterdfles_flash
But I just dont understand WHY telltargets are faster then the dot thing, I just think it's either the flashPLAYER or just flash whos making it slow (so i thin it's just some small error )
I thought its because the flash4 player was written from the ground up... and then the flash5 java syntax was bolted on top of that... then not wanting a full rewrite (lazy) they just assigned the _root.blah to the already functioning telltarget
But who knows?!
Does anyone know 100% for sure if these bugs are fixed in FlashPlayer6? Is there somewhere on macromedia.com we can look, or someone to pester with emails?