我可以使用SWF(Flash角色动画)同步HTML文本或div吗? [英] Can I sync HTML text or divs with SWF (Flash character animation)?

查看:120
本文介绍了我可以使用SWF(Flash角色动画)同步HTML文本或div吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



现在,我喜欢让我的flash动画角色(700kb)说对话,相关的文字应该弹出并进入页面的html一侧。

我已经使用了 Marnix van Valen&& HTML5的工作酷,他说。但是,闪存怎么办?。

有没有办法做到这一点?提前感谢。

也许你需要从flash文件运行一些代码,有一个很好的工具 - ExternalInterface



例如as3代码:

  class字符{
public function say(msg:String):void
{
trace(msg);
ExternalInterface.call('say',msg);


$ / code $ / pre
$ b $ js html代码在你的swf嵌入的地方:

 < script> 
函数say(msg){
alert('character says:'+ msg);
}
< / script>所以当你运行character.say('嗨'),你会得到一个新的消息在闪光灯控制台(从 trace )并弹出消息。



希望这有助于。


I have flash animation (swf) in my HTML Page.

Now, I like to have my flash animated character (700kb) to speak dialogues, the related text should pop and go in the html side of the page.

I've already used this amazing cool script from Text highlight with audio sync in Jquery by Marnix van Valen & HTML5 works cool as he says. BUT, what about flash???.

Is there any way to do this? thanks in advance.

解决方案

Perhaps you need to run some code from flash file, there is a good tool for it - ExternalInterface

for example as3 code:

class Character {
  public function say(msg:String):void
  {
    trace(msg);
    ExternalInterface.call('say', msg);
  }
}

js code on the html page where your swf embedded:

<script>
function say(msg) {
  alert('character says: ' + msg);
}
</script>

So when you run character.say('hi') you'll get new message in flash console (from trace) and popup with your message.

Hope this helps.

这篇关于我可以使用SWF(Flash角色动画)同步HTML文本或div吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆