1

我有以下动作脚本类,当我通过调用 mxml 文件中的构造函数来实例化该类时,我得到“错误 1009 无法访问空对象引用的属性或方法”。为什么我会收到此错误?

package com.esprit.immocr.DTO
{
   import mx.collections.ArrayCollection;   
   [Bindable]
   [RemoteClass(alias="com.esprit.immocr.DTO.TypePieceDto")]
   public class Typ 
   {
       public var code_type_piec:  String;
       public var Libelle_t_piec: String;
       //Association
       public var clientsdto: ArrayCollection;
       public function Typ(o:Object):void
       {
            this.code_type_piec = o.code_type_piec;
            this.Libelle_t_piec = o.Libelle_t_piec;
            this.clientsdto = o.clientsdto;
       }    
    }
}

以及使用此类的以下 mxml 文件

protected function tpvalider(event:MouseEvent):void
{
    //ro.removeEventListener(Event.ADDED_TO_STAGE, tpvalider);
    tp.code_type_piec=codetp.text;
    tp.Libelle_t_piec=libtp.text;
    ro.createTppiece(tp); // ro is a reference to remote object 
}
private  var tp: Typ = new Typ(obj);
4

0 回答 0