Flex 自定义组件不接受脚本:“字符串"类型的默认属性“文本"的多个初始值设定项 [英] Flex custom component doesn't accept Script: Multiple initializer values for default property, 'text', of type 'String'

查看:18
本文介绍了Flex 自定义组件不接受脚本:“字符串"类型的默认属性“文本"的多个初始值设定项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Flex 4 和 Flash Builder 4.我只是想学习创建组件,我创建了一个 mxml 组件,如下所示并将其包含在我的应用程序中:

I'm using Flex 4 and Flash Builder 4. I just want to learn to create components and I created an mxml component as follows and included it in my application:

<?xml version="1.0" encoding="utf-8"?>
<s:TextInput xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
    </fx:Script>
</s:TextInput>

如果我取出 fx:Script 标签它可以工作,但是一旦我有了这些标签(无论那里是否有任何实际代码),我就会收到错误消息:Flex 自定义组件不接受脚本:多个'String' 类型的默认属性 'text' 的初始值设定项."

If I take out the fx:Script tags it works, but as soon as I have those tags (regardless of whether any actual code is in there) I get the error: "Flex custom component doesn't accept script: Multiple initializer values for default property, 'text', of type 'String'."

为什么会这样?组件中不允许使用脚本吗?

Why would that be? Is script not allowed in components?

推荐答案

这是一个已知错误 SDK-25184.Milestone 是下一个 Flex SDK Hero 版本.如果您明确设置了 text 属性,您仍然可以使用 mxml.

this is a known bug SDK-25184. Milestone is the next Flex SDK Hero Release. You still can use mxml if you explicitly set the text property.

<?xml version="1.0" encoding="utf-8"?>
<s:TextInput xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             xmlns:mx="library://ns.adobe.com/flex/mx"
             text="">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
</s:TextInput>

谢谢.

这篇关于Flex 自定义组件不接受脚本:“字符串"类型的默认属性“文本"的多个初始值设定项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆