I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on). For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf.
HOW do I reference the Main class? I can’t find a way.
Someone suggested me to use Events.
He said I could use a class similar to this one in the child swf:
package {
import flash.events.Event;
public class QuestionAnsweredEvent extends Event {
public static const QUESTION_ANSWERED:String = "QuestionAnswered";
public var data:*;
public function QuestionAnsweredEvent(type:String, data:*) {
this.data = data;
super(type, true);
}
}
}
and dispatch an Event this way from the loaded swf document class to the Main class:
dispatchEvent(new QuestionAnsweredEvent(QuestionAnsweredEvent.QUESTION_ANSWERED, questionData));
Now, first of all I don’t know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.
Could you please suggest me a way to do what I should do?
Thanks!