Flex 3:TypeError #2007 &深度链接

发布于 2024-09-25 05:33:08 字数 1378 浏览 2 评论 0原文

当应用程序启动时,我收到 Flex 错误 #2007。

TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/getChildIndex()
    at mx.core::Container/getChildIndex()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2411]
    at mx.containers::ViewStack/set selectedChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:557]
    at property/parseUrl()[/Users/myname/Documents/Flex Builder 3/property/src/property.mxml:8803]
    at property/initBrowserManager()[/Users/myname/Documents/Flex Builder 3/property/src/property.mxml:8749]
    at property/___property_Application1_creationComplete()[/Users/myname/Documents/Flex Builder 3/property/src/property.mxml:19]

我正在尝试让深度链接正常工作。 Adobe Flex 论坛上的 Bhasker Chari 非常友善地帮助我编写了以下代码:

private function parseUrl(e:BrowserChangeEvent = null):void {


  var o:Object = URLUtil.stringToObject(browserManager.fragment);

  var j:Object = o.view;

  var f:String = String(j);

  var c:String = f.replace(/-/g,"_");

  var t:Container = mainViewStack.getChildByName(c) as Container;

  mainViewStack.selectedChild = t;
  }

基本上,我采用 browserManager.fragment,将其转换为字符串,用下划线替换破折号,将其转换为容器,然后使用它来在 mainViewStack 上设置 selectedChild。

但是,当它初始化时,它说没有子参数。我该如何解决这个问题?

谢谢。

-拉克斯米迪

I'm getting Flex error #2007, right when the app starts up.

TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/getChildIndex()
    at mx.core::Container/getChildIndex()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2411]
    at mx.containers::ViewStack/set selectedChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:557]
    at property/parseUrl()[/Users/myname/Documents/Flex Builder 3/property/src/property.mxml:8803]
    at property/initBrowserManager()[/Users/myname/Documents/Flex Builder 3/property/src/property.mxml:8749]
    at property/___property_Application1_creationComplete()[/Users/myname/Documents/Flex Builder 3/property/src/property.mxml:19]

I'm trying to get deeplinking to work properly. Bhasker Chari on the Adobe Flex forum was kind enough to help me with the code below:

private function parseUrl(e:BrowserChangeEvent = null):void {


  var o:Object = URLUtil.stringToObject(browserManager.fragment);

  var j:Object = o.view;

  var f:String = String(j);

  var c:String = f.replace(/-/g,"_");

  var t:Container = mainViewStack.getChildByName(c) as Container;

  mainViewStack.selectedChild = t;
  }

Basically, I take the browserManager.fragment, convert it to a string, replace the dash with an underscore, convert it to a container, and use that to set the the selectedChild on the mainViewStack.

But, when it initializes, it says that there is no child parameter. How can I solve this problem?

Thank you.

-Laxmidi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

南风几经秋 2024-10-02 05:33:08

好吧,

我明白了。我需要添加:

if(t!=null){mainViewStack.selectedChild = t}
else{mainViewStack.selectedIndex = 0}

子级尚未创建。

谢谢。

-拉克斯米迪

Okay,

I figured it out. I need to add:

if(t!=null){mainViewStack.selectedChild = t}
else{mainViewStack.selectedIndex = 0}

The children hadn't been created, yet.

Thank you.

-Laxmidi

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