最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to interact with Flash via Javascript? - Stack Overflow

programmeradmin0浏览0评论

At this moment there is a very basic flash project that connects to a rtmp server and streams video&audio from webcam. It creates a stream from a user with a certain name.

Also in same project there is an input for a stream name that other entity can stream. Therefore you get Skype alike video-chat with flash.

In flash I can control when I want to start publishing own stream and when want to play someone else's stream.

I am trying to figure out how I can control Flash Functions (StartPublish, StartStream, etc) via Javascript.

I am looking at and would like to know if I am on right path.

At this moment there is a very basic flash project that connects to a rtmp server and streams video&audio from webcam. It creates a stream from a user with a certain name.

Also in same project there is an input for a stream name that other entity can stream. Therefore you get Skype alike video-chat with flash.

In flash I can control when I want to start publishing own stream and when want to play someone else's stream.

I am trying to figure out how I can control Flash Functions (StartPublish, StartStream, etc) via Javascript.

I am looking at http://osflash/projects/flashjs and would like to know if I am on right path.

Share Improve this question asked Jun 12, 2011 at 1:16 jM2.mejM2.me 3,99912 gold badges46 silver badges58 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

http://livedocs.adobe./flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

The ExternalInterface class is designed specifically for this purpose. It's a relatively simple class for exposing actionscript functions to JS or vice versa. I recently implemented it in an audio player my team developed to have an HTML formatted tracklist trigger play and stop events.

Essentially, you can make your code first check against ExternalInterface.available to make sure the container has an external interface (IE in a browser window with javascript and not just running from flash player.) From there, you can use addCallback to designate a function that can then be called on the flash applet's container.

You can then call it using the typical javascript - just access the method off of the container using getElementByID or whatever selector flavor you prefer if you're using a framework.

Make sure your embed method allows script access to the flash applet as well.

发布评论

评论列表(0)

  1. 暂无评论