本文介绍了使用Javascript / jQuery的的Flash AS3互动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计使用JavaScript(jQuery的)和HTML5,与Flash AS3回落音乐播放器。基本上我想要做的是能够点击HTML控件元素,让他们用闪光灯以播放/暂停和跳过播放列表中的曲目(由JavaScript的读取播放列表JSON文件交互,传递文件ID为AS3,AS3读取另一个JSON文件以获取URL,然后播放音频)

I am designing a music player using JavaScript (jQuery) and HTML5, with Flash AS3 to fall back. Basically what I want to do is to be able to click HTML control elements and have them interact with the flash in order to play/pause and skip tracks in the playlist (playlist JSON file read by JavaScript, passes file ID to AS3, AS3 reads another JSON file to get URL, then plays audio)

这使我只能用Flash来播放音频,这样就产生了相同的用户体验,无论HTML5浏览器的支持。

This enables me to only use the Flash to play the audio, thus creating the same user experience regardless of HTML5 browser support.

我假设我将不得不'听'在AS3的事件,然而,在怎么搞的​​JS这些事件并做出反应的AS3事件的任何指针将是一个很大的帮助!

I'm assuming I will have to 'listen' for events in AS3, however any pointers in how to engage these events in JS and react to the events in AS3 would be a great help!

推荐答案

要的JavaScript和ActionScript之间的通信,可以使用ExternalInterface API:

To communicate between JavaScript and ActionScript, you can use the ExternalInterface API:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

至于你想要的东西替代的事,你可以使用SoundManager类2播放音频,做你自己的编程中的JavaScript:

As an alternative for what you want to do, you could use SoundManager 2 to play the audio, and do all of your own programming in JavaScript:

使用HTML5和Flash,SoundManager类2提供了可靠的跨平台  一个JavaScript API下的音频。

http://www.schillmania.com/projects/soundmanager2/

这篇关于使用Javascript / jQuery的的Flash AS3互动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 03:59