By -
Christen
富媒体广告默认静音
富媒体广告默认开启声音,会给用户带来困扰,希望实现以下改进:
- 默认静音
- 用户可手工启动声音
素材的主体部分是内嵌的flv视频,播放和加载都不是通过代码控制,要默认静音并手工开启,只能通过全局声音来控制。
代码没什么惊喜:
/** AS 2.0 */ //全局声音 var mysound = new Sound(); mysound.setVolume(0); //开启声音按钮 sound_btn.onRelease = function() { mysound.setVolume(100); };
/** AS 3.0 */ import flash.events.MouseEvent; //player 为 FLVPlayback 实例名 player.volume = 0; sound_btn.addEventListener(MouseEvent.CLICK, playSound); function playSound(e:MouseEvent){ player.volume = 1; }
效果:这里 (链接有防盗链保护,请复制链接,手工打开)
这只是一个粗糙的例子,细节可再完善。
附:AS 2.0 Button 方法参考
来自:Adobe
Event | Description |
---|---|
onDragOut = function() {} | Invoked when the mouse button is clicked over the button and the pointer then dragged outside of the button. |
onDragOver = function() {} | Invoked when the user presses and drags the mouse button outside and then over the button. |
onKeyDown = function() {} | Invoked when a button has keyboard focus and a key is pressed. |
onKeyUp = function() {} | Invoked when a button has input focus and a key is released. |
onKillFocus = function(newFocus: Object) {} | Invoked when a button loses keyboard focus. |
onPress = function() {} | Invoked when a button is pressed. |
onRelease = function() {} | Invoked when a button is released. |
onReleaseOutside = function() {} | Invoked when the mouse is released while the pointer is outside the button after the button is pressed while the pointer is inside the button. |
onRollOut = function() {} | Invoked when the pointer moves outside a button area. |
onRollOver = function() {} | Invoked when the pointer moves over a button area. |
onSetFocus = function(oldFocus: Object) {} | Invoked when a button receives keyboard focus. |
2 thoughts on “富媒体广告默认静音”
陈自新 December 25, 2014 at 12:40 pm
犀利的在线反编译工具:http://www.showmycode.com/
Reply浏览代码足矣,只是反编的 AS2.0 代码,没有大小写区分了,其它的待测。
陈自新 December 25, 2014 at 5:53 pm
AS 3.0 在线文档:Adobe Docs
Reply