配售AS3 code在舞台上/ MC时间线中类一拉AS2,而不是 [英] Placing AS3 code on stage/MC timelines a la AS2 instead of in classes

查看:113
本文介绍了配售AS3 code在舞台上/ MC时间线中类一拉AS2,而不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,ActionScript 3.0中从底层设计是一个主要面向对象的语言,并用它意味着更少,甚至没有时间表code Flash文档。

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.

我很熟悉面向对象编程和很舒服写作课。但是,由于我主要是使用Flash的动画,我几乎没有的需要的编写ActionScript code比preloaders,字幕,质量控制,网站链接等其他。其实,我还是把我的Flash影片使用AS2的这一天,因为我已经习惯了的gotoAndPlay() / gotoAndStop(),AS2 preloaders,字幕,质量控制,甚至的getURL()。当然,我真想现在继续前进,几乎每个人都对Flash Player 9或10,现在,我已经涉足与其他面向对象的语言如Java,C#和Objective-C了。

I'm quite experienced with OOP and am comfortable writing classes. However, since I mostly use Flash for animations, I hardly ever need to write ActionScript code other than for preloaders, subtitles, quality controls, website links and so on. In fact, I still set my Flash movies to use AS2 to this day because I'm used to gotoAndPlay()/gotoAndStop(), AS2 preloaders, subtitles, quality controls and even getURL(). Of course, I really want to move on now that practically everyone's on Flash Player 9 or 10 and now that I've dabbled with other OO languages like Java, C# and Objective-C too.

我是一个完整的初来乍到AS3和我不是非常有AS2了解到无论是。考虑到我目前使用的ActionScript中,是否有任何情况下,它仍然是确定的使用非常简单AS3 code中的时间表,而不是移动code一类,尤其是因为移动到一个类可能意味着不必要地增加数量上的LOC 4至40? (哎呀,是后一种情况下(代替......),甚至一个有效的关注呢?)

I'm a complete newcomer to AS3 and am not very learned with AS2 either. Considering my current use of ActionScript, are there any cases where it's still OK to use very simple AS3 code in the timeline instead of moving code to a class, especially since moving to a class might mean unnecessarily increasing the number of LOC from 4 to 40? (Heck, is the latter case ('instead of ...') even a valid concern at all?)

推荐答案

如果您已经熟悉AS2(你有其他语言经验),切换到AS3应该不会太难。有几个地方的东西改变了不少:基本的事件模型和一些广泛使用的API,如flash.net(即加载的东西,无论是图片,主权财富基金,声音,XML等),并显示列表(多不仅仅是更多的选择影片剪辑中,更连贯,重排根目录等)。使用XML改变(好)过,它的功能更强大,更容易(但你可以使用旧的API,如果你喜欢,它仍然存在)。语言本身的体积并没有太大的改变,虽然。

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.

我敢肯定,你是知道的具有时间轴中code的潜在问题。那么,同样适用于AS3,但有些东西就像把code上的物体是不是在AS3中不允许的。

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.

我看不到放置在舞台的东西在IDE中,并使用影片剪辑的动画的一个问题。国际海事组织,这就是为什么他们在那里摆在首位。我知道有些人沉迷有关创建和定位的一切由code。我不是其中之一。对我来说,IDE会是一个很好的工具,布局,补间等,至少在大多数情况下(对某些非常有活力的东西,在另一方面,你需要$ C C的布局太$)。

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).

所以,我不反对适度使用的时间表code直接指教。如果它适合你的需求,适合你的工作流程,让你做你需要做的而不不可能维持(甚至跟随)的一塌糊涂,为什么不呢?

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?

如果在某些时候你需要把在课堂上的一些东西,你重构和移动你的code,当您去。

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

这篇关于配售AS3 code在舞台上/ MC时间线中类一拉AS2,而不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆