【问题标题】:TypeError: Error #1034: Type Coercion failed:TypeError:错误#1034:类型强制失败:
【发布时间】:2013-05-18 08:03:23
【问题描述】:

尝试在我的文件中加载 swf,但出现以下错误:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@32264f91 to flash.display.Loader.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at ComicBook_003_fla::MainTimeline()

这是我的代码:

var loader:Loader = new Loader();
loader.load(new URLRequest("Avoider.swf"));

loader.x = 100;
loader.y = 100;

addChild(loader);

【问题讨论】:

  • 这是在一个已经被加载到另一个 swf 中的 swf 中吗?您是否有自己的名为 Loader 的类可能会发生冲突?
  • 是的,我做到了,但我改变了一切
  • 好吧,我一定错过了什么,因为我决定更改我提供的加载器并且它工作了

标签: actionscript-3 flash loader


【解决方案1】:

您在Avoider.swf 中似乎有错误,而不是在您当前的代码中。您似乎在影片剪辑上使用加载器函数。

【讨论】:

    【解决方案2】:

    您正在尝试使用 addChild 方法将 Loader 作为参数传递。尝试使用加载器的“内容”属性(即 DisplayObject)。此外,请等到加载完成后再对您的内容执行任何操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-04
      相关资源
      最近更新 更多