如何在Flex/FlashDevelop/AS3中实现宏
我对使用 Flex 编译器和 FD 很陌生,但对 flash/as3 和 FD 肯定不陌生。 目前,我一直在使用 FD/CS3 编译我的应用程序,并希望切换到 Flex 编译器。 我想尝试使用 Flex 编译器的主要事情之一是在 AS3 中使用宏。 例如,假设我希望执行一些极其昂贵的操作:
private function Main():void
{
extremelyExpensiveOperation(params);
}
但我想避免函数查找的成本。 因此,我没有使用函数查找,而是做了类似的事情
private function Main():void
{
<macro expandExtremelyExpensiveOperationHere(params)/>
}
,显然语法不必看起来完全一样,但宏在编译之前会被扩展,从而避免函数查找。 有人能指出我正确的方向吗?
I am new to using the Flex Compiler with FD, although certainly not new to flash/as3 and FD. Currently, i have been compiling my applications with FD/CS3 and want to make the switch to the flex compiler. One of the main things i want to experiment with the flex compiler is using Macros in AS3. For instance, say i have some extremely expensive operation that i wish to carry out:
private function Main():void
{
extremelyExpensiveOperation(params);
}
but i want to avoid the cost of a function lookup. So instead of using a function lookup I do something like
private function Main():void
{
<macro expandExtremelyExpensiveOperationHere(params)/>
}
obviously the syntax doesn't have to look exactly like that, but the macro gets expanded before compilation thus avoiding function lookup. Can anyone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用misch的预处理器 ...它支持宏好吧...
欢迎
back2dos
use misch's preprocessor ... it supports macros as well ...
greetz
back2dos