自定义 Flex 组件,设计视图中的可视化控件

发布于 2024-08-27 12:08:47 字数 686 浏览 5 评论 0原文

您是否知道如果将 组件拖到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦纸 2024-09-03 12:08:48

您需要将想要以这种方式查看的任何自定义组件放入库项目中,并从中创建一个 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

香草可樂 2024-09-03 12:08:48

这些变量必须是公共的。将变量设置为公共后,可以从属性面板访问变量。

public var field1:String;
public var field2:String;

Those variables must be public. Variables are accessible from properties panel after setting them public.

public var field1:String;
public var field2:String;
ま柒月 2024-09-03 12:08:47

尝试在代码中使用 [Inspectable] 元标记

[Inspectable]
private var field1:String;

[Inspectable]
private var field2:String;

不确定可检查成员是否可以是私有的。如果 [Inspectable] 单独无法做到这一点,请尝试将变量设为 publicprotected

Try using the [Inspectable] metatag in your code

[Inspectable]
private var field1:String;

[Inspectable]
private var field2:String;

Not sure if inspectable members can be private. If [Inspectable] alone doesn't do it, try making the vars public or protected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文