如何以声明方式将 Spark State 的 name 属性设置为字符串变量值
我在 mxml 中声明了 Spark 状态。我还有一个带有字符串常量的类。我希望我的州名称与字符串常量匹配。是否可以直接在 mxml 中执行此操作以及如何执行? 我不想使用相同的字符串,我想将 name 属性设置为常量的值。
代码:
public static const create:String = 'create';
public static const edit:String = 'edit';
mxml:
<s:State name="new"/>
<s:State name="edit"/>
据我所知,状态名称需要在编译时进行处理,所以可能这是不可能的。
I have spark States declared in mxml. I also have a class with string constants. I want my states names to match the string constants. Is it possible to do that directly in mxml and how?
I don't want to use the same string, I want to set the name property to the constant's value.
code:
public static const create:String = 'create';
public static const edit:String = 'edit';
mxml:
<s:State name="new"/>
<s:State name="edit"/>
As far as I know state names need to be processed at compile time so probably it's not possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,问题是你不能在状态声明中包含常量:(
Yes, the problem is you cannot include constants in state declarations :(