I have an interface that contains audio controls in the Library (class: AudioControls)
When a movie is loaded into the interface, and it happens to contain a sound (class: Audio_1), this loaded movie calls an interface function to show the audio controls:
if (Interface._ui != null) {
Interface._ui.playCurrentAudio();
}
The problem is, the playCurrentAudio() func in the interface contains some code that refers to nested MCs:
public function showAudioControls():void {
audioControls.x = 710;
audioControls.y = 583;
//
audioControls.speaker.stop();// Stop timeline animation
audioControls.rewind_btn.audioBtnPulse.stop();// Stop timeline animation
audioControls.playPause_btn.audioBtnPulse.stop();// Stop timeline animation
//
audioControls.playPause_btn.gotoAndStop("off");
audioControls.speaker.gotoAndPlay("on");
//
audioControls.rewind_btn.buttonMode = true;
audioControls.rewind_btn.useHandCursor = true;
audioControls.rewind_btn.mouseChildren = false;
//
audioControls.playPause_btn.buttonMode = true;
audioControls.playPause_btn.useHandCursor = true;
audioControls.playPause_btn.mouseChildren = false;
//
audioControls.rewind_btn.addEventListener(MouseEvent.CLICK, replayCurrentAudio);
audioControls.rewind_btn.addEventListener(MouseEvent.MOUSE_OVER,rewindRollOver);
audioControls.rewind_btn.addEventListener(MouseEvent.MOUSE_OUT,rewindRollOut);
audioControls.playPause_btn.addEventListener(MouseEvent.CLICK, pauseCurrentAudio);
audioControls.playPause_btn.addEventListener(MouseEvent.MOUSE_OVER,playPauseRollOver);
audioControls.playPause_btn.addEventListener(MouseEvent.MOUSE_OUT,playPauseRollOut);
//
addChild(audioControls);
//
var yPosTween:Tween = new Tween(audioControls, "y", Strong.easeOut, 583, 532, 0.40, true);
}
public function playCurrentAudio():void {
showAudioControls();
voiceOver = new Audio_1();
soundControl = voiceOver.play(0,1);
soundControl.addEventListener(Event.SOUND_COMPLETE,audioComplete);
}
That would be the speaker, rewind_btn, playPause_btn, etc. Referring to the parent clip, “audioControls”, is no problem of course. But I get an error when I publish the loaded movie:
1119: Access of possibly undefined property speaker through a reference with static type AudioControls.
1119: Access of possibly undefined property rewind_btn through a reference with static type AudioControls.
1119: Access of possibly undefined property playPause_btn through a reference with static type AudioControls.