错误#1034在运行Flash应用程序应用程序、错误、Flash

2023-09-08 15:23:59 作者:你的名字再不是我的心事

好吧,我知道是因为什么做的addChild()函数,这个错误发生。在框架2.我怎么知道?因为当我删除了code中的片段,一个对象动态放置到它工作正常阶段。误差小于和源$ C ​​$ C帧2是下面的错误消息。 错误code

 类型错误:错误#1034:类型强制失败:无法转换为0〜flash.display.DisplayObject。
    在用于fl.motion :: AnimatorBase /播放()
    在用于fl.motion :: AnimatorBase $ / processCurrentFrame()
    在用于fl.motion :: AnimatorBase / handleEnterFrame()
    在flash.display使用::影片剪辑/ nextFrame()
    在Lemonade_fla :: MainTimeline /开始()[Lemonade_fla.MainTimeline ::帧1:27]
类型错误:错误#1034:类型强制失败:无法转换为0〜
 

FRAME 2 code

  flash.display.DisplayObject。
    停止();
VAR guide_tut:指南=新指南();
的addChild(guide_tut);
//stand.addEventListener(MouseEvent.CLICK,检查);
的addEventListener(Event.ENTER_FRAME,检查);
功能检查(EV:事件):无效{
    cash.text.text = cash1;
    lemons_count.text.text = lemons1;
    cups_count.text.text =杯;
    straws_count.text.text =秸秆;
    ice_count.text.text =冰;


}


shop_mc.addEventListener(MouseEvent.CLICK,shopnow);
功能shopnow(事件:MouseEvent)方法:无效{
    nextFrame();
}
 

解决方案

1)我跑你code正常工作,可能会产生错误的地方是: flash.display.DisplayObject。 应该是:flash.display.DisplayObject; 但你并不需要它。

应用程序错误

VAR guide_tut:指南=新指南(); 的addChild(guide_tut);

我跑它只是一个空的MC,它工作正常。

2)没有理由让(我知道它的注释),但从来没有一个理由, stand.addEventListener(MouseEvent.CLICK,检查)自从检查EnterFrame

基本上是你的错误或者是显示器中,最有可能你不是从扩展影片剪辑的类

公共类指南扩展影片剪辑

代替

影片剪辑也可以是精灵还是其他的DisplayObject ...

Alright, I know that this error is occurring because of something to do with addchild() function. On frame 2. How do I know? Because when I remove the snippets of code that dynamically place an object onto the stage it works fine. The error is below and the source code for frame 2 is below the error messages. Error Code

TypeError: Error #1034: Type Coercion failed: cannot convert 0 to flash.display.DisplayObject.
    at fl.motion::AnimatorBase/play()
    at fl.motion::AnimatorBase$/processCurrentFrame()
    at fl.motion::AnimatorBase/handleEnterFrame()
    at flash.display::MovieClip/nextFrame()
    at Lemonade_fla::MainTimeline/begin()[Lemonade_fla.MainTimeline::frame1:27]
TypeError: Error #1034: Type Coercion failed: cannot convert 0 to 

FRAME 2 CODE

flash.display.DisplayObject.
    stop();
var guide_tut:guide = new guide();
addChild(guide_tut);
//stand.addEventListener(MouseEvent.CLICK, check);
addEventListener(Event.ENTER_FRAME, check);
function check(ev : Event) : void {
    cash.text.text = cash1;
    lemons_count.text.text = lemons1;
    cups_count.text.text = cups;
    straws_count.text.text = straws;
    ice_count.text.text = ice;


}


shop_mc.addEventListener(MouseEvent.CLICK, shopnow);
function shopnow(event:MouseEvent):void{
    nextFrame();
}

解决方案

1) I ran your code it works fine, the only place the error could be generated is: flash.display.DisplayObject. should be: flash.display.DisplayObject; but you don't need it.

and

var guide_tut:guide = new guide(); addChild(guide_tut);

I ran it with just an empty mc, it works fine.

2) no reason to have (i know its commented out) but there never a reason to have stand.addEventListener(MouseEvent.CLICK, check) ever since check is EnterFrame

basically you're error is within either display, most likely you're not extending the class from MovieClip

public class guide extends MovieClip

instead of movieclip it can be sprite or other displayobject...