I’m having a slight issue with ActionScript 3 and I have come here to ask for some help.
I have two classes. One called Sledge and one called Sock, there is also the document class called Main.
My issues are as follows:
-
Inside of
Sledge, I call a function that is defined inside of theMaindocument class. How would I go about telling the class to go to the document class and run that function? Would this also be the same for other classes or just for the document class? -
Inside
Sledge, I have the following statement:if(hitTestObject(sock.myHitArea)) { /* somecode*/ }sockis an instance of another seperate class, and by this point has already been created. However when I try and run this I am told it is not defined. How would i go about solving this?
There’s some ambiguity issues with how you expressed your question. It would help if you posted a short form of the code for the problem.
However, I’ll try to answer the first question:
You would want to pass the Main class to the Sledge class or use events which is preferable. If pass the class it will look like this…
Or if using events: