Copy link to clipboard
Copied
Hi, I have created one flash as3 (main.fla) file with next, previous buttons and I have loaded one child swf (firstchild.swf) file into main file. In child swf also I have loaded another child swf (grandchild.swf) [grand child to main file]. I have disabled the next button in main.fla file and trying to enable the button from grandchild.
My coding look like:
main.fla:
next_btn.mouseEnabled = false;.
grandchild.fla:
I have tried two scirpts:
but any one of them doesn't works for me. can any one help me to solve my problems.
Thanks in advance........
Note: Output says...
TypeError: Error #1010: A term is undefined and has no properties.
at grandchild_fla::MainTimeline/frame1()[grandchild_fla.MainTimeline::frame1:1]
Copy link to clipboard
Copied
If that is line 1 of the grandchild's code then it appears you do not need to have it in the grandchild and could have it execute in the child instead when it loads the grandchild.
A proper way of having a child talk to a parent is to just have the child dispatch an event for which the parent (main file) assigns a listener when that child is first loaded. Example:
Add something to trigger the event in the child:
dispatchEvent(new Event("eventTriggered"));
In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo. In the complete event handler, add a listener for the event on the loaded swf.
// event handler triggered when external swf is loaded
function loaderCompleteHandler(event:Event) {
MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
}
function eventHandler(event:Event):void {
trace("event dispatched in loaded swf");
}
Copy link to clipboard
Copied
Hi Ned,
Thanks for your information. But what my problem is firstchild.swf was published through captivate and it is a quiz. After submitting the quiz only I need to enable the next button. For that purpose I have loaded one flash swf file (grandchild.swf) into captivate. I have written one trace function on grandchild.swf time line and its working fine but I am unable to access the next button of main file or any other functions.
If there is any other methods for communicating with captivate quiz submit button, please tell me. Because I am learner, please help me to rectify this problem.
Thanks again for giving response for my question.
Copy link to clipboard
Copied
Have you tried tracing the MovieClip(root) reference to see what it comes up as? I am guessing that when the file loads it has not yet been able to define a root before that line of code tries to execute. You might need to use an ADDED_TO_STAGE event listener and wait until that event occurs before you try to target the root.
Copy link to clipboard
Copied
I don't think Captivate lets you get that fancy. This question is probably better answered on the Captivate forum.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now