自定义 Flex 组件,设计视图中的可视化控件
您是否知道如果将
或
组件拖到 Flex 项目中,当您进入设计模式时,您会得到这个右侧的面板用于设置其属性,例如 text
等。
我有一个自定义组件,可以使用 actionscript 或 mxml 调用它,如下所示:
<comps:TheComp field1="OK" field2="Yes" />
该组件接受此输入并将其用于其内部
private var field1:String;
private var field2:String;
private function initializeit()
{
// component takes the input and lays it out as needed
}
操作我进入设计模式,我可以在自定义组件下看到该组件,我可以将其拖到舞台上并查看它,但无法像正常情况一样在右侧直观地设置其值 field1 和 field
或
会有。
知道如何添加吗?我需要让它继承一些东西或其他东西吗
Do you know how if you drag an <mx:Label>
or <s:Label>
component into your Flex project, when you go to design mode you get this panel on the right to set its properties like text
etc.
I have a custom component that I can call with actionscript, or with mxml like this:
<comps:TheComp field1="OK" field2="Yes" />
The component takes this input and uses it for its internal operation
private var field1:String;
private var field2:String;
private function initializeit()
{
// component takes the input and lays it out as needed
}
When I go to design mode, I can see the component under custom components, I can drag it to the stage and see it, but can't set its values field1 and field
visually on the right like a normal <s:Label>
or <mx:Label>
would have.
Any idea how I can add that? Do I need to make it inherit something or anything else
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将想要以这种方式查看的任何自定义组件放入库项目中,并从中创建一个 SWC,然后使用该 SWC 而不仅仅是源代码 http://blog.another-d-mention.ro/programming/create-professional-flex-components/ 。
HTH;
艾米
You need to put any custom components you want to view this way into a library project and make a swc out of it, then use the swc instead of just the source code http://blog.another-d-mention.ro/programming/create-professional-flex-components/ .
HTH;
Amy
这些变量必须是公共的。将变量设置为公共后,可以从属性面板访问变量。
Those variables must be public. Variables are accessible from properties panel after setting them public.
尝试在代码中使用
[Inspectable]
元标记不确定可检查成员是否可以是私有的。如果 [Inspectable] 单独无法做到这一点,请尝试将变量设为
public
或protected
。Try using the
[Inspectable]
metatag in your codeNot sure if inspectable members can be private. If [Inspectable] alone doesn't do it, try making the vars
public
orprotected
.