A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 59

Thread: why use as3?

  1. #1
    Member
    Join Date
    Jan 2006
    Posts
    30

    why use as3?

    I have red a bit about as3 now and looked into some tutorials.. and trying to understand why I would want to learn it to develop flash games. (haven't seen any good as3 game examples so far either)

    seems like I need to do 10 times more coding with as3 as opposed to as2 to just get a ball to move..

  2. #2
    Ryan :D ryanp321's Avatar
    Join Date
    Nov 2007
    Location
    Wallasey
    Posts
    292
    I heard ( heard , because i cant code for my life)
    that as3 has a better maths engine, resulting in alot more.
    Real time 3d.
    And creating panes.

  3. #3
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Well-written AS3 code is very similar in length to AS2. '10 times' is a huge exaggeration.

    The reason AS3 is said to take longer to write is because it's far more strictly-typed. You have to be a lot more specific and rigid with everything you write, it's a lot more Object-Oriented. So for example, where in AS2 it was enough to declare a variable by saying a = 1; you'd have to say var a:int = 1; in AS3. Similarly, it takes a bit more work to set up event listeners, like onEnterFrames.

    A result of all this strictness is that the language is FAR more powerful (you have more control over system stuff like sounds and the mouse), it's able to use JIT (just-in-time) compilation, so it's about 10 times faster (making it better-suited for 3D and particle effects), and the compiler is a lot more helpful in catching errors (for example, if your code isn't working because you added the string "123" to a number variable rather than the number 123, it'd tell you that the type coercion failed).

    As regards beginners, I'd say there's no advantage in using AS3. You need intimate knowledge of at least AS2, but preferably Java if you want to have an easy time using AS3. The strict data typing means that the compiler also throws up errors and warning where AS2 normally wouldn't.
    http://www.birchlabs.co.uk/
    You know you want to.

  4. #4
    Member
    Join Date
    Jan 2006
    Posts
    30
    hmm.. I have only used as2 to control things on websites and make very simple games, but I want to learn as2/as3 from scratch now.

    I already ordered this book (which was highly recommended btw)

    http://www.amazon.com/Foundation-Act...6706232&sr=8-1

    the as3 version, I think I will give it a try! If it seems way more impossible than I was hoping for after a few chapters I just order the as2 version.

  5. #5
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    By far, Keith's book is one of my favorite flash AND AS3 books. The examples are very similar to the ones he used in the AS2 version of the book, but, he explains the ins and outs of setting them up in classes and functions and his language is easy to understand no matter what your level of coding is.

    One of the few flash books I've actually read cover to cover instead of just used as a reference.

    Enjoy!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  6. #6
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Like everything in life (right down to the laws of nature!) you gain something by losing something else. So, if you want more performance, then you gotta do the "10 x more work". If you don't need performance, then don't bother.

    It's like tuning a car. You can get acceleration or fuel economy, but not both.

  7. #7
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    Speed.
    Its a learning curve, it forces you to be a better programmer. Its confusing and the **** you used to know doesnt work. But its fast. Which means better collisions and better physics!
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  8. #8
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    speed is the only advantage I can see right now- not sure if adobe is running into the right direction as AS3 right now is not very designer friendly- meaning it splits the designers and pure coders way more with even advising to code serious projects in flex instead of the Flash 9 IDE

  9. #9
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    having the code way more structured and encapsuled does help for large scale projects and also when several developers work together but yeah, other than that i agree with your comment, Adobe tries to get taken serious by developers coming from other languages and RIA client folks and also raise performance with each version, sadly the complexity raise of the language, having to use more and more dev tools and code in lower and lower level manner to gain maximum possible performance surely alienates a big part of the more visual creation manner minded group (a bigger one with every version).
    I try to bring that up in any forums Adobe people have an eye on, well, we´ll see.

  10. #10
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    I know many students at my university who take a rest from Flash at all simply because it´s way to confusing for them- most of them are just multimedia designers thus no real coders-
    if they hear AS3, classes methods,... they quickly jump to another tool that does it easier for them like VVVV, virtools or some of the other intuitive authoring tools.

    I notice myself that even though I have CS3 I create 99% AS2 projects in Flash anything else is to much time consuming as I dont have the time for most of that stuff- cs3 sucks big time there.

    speaking of slow With AS3 not beeing that flexible anymore with timelines, cascaded movieClips (mouseEvents horror anyone?) taking way more time to learn not to mention to actually get used to it it´s not the greatest flash evolution I´d say- perhaps a to big jump into a certain direction.
    Oh and I always hated components or smart movieClips- with CS3 I get even more reason for that simply because they broaden even more the gap between noobs and hidden/ unexplained code
    Last edited by renderhjs; 12-03-2007 at 10:20 PM.

  11. #11
    Senior Member bomesar's Avatar
    Join Date
    Nov 2006
    Location
    Croatia
    Posts
    136
    OK, so when it comes to performance and high framerates AS3 is the one to go with. But what about web sites for example? Is AS3 (or will it be) so important for someone that makes web sites? I've been tracking Flash web site development for a couple of years now. I've seen lots of different things, really lots of them. So is AS3 capable of doing more things than AS2 or is it just the thing that it's more optimized?

  12. #12
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    such questions can´t be answered with a general "YES" or "NO".

    First AS3 offers new functionality on several ends so yeah, on that side one can do more with it.
    On the other side the language is more complex and harder to approach if you´re not a person coming from another oop language or just less into coding in general so that additional functionality may be hard to approach for you (like you wouldn´t want to doodle around with ByteArrays on your first day of coding).
    Even if you´re experienced in oop manners setting up a project in AS3 probably will take you longer time than in AS1 or 2.
    To my experience AS3 really isn´t ideally suited for rapid prototyping unless its about a demo or other tiny project of some sort.
    As a plus point the code execution performance was raised in various ways on various ends so yeah, even if one only used functionality available in older AS versions it should overall run faster and therefore enable you to pull off some things that wouldn´t have run smooth in previous flash/AS versions
    (things that require code execution performance such as complex group AI, pathfinders, physics engines, 3D engines etc).

    On the downer side Movieclip usage is heavily crippled down due to several issues, next to that the garbage collector works different in a way in which it makes you watch out way more for ram/ressource usage, both of those making it way more troublesome for non pro coders to get nice things going at all and even error prone and time intensive for experienced coders in some cases.

    I could go on listing pros and cons for a while, but yeah, by now it should be obvious that there´s a lot speaking for as3 but also a good bunch speaking against it.

    Flash is often used for websites that present some form of RIA (, so a nice gui driven app), or for example promotion microsites. Many of those are now made in AS3 as working in oop manner in Flex Builder or some other such editor gaters a lot for the needs of people building such apps and on promo microsite end media ad microsite runners normally want to WOW the viewer and on that end its currently very en vogue to let something spin around using papervision 3D (such content is then usually made in AS3 for performance reasons).

    For some reasons i listed (and various others) there will surely always be a big crowd among the flash content creators who don´t switch over to AS3, but yeah, a big part already did the move.

    I did the move and i´d love to love it as a whole, but yeah, right now i can only say it has some advantages but is not fully where it could and should be.

    In my eyes the ideal flash version would be one that combines as much as possible of the easy to use and quick creation manner support of flash 6 and at the same time has the matured language and performance of AS3/VM2 and also come with a propper editor instead of just selling another tool for coding and saying flash ide is for the designer crowd only now.
    So yeah, we´re not there yet, not sure if we´re getting closer to that goal.
    As usual i´m looking forward to see what the next version brings up
    Last edited by tomsamson; 12-03-2007 at 11:05 PM.

  13. #13
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    In my eyes the ideal flash version would be one that combines as much as possible of the easy to use and quick creation manner support of flash 6 and at the same time has the matured language and performance of AS3/VM2 and also come with a propper editor instead of just selling another tool for coding and saying flash ide is for the designer crowd only now.
    So, for you guys what are the things in as2 that makes possible to get things done faster tham as3?(I ask that because i dont have much experience with as2 and making my first game in my spare time with as3 is taking longer tham i expected)
    It is:
    -the listeners being functions outside of the object that dispatches the event, instead of rigth on it like this.onEnterFrame...?
    -having to use IEVentdispatcher instead of the ASBroadcaster?
    -strict data typing( wich im not sure if its really a problem)?
    -the workarounds to fix the mess they made with the GC ?
    -the new display model?
    -oop?
    -having to make a class for an object for it not to be dynamic and a bit slower instead of putting his methods and properties rigth on the main timeline?
    -using _root?
    I think in the end its a trade off between good code practices and productivity and many of those things only really matter for projects way bigger tham small little flash games
    Last edited by Cimmerian; 12-04-2007 at 05:23 AM.

  14. #14
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    as reply to your question to me its several things, just on the display side that using movieclips is crippled down so much means you have to rely on a bitmapdata based approach way more than in flash 8 (where i´d mostly use bitmapdata for effects and a scroller for example).

    In a game i´m just working on i have a player character for example.
    That character isn´t just a movieclip with a single image in each frame of the timeline to show a new action, its more a movieclip with several nested movieclips.
    So character mc inside it has legs mc,arms mc,head mc,torso mc etc.
    All those parts mcs have several sub mcs inside them,one for each state.
    So as result each of the parts can be individually animated,rotated or get a different color or some other sort of transformation applied easily (in AS1/2).

    This setup allows to animate the player in very natural seeming motions.
    (imagine the chracter is running rightwards while aiming leftwards, no problem to get nice looking with such a setup).
    Now with as3 when you change the playhead (frame) in the parent mc you can´t access child mcs inside the parent mc from outside until the render event of the parent or the added event of the child in question has been thrown after the frame was changed.
    So you then have to react on events for movieclip playhead interaction which is totally doable (and i did it) but it takes a good bit amount of time and code more to achieve the same result as with flash 6.
    The alternate option would be to not use movieclips even in such cases where a visual creation manner (for positiooning body parts etc) and moveclip playhead and nesting functionality would make most sense.
    So essentially write your own bitmapdata and timebased animator class.
    An Editor where you can edit/preview the anims.
    All getting more complex if you want to support such nested sub animations behaviour. Probably using up more ram at runtime as you´re dealing with uncompressed bitmapdatas.
    See,very simple use case, i mean come on, we expect movieclips to be useful for certain things in certain ways since flash 3 and there, not working as they used to and it takes way more time to get it going in the new approach.


    In more general terms i think its a BIG mistake to have the garbage collector working as it does with VM2/AS3 export or more specifically that there´s no one shot command aymore to instant delete an object from ram if one wants to do that.
    This in my opinion will lead to way more flash content ramping up ram usage as to my experience on this and various other flash content creator meeting outlets a majority of flash content creators are not used to dealing with weak references, constantly checking ram usage and what not all that is related to this topic.
    I can imagine people working more with java are used to how the garbage collector works now but yeah, that they are used to it doesn´t mean its an improvement of how it worked in flash before.
    Let´s take for example eclipse IDE (java made), its pretty much granted that when using the app a good while it will use up so much ram and/or cpu that you´ll have to restart it or it crashes (unless you have 2 gigs or more ram and a fast cpu and don´t need it for other things).

    For me as developer the way the garbage collector works means more planning, refactoring and testing work.

    I could go on listing many points, as sum of all i worked on 3 or 4 as3 projects up to now and overall those all took longer to do than it would have taken me to make em in as1/2. The result ran at way better performance, partially it was stuff that wouldn´t have run at acceptable performance in as1/2 at all or just wasnt technically possible there at all but yeah, the dev time felt more cumbersome and was longer than in similar as1/2 projects.

    Your experience may vary though, for example if you make applications using components or just create stuff that doesn´t deal with so many different display object types. The more code only a project is the less will there probably a difference in dev time once you´re used to the language itself, then it could be the case that your dev time in as3 with its better error handling and better dev tools at hand can be shorter than if you did the project in as1/2.

    Also regarding your comment "many of those things only really matter for projects way bigger tham small little flash games"

    i totally disagree.
    First of all,sure one could make a SMALL LITTLE game in any language, but i tend to like to make more complex things and overall i see game development as one of the most complex topics one can tackle at all in the programming world, at least way more complex than the usual rich internet app as its hyped now as the in thing.

    Next up as i said above i think in game development the changes AS3/VM2 brings with it in many cases will matter way more and have more negative impact on dev time and all than if you did a gui app using components in flex builder.
    Last edited by tomsamson; 12-04-2007 at 12:53 PM.

  15. #15
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    Start a flash blog tomsamson!! I'd definitely read it. It's be a nice place to put all of the tips you've written in this forum and wont get lost under thread upon thread of "help me with my game" threads.

  16. #16
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    There's really no decent AS3 tutorials for making games on the web yet. I've also experienced the headaches tomsamson was talking about when creating nested characters with different body parts in AS3. It's a nightmare! Even gotoAndStop() doesn't work the way it used to; you have to add about 5 lines of extra code in to get it to work in a similar manner as it did in AS2. To get a character to run and stop when you release the key is a pain in the buttcheeks.

    Where are all the AS3 game tutorials, folks?

    I'd agree with Renders evaluation about AS3 taking Flash in an user-unfriendly direction for all but the best programmers- cutting out 90% of the game-makers (ie their prime consumers) who've already gotten cosy with AS2. This will be fine for the next few years while AS2 games still look good in comparison, but just wait until a few teams bring out some optimised AS3 3D games- nobody is going to want to touch AS2 with a barge-pole after that..
    Adobe should have incorporated their own code routines under the bonnet of the older AS2 ones, instead of this complicated alien language that has few connections to the old one.

  17. #17
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    Quote Originally Posted by Cortana
    Start a flash blog tomsamson!! I'd definitely read it. It's be a nice place to put all of the tips you've written in this forum and wont get lost under thread upon thread of "help me with my game" threads.

    i´m glad to hear that, thanks
    I´d love to write blog posts regularly and even write a flash game dev book (maybe together with some other coder mates), i´ve even talked about the book idea here before
    Its just that i´m coding on games,editors and what not all next to handling the business side of sn,too, so yeah, that leaves few time for such things.


    That brings me to my reply to EvilKris:
    I think that there aren´t that many good game related as3 tutorials yet mostly is due to the nature of AS3.
    It takes longer to get into, once you got into it it means that you can´t reuse any libs etc you had build up over the years from older AS versions, you either have to port em or rewrite em from scratch.
    All that takes time and experience.
    As AS3 is mostly only used right now by people working commercially with flash or some other technology/language for several years that probably means that those dudes have lots of work and few spare time, making it take a while before such people can think of not just releasing an editor or a tidbit thing like a particle effect or scroller, but actually take the time to comment all that; even more time to write a lengthy tutorial explaining all in a way that is approachable for people not into as3.
    I´d skip working on any games and work on a book the next 6 months if anyone is into paying for that
    Otherwise,yeah,we´ll have to wait. I think jobe is working on one, should be good

    Regarding the issues with movieclips you talked about: yeah, there are many many more and even some actual bugs (like nested elements sometimes not getting propperly initialized/instantiated), i mailed them to adobe and some were fixed in the latest beta player, for some they said they´re working on it for a upcoming version.
    Overall i think they have to fix movieclip functionality,essentially fix all bugs and bring back the usability they had before, otherwise they will loose an even bigger content creator section than due to the language change coming with as3 alone (which i already expect to be a big chunk).

    Regarding as1/2 content looking outdated to the degree where noone will use it anymore, well, i can´t agree fully there.
    Designer types or people just not used in oop coding and not into getting into it either probably will never want to switch over to as3 in the way it is now. Next up many game types can be very well done in as1/2,too, so no need for as3 for those if it doesn´t bring any required advatantage.
    When its about cutting edge stuff on tech side though,so doing things that wouldn´t run smooth or at all in as1/2 yeah,then for such things there´s no use for an AS1/2 only coder.
    Then again render has brought up a good point there: people, no matter if they are experienced enough coders to do that cutting edge stuff in as3 workflow, or designers who want to do such kickass stuff in as1 like easy workflow manner,well, let´s just say many people may think about if there´s no other option than using flash.
    I think Adobe is thiking a lot about attracting more coders coming from other languages and RIA folks and thinking too little about keeping a majority of the current flash user base happy, i see this as quite problematic.
    Last edited by tomsamson; 12-04-2007 at 02:14 PM.

  18. #18
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Also regarding your comment "many of those things only really matter for projects way bigger tham small little flash games"

    i totally disagree.
    First of all,sure one could make a SMALL LITTLE game in any language, but i tend to like to make more complex things and overall i see game development as one of the most complex topics one can tackle at all in the programming world, at least way more complex than the usual rich internet app as its hyped now as the in thing.
    Well, im not talking about RIAs, i agree that games are the top even with Adobe thinking they dont exist and instead focusing on brainless things like thermo or AIR, and now many ppl will disagree but i dont care
    What i mean was SMALL games, i mean, i belive is totally possible to build a super mario world in flash mx, not just a matter of time and resources but also organization, and for THAT ammount of code and complexity tham maybe many of the things that as3 brings will came handy, but for realistic things in wich whats matter is to have something done faster, even not being that much,is whats matter, them in that sense is that i tend to like more as2 with all his simplicity them the well intentioned(?) things they put on as3 to make it more close to a real language and more focused on big projects
    But anyway, f10 will have hydra, maybe in f11 they decide to make another cosmetic change in as3 making it simple again

  19. #19
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    Yeah I use as3 for games because its fast... but I make all my websites in as2 as its faster

    Tomsamson... Im voting for your webblog as well
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  20. #20
    Senior Member bomesar's Avatar
    Join Date
    Nov 2006
    Location
    Croatia
    Posts
    136
    Quote Originally Posted by Flashkit
    Tomsamson... Im voting for your webblog as well
    Check

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