需求描述
因为electron加载swf,导致在全屏状态下,swf中的拖拽动画无法拖动,经过测试,如果全屏在H5控制,就能让swf拖拽动画正常使用。所以开始研究
两个AS同事研究AS,我一个人研究H5
上代码
// 需要两个文件,一个是js,一个是支持as和js交互的swf
// 作用,js是用来生成加载swf的代码,准确的是说一个html,代码如下
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<style type="text/css">
body {
margin: 0px;
text-align: center;
}
#flashcontent{
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<div id="showTxt"></div>
<div id="flashcontent" style="width: 100%; height: 100%;"></div>
<script type="text/javascript">
// 获取到页面的dom元素用于控制全屏
var content = document.documentElement
// 这是as和js交互的方法,as会掉用这个方法,需要as在swf中实现这个方法,这个方法是接受参数的,这样可以判断状态,具体是打开全屏还是退出全屏,参数是as传过来的
function asCallJsFullScreen (meg) {
console.log('aaaaaaaaaaaaaaaaa')
console.log(meg)
if (meg == "FULL_SCREEN") {
// this.btnj()
console.log('1111111')
//打开 全屏的方法
fullScreen(content)
// requestFullScreen(document.documentElement);
} else if (meg == "FULL_SCREEN_NORMAL") {
console.log('22222222222222')