It looks like your problem is just that you didn't create an instance of your myMXML object before you tried to call the class - that's why the method had to be static.
You have this:
// ActionScript Class
import MXMLPackage
private function callWrite():void{
myMXML.write("My text");
};
Should be this:
// ActionScript Class
import MXMLPackage
private function callWrite():void{
var _myMXML : myMXML = new myMXML();
_myMXML.write("My text");
};
That will work without making the method static. Your problem is that myMXML is the name of a CLASS - not an INSTANCE of the class. You can only call STATIC methods on CLASSES - you can call non-static methods on INSTANCES of the class. To make this more easy to see common convention requires you capitalize the name of classes and not capitalize the first letter for instance variables. This would require you re-name your class as MyMXML, and the code becomes more clearly something like this:
// ActionScript Class
import MXMLPackage
private function callWrite():void{
var _myMXML : MyMXML = new MyMXML();
_myMXML.write("My text");
};
Notice that now even StackOverflow's code formatter realizes that MyMXML is a class name and not an instance and so colors it differently. :)
Here's the short version of what's going on (which others have explained above as well to varying degrees): your application knows about both the class itself and every instance of that class. Every instance gets it's own memory for member variables and things like that and lives a totally separate life from the others. The global class itself can be given static variables that all instances share and static methods that can be called without having to instantiate the class. Static methods are useful for things like utility classes, where you want the class to perform some action and return the result but have no need to keep an instance of the class hanging around in memory. In your example and in every case where you're building a UI related class, you want to create an instance of that method - you should really never try to use an MXML class statically (at least I can't think of a good reason why you would.)
This is the same in every modern OO language such as Java or C#. For a more complete reading on the subject check out some of these discussions on how it works in those languages:
http://leepoint.net/notes-java/flow/methods/50static-methods.html
http://download.oracle.com/docs/cd/E17409_01/javase/tutorial/java/javaOO/classvars.html
http://msdn.microsoft.com/en-us/library/79b3xss3(VS.80).aspx
Hope this helps!