Flex 3:是否有一种简单的方法可以从主应用程序内更改组件内的值?
因此,我使用的是我在网上找到的自定义自动建议组件 http://hillelcoren.com/flex-autocomplete /。该项目的背景颜色在以下文件夹中设置:com >希勒科伦>组件>自动完成> FlowBox.mxml。背景颜色硬编码为白色:
<mx:Canvas
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="com.hillelcoren.components.autoComplete.classes.*"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
borderStyle="inset" backgroundColor="#FFFFFF"
initialize="init()" clipContent="true"
xmlns:components="com.hillelcoren.components.*">
我在我创建的名为“position.mxml”的组件中使用此组件,该组件位于名为“modules”的文件夹中。有什么方法可以从位置模块更改自动建议框的背景颜色吗?
So I'm using a custom auto suggest component that I found online at http://hillelcoren.com/flex-autocomplete/. The background color for the item is set within the following folder: com > hillelcoren > components > autoComplete > FlowBox.mxml. The bg color hard coded in there to be white:
<mx:Canvas
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="com.hillelcoren.components.autoComplete.classes.*"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
borderStyle="inset" backgroundColor="#FFFFFF"
initialize="init()" clipContent="true"
xmlns:components="com.hillelcoren.components.*">
I use this component from within a component I created called "position.mxml" that is located in a folder named "modules". Is there any way that from the position module, I can change the background color of the autosuggest box?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,这取决于组件架构,我没有深入研究 Hillel 的 AutoComplete 组件的架构。
样式通常是继承的,因此理论上在位置组件或自动完成上设置backgroundColor样式是设置值的一种方法。但是,我希望“硬编码”样式能够覆盖此类继承,除非您在组件已初始化。
另一种方法是修改 Hillel 的组件以将此值公开为样式。理论上这并不难;实际上,复杂的架构可能会使其变得困难。 有关创建自定义样式的详细信息。
第三种方法是深入了解组件并设置样式。像这样的事情:
当然,所有相关的组件实例都必须是公共的才能这样做。
第四种方法可能是使用不同的组件。 Flextras AutoComplete 组件是一个原生 Spark 组件,它将是轻松创建自定义皮肤,更改任何相关皮肤部分的背景颜色。
Really it depends on the component architecture and I have no drilled into the architecture of Hillel's AutoComplete component.
Styles are often inherited, so in theory setting the backgroundColor style on the position component or on the AutoComplete is one way to set the value., However, I would expect a "hard coded" style to override such inheritance unless you set it after the component initialized.
Another approach is to modify Hillel's component to expose this value as a style. In theory this isn't that hard; in practice a complicated architecture could make it difficult. More info on creating custom styles.
A third approach is to drill down into the component and set the style. Something like this:
Of course, all the relevant component instances must be public to do so.
A fourth approach might be to use a different component. The Flextras AutoComplete component is a native Spark component and it would be easy to create a custom skin that changes the background color of any of the relevant skin parts.