开发者

Flex: Constant strings in metadata

I have something like

public class Controller {
    [Observer("fetchEmployeesEvent")]
    public function 开发者_开发百科fetchEmployees() : void {
        //doSomething
    }
}

and I want something like

public class Controller {

    public static const FETCH_EMPLOYEES_EVENT : String = "fetchEmployeesEvent";

    [Observer(FETCH_EMPLOYEES_EVENT)]
    public function fetchEmployees() : void {
        //doSomething
    }
}

My problem is that only the first code snippet works. Flex seems to ignore the constant FETCH_EMPLOYEES_EVENT in the metadata-tag.

My question is: Is it somehow possible to use constant strings in metadata?


It's a pain: there's no way using Flex to do what you're trying to do.

If you're able to add some kind of pre-processor to your compile (which I don't think is possible if you're using FlexBuilder) then you could resolve the constant strings there, otherwise I'm afraid you're out of luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜