本文介绍了Adobe Flash Builder(flex4):addChild()在此类中不可用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  var ldr:Loader =新的Loader(); 
ldr.load(new URLRequest(file:// path / to / fileswf));
ldr.contentLoaderInfo.addEventListener(Event.INIT,loaded);
function loaded(evt:Event):void {addChild(ldr); }

我收到错误:

如果将 addChild()更改为 addElement(),则会收到以下编译错误:

任何想法如何解决这个问题?
在Flash Builder 4完整版中,没有任何this.rawChildren。



最好的解决方案解决问题的方法是将每个所需的类转换为一个flex组件,并在您的flex应用程序中使用它:
$ b


  1. 下载并安装flex组件套件


  2. 创建影片剪辑

  3. b $ b
  4. 转换为flex组件


  5. 将相关函数添加到此类中




  6. 附加到即将转换为flex组件的动画片段的类的框架:

      package {
    import mx.flash.UIMovieC唇;
    import flash.text.TextField;
    import flash.events.Event;
    import flash.events.MouseEvent;
    public dynamic class challenge_screen extends UIMovieClip {

    public function challenge_screen(){
    super();
    }
    }
    }


    I want to load an swf into a flex 4 application in order to use its classes.

    var ldr:Loader=new Loader();
    ldr.load(new URLRequest("file://path/to/fileswf"));
    ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
    function loaded(evt:Event):void { addChild(ldr); }
    

    I receive the error:

    If I change addChild() to addElement(), I receive the following compilation error:

    Any ideas how to resolve this issue?

    解决方案

    well in flash builder 4 full version, there isn't any this.rawChildren.

    The best approach to resolve the issue would be to convert each required class to a flex component and to use it on your flex application:

    1. download and install flex component kithttp://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins

    2. create a movie clip

    3. convert to flex component

    4. add the relevant functions to this class

    a skeleton for a class that is attached to a movieclip that is about to be converted to a flex component:

    package {
    import mx.flash.UIMovieClip;
    import flash.text.TextField;
    import flash.events.Event;
    import flash.events.MouseEvent;
    public dynamic class challenge_screen extends UIMovieClip {
    
        public function challenge_screen() {
            super();
        }
    }
    }
    

    这篇关于Adobe Flash Builder(flex4):addChild()在此类中不可用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:36