A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 59 of 59

Thread: why use as3?

  1. #41
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    Quote Originally Posted by tomsamson
    No, calling stop on a MovieClip just makes the playhead of the mc stop.
    I'm curious if you know what references remain at that point? Thanks

  2. #42
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    (roll eyes)
    Ok, i will try to explain.
    that:
    http://board.flashkit.com/board/showthread.php?t=750382

    and in the previous tomsamsom post, that:
    people who moan aboutthe new garbage collector workflow are often not happy because there´s no command like just say delete someObject or someObject = null or for Mcs removeMovieClip or unloadMovie with the functionality they had in previous flash player versions
    (delete still exists but only works for things created as dynamic in first place and nulling an object only works the way you wanted if it doesn´t have active strong bindings/references/eventListeners in the moment you null it, commands like removeMovieClip and unloadMovie don´t exist anymore).
    This forces the developer to watch out more for references/eventListeners and generally have a closer look at ram usage to go sure he uses the ressources well under the new circumstances. Due to that and also the garbage collector generally kicking in for sweeps less often it is strongly suggested to reuse objects instead of constantly creating new ones, using weak listeners etc.
    are all about the same thing.How the GC now behaves way different from the old one

    If you handle it
    the same way I handle memory management in RIA development.
    For games thats not good enough because them, as i said before, in a game that will have lots of new items created and deleted dynamically it will likelly to lag because even after you null all of the references the GC will not behave like it used to be in the old way and will not delete the bullets, enemies, etc, and even if you make them all inert as possible they will still be there eating memory

  3. #43
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Also,if you see the link to the grant skinner blog from that topic
    http://board.flashkit.com/board/showthread.php?t=750382

    He makes things very clear
    As a developer, you must accept that fact that you will have no way of knowing when (or even if) your inactive objects will get deallocated
    http://www.gskinner.com/blog/archive...source_ma.html

  4. #44
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    well, i have to say i've learned a lot today about garbage collection and MovieClips... which is something I'm not familiar with in AS3- so thank you, tomsamson.

    @Cimmerian ->
    srsly, dood- lulz

  5. #45
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Ok,sorry for being a little rude, dood luz for you too, whatever it is

  6. #46
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    luz?

  7. #47
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    to newblack: again, calling stop(); command on a movieclip is just a playhead control command, it is not intended for affecting references or code that the movieclip executes (or if it reacts on events etc).

    Just as very basic example for how the garbage collector and display stuff handling works different now, to what kind of enexpected results this can lead and how that can be an issue not just for visual creation manner oriented people (but especially for them) i have made this here:

    http://www.stimunationgames.com/exam...ClipsPart1.zip

    (You need Flash CS3 IDE to open it).

    So what is there is just a MovieClip called parentClip and inside that another MovieCLip with instanceName childClip.

    (and a button for demonstrationg what i´m talking about, but to that in a bit)

    Ok, so inside parentClip we just add this code
    code:

    function testOnEnterFrame(e):void{
    trace("test");
    }
    childClip.addEventListener(Event.ENTER_FRAME, testOnEnterFrame);



    adding an event listener for the child clip on frame actions inside the parent, see, very visual creation manner oriented example
    Ok, so thanks to that code the child clip should react on the enterFrame event and trace "test" each frame refresh.
    When testing the movie it does that of course.

    So inside the timeline of parentClip you can see that in the first frame there´s childClip and in the second frame there´s a blank keyframe.

    From our experience since flash 3 days we know that in such a case childClip should be totally gone when the playhead of parentClip reaches frame 2.

    So now on the main timeline we have a button, on press that will change the playhead of parentClip to frame 2.
    Export the movie and press the button.
    See what is going on? The childClip seems to be gone (its at least not visible anymore) but it still constantly traces "test". So obviously it does still exist (in memory).
    Last edited by tomsamson; 12-05-2007 at 06:25 PM.

  8. #48
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    Nice one!!! Give us a blog! I wont stop saying it til you do...

  9. #49
    n00b LeechmasterB's Avatar
    Join Date
    May 2004
    Location
    Switzerland
    Posts
    1,067
    Quote Originally Posted by tomsamson
    code:

    function testOnEnterFrame(e):void{
    trace("test");
    }
    childClip.addEventListener(Event.ENTER_FRAME, testOnEnterFrame);


    So now on the main timeline we have a button, on press that will change the playhead of parentClip to frame 2.
    Export the movie and press the button.
    See what is going on? The childClip seems to be gone (its at least not visible anymore) but it still constantly traces "test". So obviously it does still exist (in memory).
    As far as i remember it was mentioned in the help documents that you have to remove listeners on objects before setting the reference to null and that they will also fire events when not in the current frame. So basically that is just normal and expected behaviour going by the docs. So you should clean up and clear the listener before or after changing the frame ?
    I do stuff that does stuff...

    J-Force

  10. #50
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    mate, i didn´t post this sample because i wondered why this happens.
    I know why this happens and how to avoid it.
    I posted this example to show how as3/vm2 handles some things in different way than any flash version before and that this may lead to unexpected results for lots of people (next to more planning/creation worktime to avoid these undesired results).

  11. #51
    n00b LeechmasterB's Avatar
    Join Date
    May 2004
    Location
    Switzerland
    Posts
    1,067
    Quote Originally Posted by tomsamson
    mate, i didn´t post this sample because i wondered why this happens.
    I know why this happens and how to avoid it.
    I posted this example to show how as3/vm2 handles some things in different way than any flash version before and that this may lead to unexpected results for lots of people (next to more planning/creation worktime to avoid these undesired results).
    Sorry for the missunderstanding, i did not mean to diss you or sound like a smart ass. Sometimes i am short in time and overfly the posts without closely reading all...

    Edit: And hell i just love as 3.0! Its so clean and fast and just makes sense . Its just a pleasure coding with it and a lot of things can be done much nicer. Except for the rough start i had i would never want to code as 2.0 again if not absolutely necessary. I never liked the idea of having stuff (sounds mclips ect.) in the library, i prefer importing the content and only having the actual code in the flash, which also makes changing and modifying things easier.
    Basically once you got your custom lib ready for as 3.0 the workflow in general will be a lot faster. Like having a basic ui library for panels buttons widgets ect. can be so useful.

    And i have to say there are not many tutorials out there but i found 3 awesome books to help polish the coding style and getting aquainted with as 3.0. May be some of the non pro's might find them handy when making the step from as 2.0 or another OOP language.

    - ActionScript 3.0 Cookbook (O'reilly)
    - ActionScript 3.0 Design Patterns (O'reilly)
    - Object-Oriented ActionScript 3.0 (friends of)

    greets and peace!
    Last edited by LeechmasterB; 12-07-2007 at 08:12 AM.
    I do stuff that does stuff...

    J-Force

  12. #52
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    Quote Originally Posted by LeechmasterB
    Sorry for the missunderstanding, i did not mean to diss you or sound like a smart ass. Sometimes i am short in time and overfly the posts without closely reading all...
    yeah, np

    Quote Originally Posted by LeechmasterB
    Edit: And hell i just love as 3.0! Its so clean and fast and just makes sense . Its just a pleasure coding with it and a lot of things can be done much nicer. Except for the rough start i had i would never want to code as 2.0 again if not absolutely necessary. I never liked the idea of having stuff (sounds mclips ect.) in the library, i prefer importing the content and only having the actual code in the flash, which also makes changing and modifying things easier.
    Basically once you got your custom lib ready for as 3.0 the workflow in general will be a lot faster. Like having a basic ui library for panels buttons widgets ect. can be so useful.

    And i have to say there are not many tutorials out there but i found 3 awesome books to help polish the coding style and getting aquainted with as 3.0. May be some of the non pro's might find them handy when making the step from as 2.0 or another OOP language.

    - ActionScript 3.0 Cookbook (O'reilly)
    - ActionScript 3.0 Design Patterns (O'reilly)
    - Object-Oriented ActionScript 3.0 (friends of)

    greets and peace!

    good links, and yeah, despite all my nitpicking i like lots of things coming with as3/vm2, too. I´m just nitpicking/moaning a lot about the downsides and risks i see,too, in hope those get addressed.
    When working on things codeside the new displaylist model is way more flexible, powerful and once used to it also easier and quicker to use (in many cases).
    The performance improvements on codeside are great and the more strict language and compiler gets way easier to use and is better to debug once one a) is used to it, b) uses a dev tool like flex builder or eclipse+fdt which come with propper code editing and debugging features.
    On the other side its for example a shame that flash cs3 ide lacks such features.
    Its great to be able to embed assets in code in flex as3 projects but its a downside that there´s no visual library and visual asset editing functionality next to that for the case you need that in between. The whole concept there is that the aim is to sell you two and more tools for beeing able to leverage the full power of beeing able to work on visual assets and on code propperly and i think that is a negative evolution, at the same time also money making wise no ideal choice for adobe in my eyes as it makes things way less approachable for visual creation manner people who mostly have flash ide and therefore end up with the sucky code editor/project handling/debugging "functionality" there, which yeah,is not ideal at all for working with as3 code (and therefore makes a big part of the flash community not be into switching to the latest dev tool/language version).
    I also think on api side there is a one shot command required to be able to force delete from ram on objects which are not required anymore (but may still have active strong references going, those should then just be automatically removed), again otherwise its just way less approachable for visual manner creation people.
    The AS3 api itself has way more a general followed through logic (that once understood makes it more usable), at the same time one often needs to write more code or just have an overall more complex setup to get the same results going as in as1/2 so i think on that end simplified wrapper commands should be added which make it easier to get into for less oop minded people.
    Could go on, but yeah, gotta work again some now
    Last edited by tomsamson; 12-07-2007 at 12:13 PM.

  13. #53
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I feel in many ways AS3/F9 has turned back on everything Flash was so good about: simple and easy to use without years of learning, great integration between animations/drawings and coding. This made Flash good choice for new people trying out basics of programming and game making, even so good that it was widely used in schools to quickly teach basic aspects. And exactly that has been the reason why we keep having new talented people making new interesting games with Flash (only in recent years have Flash benefitted from ability to show videos of people falling and girls undressing).

    The AS3 sadly is confusing, complicated and requires months (probably years) of learning. The integration with animation and graphics is pretty much broken to the point where MovieClips (basic Flash element throughout years) should be avoided and Timeline (with basic animation tools) will simply not work with AS3 code. Trying to create simplest of "Show Hello World when button is pressed" game requires setting up class files, importing unknown classes that are required but no error mentioning about them, getting through quirks and bugs (like no stage until next frame, no interaction until object has focus, attached display objects remaining on screen even when the object itself is replaced or deleted etc etc) and leaving new users overall in state of helpessly sweating and banging their heads against heavy material.

    It is very far from being easy. It is not simple to use. It can probably turn off new users faster then smell of rotten flesh. It requires (not suggests) to know OOP and another modern OOP-based programming language. It honestly should show message in big red capital letters every time you start it "If you are new - go away".

    Never have I swallowed the marketing hype about "AS3 is now so similar to all other modern programming languages that every programmer will happily abandon whatever language they were using so far and jump into Flash". I just dont see why would programmers do that. Other languages are more powerful and in the end pay off better. Once they already know something else, there simply is no need for Flash and AS3.

    The fact that Flash was great for animators and graphics artists to add some simple codes here and there (Samorost - one of best Flash games ever made would not exist if they had to use F9/AS3) has completely escaped from Adobe. I am aware that most things graphic designers and animators do with buttons and menus can be done through code in AS3, but thats the whole point of having simple buttons and menus - so things are easy and can be done fast.

    Having powerful language (I am not denying AS3 performs better) without simple user-friendly interface is like having powerful car without steering wheel - everybody likes to watch it and they say things like "Nice!" "Wow!" and "HOW fast it goes?!!!" but they dont want to buy it and use it every day to drive between home, work and supermarket. Yes, we have seen lots of nice experiments and engines in AS3, but for masses these will always remain experiments to look at. There is huge gap between power of AS3 and something most people would be willing to handle.

    What is more worrying, is that Flash developers seem to continue on same suicidal path. I have seen those F10 demos too where things fly around in 3D with inredible speed, but I also noticed these came again with many lines of obscure code. Speedy 3D is all fancy and nice in demos but I do hope they dont forget to add these simple buttons for non-flash-developing-crew-working-for-adobe.

  14. #54
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Quote Originally Posted by tonypa
    It requires (not suggests) to know OOP and another modern OOP-based programming language
    I have made some things without using classes, i mean, just using 2 or 3 very basic ones and the rest of the code on the main timeline.
    If you HAVE to use classes for anything i imagine what knightmare it would be
    Anyway, the future:
    http://www.moock.org/blog/archives/000260.html
    That is what Adobe follows, instead of this forever changing language changes according to what the market wants, or likes, it changes based on what those three stoges THINK the others should like.Inst socialism lovely?

  15. #55
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    tonypa makes some good points. i don't think things are quite as dire as his rhetoric suggests however...

    i suppose if i try to imagine picking up flash from the start now, everything would seem daunting- but it seemed that way when i DID start. it's a wonky, idiosyncratic software program- that hasn't changed. i just think that it's possible you're looking back with some hindsight bias...

    my projects are ActionScript-only 99% of the time and so i have to reconcile that difference with (i'm guessing now) most of you. i will defend to the death, however, that AS3 is superior to AS2 in that regard.

  16. #56
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    newblack: yeah, AS3 is superior than AS2 if you´re used to oop manner workflow, do code only things and have propper coding /debugging tools.
    Tonypa has a strong point in saying with the way as3/vm2 works its way less approachable if the above things are not the case.
    Doing things in visual manner in the flash ide and combining them with the codeside has indeed been made way more cumbersome and is in some cases just not possible/sensmaking anymore. For newer added graphical capabilities like filters or working with bitmapdata there isn´t even a way (or just a very limited one in case of filters) to work on/edit them in visual creation manner in the IDE.
    And yeah, if you compared the easy to get into approach of flash 3 or flash 6 with the setup with as3/vm2 there is a huge difference regarding whether that´s approachable easily for non oop code centric only working people.
    Ever wondered why so many people still use flash 6/AS1 syntax?
    I also wrote my thoughts on that single topic up here: http://www.bit-101.com/blog/?p=1102#comments
    the other day and yeah, we´ve been talking about it here some already, too, no need to repeat the same points again
    Last edited by tomsamson; 12-08-2007 at 06:24 PM.

  17. #57
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    Quote Originally Posted by tomsamson
    Ever wondered why so many people still use flash 6/AS1 syntax?
    perhaps because some people dont like to be forced,- or simply because it works for them- and for many people that´s what counts. This is even more impossible with flash lite development as right now it´s more a AS1 development

  18. #58
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    yeah, sure man, it was a rhetorical question, as you pointed out there are many reasons
    (that said with newer versions of flashlite you could use AS2 for writing content for it)

  19. #59
    Senior Member
    Join Date
    Aug 2007
    Location
    Spencerville, Ontario, Canada
    Posts
    146
    Well Tom, if you compose a book, I definitely want to read it
    I support your goal, and I hope you achieve it. Regardless what you do, I doubt you wasted all those years. You made some fun games, and know you have the opportunity to educate others, so they can also make really fun games. To me, thats not wasteful at all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center