在自动完成的Flex 4.0不显示在下拉列表中的项目自动完成、项目、列表中、Flex

2023-09-08 15:28:25 作者:相见不如怀念

我是新来的弯曲,动作和Flash Builder(一定要进行升级,以现有的项目)。

I am new to flex, actionscript and flash builder (having to do an upgrade to an existing project).

一个我似乎有问题的是,这似乎是弯曲的额外的一部分自动完成组件未显示在下拉列表中的项目列表。基本上,我得到的空白项的列表。我知道他们在那里,他们是正确的项目,因为当我点击一个,我得到的组合框右侧的文本。

One of the problems I seem to have is that the Autocomplete component that seems to be part of flex extras is not displaying the list of items in the dropdown list. Basically, I get a list of blank items. I know they are there and they are the right items because as soon as I click on one, I get the right text in the combobox.

我的code在MXML看起来像这样

my Code in the mxml looks something like this

<mx:FormItem label="Company:" width="750" fontSize="20" horizontalAlign="right" color="#000000" required="true">
    <ns1:AutoComplete enabled="true" labelField="CompanyName" textAlign="left" dropdownWidth="450" id="txtCompany" width="450"  />
</mx:FormItem>

在加载窗体时,作为初始化一个Web服务调用时的一部分,结果从该呼叫被设置为数据提供器像这样上面的自动完成框中的动作

In the actionscript when the form loads, as part of the initialization a webservice call is made and the results from that call are set as the dataprovider for the above AutoComplete box like so

public function handleGetCompanyResult(event:ResultEvent):void{
    txtCompany.dataProvider = event.result;
}

正如我所说的,当我输入在文本框中输入一个字母,我看到一个DropDownList上留下了滚动条,但它看上去是空的。当我点击的项目之一,我看到的文本框中输入相关的公司名称。当我设置一个断点event.result是proxyObjects的ArrayCollection。

As I said, when I type a letter in the text box, I see a dropdownlist with a scroll bar on the left but it looks empty. When I click on one of the items, I see the associated company name in the text box. When I set a breakpoint the event.result is an ArrayCollection of proxyObjects.

我试图改变它,并把一些虚拟数据,像这样

I tried to change it and put some dummy data like so

public function handleGetCompanyResult(event:ResultEvent):void{
            var companyList:ArrayCollection = ArrayCollection(event.result);
            var displayCompanyList:ArrayCollection = new ArrayCollection();

            displayCompanyList.addItem({CompanyName:"Test1"});
            displayCompanyList.addItem({CompanyName:"Test2"});
            displayCompanyList.addItem({CompanyName:"Test3"});

            txtCompany.dataProvider = displayCompanyList;
}

同样,当我在文本框中输入T我看到一个下拉列表中有3个空项。点击第三项所说Test3的在文本框中。但项本身是不可见的。

Again, when I type "T" in the text box I see a dropdown list with 3 empty items. Clicking on the third item puts "Test3" in the textbox. But the items themselves are not visible.

它几乎一样,如果它的字体/前景色的事情,但我已经对其中的一些设置也没有成功发挥各地。

It almost as if its a font/foreground color thing, but I've played around with some of those settings too with no success.

任何帮助将是非常美联社preciated。

Any help would be much appreciated.

推荐答案

好了,原来的项目是被导入到Flex 4。它的工作原理,其中它确实和分解它不Flex 3项目。我创建了一个简单的Flex 4项目,一个提示框,它的工作。我慢慢地我所有的code传达给这个项目和它的工作。它给了我一个关于有关无法使用或类似的东西的风格标签警告。我只是删除了所有的风格标签,它能正常工作。它看起来不一样,所以我必须要摆弄它多一点,但至少在文字出现了。因此,一些做的主题和使用它们在编译时Flashbuilder编译器。

Ok, turns out the project was a Flex 3 project that was imported into Flex 4. It works where it does and breaks down where it doesn't. I created a simple Flex 4 project with an alert box and it worked. I slowly moved all my code across to this project and it worked. It gave me a warning about the styles tag about not being able to use or something like that. I just removed all of the style tags and it worked fine. It doesn't look the same, so I have to fiddle with it a bit more, but at least the text showed up. So something to do with the themes and the Flashbuilder compiler using them at compile time.

所有我要说的是一个蹩脚的工具。如果进口没有工作,它应该已经完全很久以前失败。我搜索和搜索均与CSS或样式或主题,任何项目文件或code文件。但显然它使用的东西,是我独立的项目来控制我的项目的一些微小的部分(县)。在我的项目控制的参数基本上依赖于一些环境/ IDE因素。什么是痛苦的调试。

All I have to say is what a crappy tool. If the import didn't work, it should have failed completely ages ago. I searched and searched for any projects files or code files that were related to css or styles or themes. But clearly it was using something that was independent of my project to control some tiny part(s) of my project. The parameters of controls in my project were essentially dependent on some environmental/ide factors. What a pain to debug.