you forgot to instantiate the object.

Change:
var test:testClass;
to
var test:testClass = new testClass();

and it should work.

Regards,

Frederico Garcia

On Tue, 01 Jan 2008 14:45:00 -0500, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> 
> This compiles but when you hit the test button, it says
> 
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
>     at Main/test()
>     at Main/__b1_click()
> 
> Can anyone explain what this means ? It totally does not make any sense
> to me.
> 
> 
> 
> 
> 
>  >>>>>>main.mxml:
> <?xml version="1.0"?>
> 
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
>     <mx:Script source="MainCode.as"/>
>     <mx:Button id="b1" label="Test" click="test();"/>
> 
> </mx:Application>
> 
>  >>>>>>MainCode.as:
> Public function test():void
> {
>     var test:testClass;
>     test.justtesting();
> 
> }
> 
>  >>>>>>testClass.as:
> package  {
>     public class testClass {
>         public function testClass() {
> 
>         }
>         public function justtesting():void {
>             trace("just testing");
>         }
>     }
> 
> }
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
> 
> 
> 

Reply via email to