Call to a possibly undefined method test through a reference with static type Class.
here is my class
package com.singleton.sample{
public class SampleSingleton{
public static function test( ):void{
trace('hello world')
}
}
}
and here is my mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
<mx:Script>
<![CDATA[
import com.singleton.sample.SampleSingleton;
public function init():void{
SampleSingleton.test() // error on this line
}
]]>
</mx:Script>
</mx:Application>
Please ignore the singleton references in the naming as I stripped down my class to this and it still doesn’t work.
[EDIT]
import com.singleton.sample.SampleSingleton;
public function init():void{
SampleSingleton.test(); // this gives me the error
com.singleton.sample.SampleSingleton.test(); // this works
}
The Application file is named SampleSingleton i bet so you have a name collision. Rename the application.