Flex Error: Call to a possibly undefined method


I spent a lot of time finding why I am getting "Call to a possibly undefined method" even though it was defined in my class. I came to conclusion that :

"Never ever declare a variable with a name similar to namspace/package name."

Here is a nice supportting example:

1) Lets say you have a Flex application which contains a Main.mxml at root.
2) Create a class HelloExample.as in a package config (i.e. config/HelloExampl.as) and declare a function sayHello() which just says "Hi".
3) Declare a varibale with name "config" in Main.mxml and try to call the method sayHello() and you'll get this error.

There are other cases as well when you'll get this error, but I thought it is worth mentioning here because its not easy to find. I hope this will help some one.


Popular posts from this blog

Sling Authentication

CQ Development - OSGi bundles and Components

Create an AEM (CQ) project using Maven

Multiple log files using log4j appender