2 Replies Latest reply on May 22, 2009 3:34 AM by Raja Himanath

    Error 1137: Incorrect number of arguments.

    Raja Himanath

      Hi I have just written a value object class as the code shown below

       

      ValueObject.as

      package mypack

      {

      public class ValueObject

      {

      public function ValueObject(_name:String,empId:String,_isMarried:Boolean,_salary:Number ){

      name=_name;

      this.empId=empId;//this key word is used to avoid naming collision

      isMarried=_isMarried;

      salary=_salary;

      }

      private var name:String;

      private var empId:String;

      private var isMarried:Boolean;

      private var salary:Number;

       

      public function buildObject(obj:Object):ValueObject{

      var vo:ValueObject=

      new ValueObject(obj.name,obj.empId,obj.isMarried,obj.salary);

      return vo;

      }

      public function toString():String{

      return "any value like even your object values";

      }

      }

      }

       

      Now thought of using this in my mxml code

      my mxml code is like this and still i have not completed writing the code but showing error at the object creation line

      the code is

       

      ValueObject.mxml

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:Script>

      <![CDATA[

      import mx.collections.ArrayCollection;

      import mypack.ValueObject;

      public var vobj:ValueObject=new ValueObject("Raja","bits-33",false,15000);//ERROR AT THIS LINE

       

      ]]>

      </mx:Script>

       

      </mx:Application>

      1137: Incorrect number of arguments. Expected no more than 0. is the error it is showing and also I am not able to access any of the method from the vo.as ie from the instance of vobj and I am not getting any methods in the downlist. What might be the cause please help me in solving this.

       

      Thanks in Advance