Placing AS3 code on stage/MC timelines a la AS2 instead of in classes

后端 未结 2 1596
無奈伤痛
無奈伤痛 2021-01-29 14:57

I\'m aware that ActionScript 3.0 is designed from the ground up to be a largely object-oriented language and using it means less or even no timeline code in Flash documents.

2条回答
  •  逝去的感伤
    2021-01-29 15:14

    If you are already familiar with AS2 (and you have experience with other languages as well), switching to AS3 shouldn't be too hard. There are a few places where things changed quite a bit: basically the event model and some widely used APIs, like flash.net (i.e., loading stuff, be it images, SWFs, sounds, XML, etc) and the display list (much more options than just movieclip, more coherent, reparenting, etc). Working with XML changed (for good) too and it's more powerful and easier (but you can use the old API if you feel like, it's still there). The bulk of the language itself hasn't changed much, though.

    I'm sure you are aware of the potential problems of having code in the timeline. Well, the same applies to AS3, though some things like placing code on objects is not allowed in AS3.

    I don't see a problem in placing stuff in the stage in the IDE and using movieclips for animations. IMO, that's why they're there in the first place. I know some people obsess about creating and positioning everything by code. I'm not one of those. For me, the IDE could be a good tool for layout, tweening, etc, at least in most cases (for some very dynamic stuff, on the other hand, you'd need to code the layout too).

    So, I wouldn't outright advise against moderate use of timeline code. If it suits your needs, fits in your workflow and lets you do what you need to do without being an impossible to maintain (or even follow) mess, why not?

    If at some point you need to put some stuff in classes, you refactor and move your code as you go.

提交回复
热议问题