Reputation: 3828
I am very FRESHLY new to packages so forgive my simple question. How do I initialize the docTwo class and constructor function? I figured out how to call a static function from the main class but not to init another class. Thanks
myDocClass.as
package {
import flash.display.MovieClip;
import docTwo;
public class myDocClass extends MovieClip
{
var Hello:String = "Hi there";
public function myDocClass ()
{
trace("And all the people said... " + Hello);
docTwo.docTwo(); /// Does NOT WORK. How do I call this or init class?
thisWorks();
// Below call Works
docTwo.docTwoFunction();
}
public function thisWorks()
{
trace("Cool Beans! This one worked");
}
}/// end of Class
}
docTwo.as
package {
import flash.display.MovieClip;
public class docTwo{
public function docTwo()
{
trace("Trying to get this to work!");
docTwoFunction(); // How do I call this from here?
}
static public function docTwoFunction()
{
trace("I am inside docTwo. Woo hoo!");
}
}
}
Upvotes: 0
Views: 697
Reputation: 42166
Try to change your myDocClass
like this:
public class myDocClass extends MovieClip
{
var Hello:String = "Hi there";
var myDocTwo:docTwo ;
public function myDocClass ()
{
trace("And all the people said... " + Hello);
myDocTwo = new docTwo();
...
...
Note , they're both placed in the same package.
Upvotes: 2