I'm sure this has been posted about before: any help would be appreciated.
I have a document root as follows:
package{ import childSound; import flash.display.MovieClip;
public class Main extends MovieClip{
private var cs:childSound;
public function Main(){
cs = new childSound();
}
public function superTrace(msg:String):void{
trace(msg);
}
}
}
That imports the following class
package{ import flash.media.Sound; public class childSound extends Sound{ public function childSound(){ Main(root).superDebug("TestThis"); } } }
Is it possible to call a function in the documentroot from a class that isn't "addChild"ed? Can I do something like add text to a text box from the childSound class instead of a display object (say for debugging a netStatus event or something)
in your example Main creates an instance of the childSound class - that's a one-way conversation there: Main can get childSound to do things and it can know stuff about childSound because it instantiated it - but childSound can't know about whatever it was that instantiated it.
There must be some OOP words to describe that, but I can't think what they are right now 
What I would do here is to make childSound so it can broadcast events (implements IEventDispatcher), then Main can listen for those events. E.g. childSound could broadcast an event NETSTATUSUPDATED which would send over some data about what happened to netStatus, and Main could listen for that event. When the event happens, Main then reacts by drawing that text box itself and fills it with the text sent in the event from childSound.
Add an event listener to cs instance, and create a custom event in you sound class that dispatches whatever ya need.
The man doc eventhandler you have added to you custm event listener will do whatever ya need