views:

85

answers:

1

Hi All,

I am new Web App development using Flex Builder 3 and currently I am facing the following problem:

Attached is a code snippet from the mxml file:

 <mx:Script>
    <![CDATA[
     import com.bx.Char10;
     import com.bx.A;
            [Bindable] private var inputParam:A = new A()       
            inputParam.CustNumber.char10 = '0123456789'

        }
     ]]>

  </mx:Script>

This Gives a compile error
1120 Access of undefined property inputParam

However if I replace

inputParam.CustNumber.char10 = '0123456789'

with

  private function set():void
    {
     inputParam.CustNumber.char10 = '0123456789'
    }

The compile error goes away.

My Question is : How can I remove this Compilation Error without using the workaround I did?

+1  A: 

Hmm, I don't believe that one can execute arbitrary statements directly inside a class body. (The "Script" tag's contents are treated as if they were directly inside the class body).

Only function definitions or variable property definitions are allowed.

A different work-around to use is to pass the information through the constructor of the variable property you're interested in.

[Bindable] private var inputParam:A = new A('0123456789')
ZackBeNimble