7yue's Weblog

Thinking in RIA Solutions...2470,8514,1020的生活演绎

« iRiver Clix将Flash Lite2.1内置祝各位国庆快乐 »

自我精简类包的有效方法

有多少人喜欢用import .*?,我举手,我承认我是一个懒人,因为我压根就没有花时间去记住那些类及类包的位置,但是我同各位一样,都想让自己的程序更优化,于是我想了个办法:
1.开始写的时候,不管3721,我先import .*爽一下
2.我开始在程序里加入:

trace(getQualifiedClassName(objName)); //看看到底这个对象是哪个类?
trace(getQualifiedSuperClassName(objName));//看看这个类的父类是哪个?

3.出来结果后,返回去修改import .*,直接改成对应类

好了,最简单的优化完成了。

  • quote 4.Rene
  • http://www.dormbryo.net
  • 这个,其实没必要的,编译时候不会增加尺寸,编译的时候,会自动判断哪些类被引用到,也就是说,即便全部写 .* 也只是会编译那些真正被用到的类
  • 2007-9-28 23:46:18 回复该留言
  • quote 6.aw
  • http://www.awflasher.com/blog/
  • why cs3 cannot help to figure out the package that are not used in the project ?
    I always use such kind : import xxx.xxx.* to handles with very complicated packages, and I take it for granted that FB or CS3 can help me figure out those unnecessary classes....
  • 2007-10-2 17:20:11 回复该留言
  • quote 8.aw
  • http://www.awflasher.com/blog/
  • Anyway, that's not so reasonable...
    You mean even the complier of Flex and CS3 is totally stand-alone ?
    BTW: The comment-system of Zblog is really a little mess-up. If you are not a registered user, you cannot reply to some exact comment.
    You can take a look @ mine :)
  • 2007-10-4 16:13:24 回复该留言

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Walle Build 91204

Copyright 2007 www.7yue.com. Some Rights Reserved.
京ICP备05064035号