【问题标题】:Ambigous reference when using the CodeBehind pattern使用代码隐藏模式时的不明确引用
【发布时间】:2011-04-02 07:12:55
【问题描述】:

我在尝试绑定属性时遇到了不明确的引用错误。代码如下:

MXML

<?xml version="1.0" encoding="utf-8"?>

<custom:Test
    xmlns:mx        = "library://ns.adobe.com/flex/mx"
    xmlns:fx        = "http://ns.adobe.com/mxml/2009" 
    xmlns:custom    = "CodeBehind.*">

    <mx:TextInput id = "foo" text = "foo!">
    </mx:TextInput>

    <mx:TextInput id = "bar" text = "{foo}">
    </mx:TextInput>

</custom:Test>

代码隐藏

package CodeBehind
{
    import mx.containers.Panel;

    public class Test extends Panel
    {

    }
}

这是错误本身:

/Front/Test.mxml(-1):  Error: Ambiguous reference to Test.

<?xml version="1.0" encoding="utf-8"?>

奇怪的是,它甚至没有提到绑定属性...

【问题讨论】:

    标签: apache-flex actionscript-3 mxml code-behind


    【解决方案1】:

    好的,我已经设法解决了。我将 Front/Test.mxml 重命名为 Front/TestDisplay.mxml,这样就成功了 - 不再有模棱两可的引用。

    【讨论】:

      【解决方案2】:

      我无法重现该错误。一切都在 FB4 中编译。
      我认为结构是

      前面
      -> |测试.mxml
      代码隐藏
      -> |测试.as

      可能的选择:

      • 检查您的文件夹/包结构
      • 是否还有其他以Test 为名称的文件或自动生成的文件?
      • 我看到其他人的 Flex Builder 构建不佳,因此请尝试清理项目集。

      【讨论】:

      • 我使用 AMXMLC 从命令行编译,而不是 IDE。确切地说是 Air 2.5 SDK。我也在运行 Linux(以防万一)。是的,文件夹结构是正确的——确切地说是 appNameRoot/CodeBehind 和 appNameRoot/Front。
      猜你喜欢
      • 1970-01-01
      • 2011-07-28
      • 2015-12-12
      • 2013-03-02
      • 1970-01-01
      • 2015-08-13
      • 2014-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多