如何在另一个动作脚本中使用 mxml 组件
如何在另一个 mxml 组件动作脚本代码中使用 mxml 组件
。 在我的主 mxml 文件中
private var warningMessage:Warning;//this is variable
if (!_controller.flashVars.chatSession || _controller.flashVars.chatSession == "")
{
warningMessage.includeInLayout = true;
warningMessage.visible = true;
}
else
{
_controller.flashVars.showWarningMessage = "2";
}
private var warningMessage:Warning;
(警告是外部自定义组件)
warningMessage.visible=true
(我想在我的动作脚本代码中像这样使用它
,但是我收到错误消息“类型未找到或不是编译时常量:警告
”)
how to use mxml component in another mxml component actionscript code
for ex.
in my main mxml file
private var warningMessage:Warning;//this is variable
if (!_controller.flashVars.chatSession || _controller.flashVars.chatSession == "")
{
warningMessage.includeInLayout = true;
warningMessage.visible = true;
}
else
{
_controller.flashVars.showWarningMessage = "2";
}
private var warningMessage:Warning;
(warning is external custom component)
warningMessage.visible=true
(and i want use it like this in my actionscript code
but i am getting error saying "Type was not found or was not compile time constant:warning
")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有三件事跳出来。
new
生成新的目的。在上面的代码中,warningMessage
为 null。private var warningMessage:Warning = new warning();
There are three things that jump out.
new
to generate a new object. In your code above,warningMessage
is null.private var warningMessage:Warning = new Warning();
确保您已将自定义组件导入到您正在使用的文件中。
Make sure that you have imported your custom component to the file you are using it.
您需要将其他自定义组件引用为 mxml 命名空间。
查看以下文章以获得准确的说明:
http://www.roseindia.net/flex/custom-mxml-tags.shtml
You will need to reference the other custom component as a mxml namespace.
Check the following article to get an accurate illustration:
http://www.roseindia.net/flex/custom-mxml-tags.shtml