JavaScript에서 ActionScript의 함수를 호출하려고하는데, 다른 플래시 파일과 함께이 작업을 성공적으로 수행했지만 현재 어떤 이유로 든 실패하고 있습니다. 내가 jQuery를 SWFEmbed를 사용하고,이 내 JS 코드 :ExternalInterface 콜백이 작동하지 않습니다.
$.ajax({
url: '<?php echo $html->url(array('controller' => 'voicenotes', 'action' => 'get_url'), true);?>' + '/' + container.children('#VoicenoteVnid').val(),
dataType: 'json',
type: 'POST',
success: function(response) {
container.children('.voicenote-info').children('.player').addClass('active');
flashMovie = container.children('.voicenote-info').children('.player');
alert(flashMovie.html());
flashMovie.flash({
swf: '<?php echo $html->url('/files/flash/reproductor_compact.swf',true); ?>',
width: 240,
height: 40,
quality: "high",
wmode: "transparent",
allowscriptaccess: "always",
});
alert($('.player.active > object')[0].callIt());
}
});
그리고 여기에 내 코드,이 내 생성자입니다 :
public function reproductor()
{
ExternalInterface.addCallback("callIt", test);
ExternalInterface.call("alert", "Que fue?");
trace(ExternalInterface.available);
}
을 그리고이 제 기능입니다 :
private function test():String {
return "this is a test";
}
ExternalInterface.call이 작동하고 추적 결과가 true로 출력됩니다. 무슨 일이 일어나는지 전혀 알지 못합니다.
P.S : ExternalInterface 콜백에 매개 변수를 전달할 수있는 방법을 알려 주시면 감사하겠습니다.
다음 [스택 오버플로 대답] (http://stackoverflow.com/questions/7657842/how-to-call-flash-actionscript-callback-method-from-javascript/7657994# 7657994) 특정 문제의 원인이 될 수 있습니다. –