1.html代码
------------------------------
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="myswf" width="510" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<param name="movie" value="../images/flash.swf" />
<param name=FlashVars />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="images/flash1.swf" quality="high" wmode="transparent" width=510 height=510 name=flashvars type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>
</embed>
</object>
</div><script language="javascript" type="text/javascript">
function btnOK() {
thisMovie("myswf").begin();
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName]
}
}
</script>
----------------------------------------2.这是flash中的脚本
------------------------------------------
//导入ExternalInterface类
import flash.external.ExternalInterface;
//这个参数是说js里调用as里的函数名
var methodName:String = "begin";
//这个是在该方法中被解析的对象,就是函数里的this 指向谁
var instance:Object = null;
//允许js中的flAlert()调用flash中的showAlert()
ExternalInterface.addCallback(methodName,instance,start);function start()
{
btnWait._alpha = 100;
btnStart._alpha = 0;
btnSuc._alpha = 0;
btn_mc._visible = false;
if (count < turns)
{
_root.pointer._rotation = _root.pointer._rotation + 12 * count;
if (_root.pointer._rotation == 0)
{
count = count + 1;
} // end if
}
else if (count2 > 0)
{
_root.pointer._rotation = _root.pointer._rotation + 12 * count2;
if (_root.pointer._rotation == 0)
{
count2 = count2 - 1;
} // end if
}
else
{
_root.pointer._rotation = _root.pointer._rotation + 12;
if (_root.pointer._rotation == 360 / totleNum * (stopNum - 1) || _root.pointer._rotation == 360 / totleNum * (stopNum - 1) - 360)
{
_root.pointer._rotation = 360 / totleNum * (stopNum - 1);
clearInterval(t);
btnSuc._alpha = 100;
btnWait._alpha = 0;
getURL("javascript:flashOver(" + stopNum + ")", "");
} // end else if
} // end else if
} // End of the function------------------------------
我这样写的调不了start方法,试了好多次都不行
------------------------------
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="myswf" width="510" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<param name="movie" value="../images/flash.swf" />
<param name=FlashVars />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="images/flash1.swf" quality="high" wmode="transparent" width=510 height=510 name=flashvars type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>
</embed>
</object>
</div><script language="javascript" type="text/javascript">
function btnOK() {
thisMovie("myswf").begin();
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName]
}
}
</script>
----------------------------------------2.这是flash中的脚本
------------------------------------------
//导入ExternalInterface类
import flash.external.ExternalInterface;
//这个参数是说js里调用as里的函数名
var methodName:String = "begin";
//这个是在该方法中被解析的对象,就是函数里的this 指向谁
var instance:Object = null;
//允许js中的flAlert()调用flash中的showAlert()
ExternalInterface.addCallback(methodName,instance,start);function start()
{
btnWait._alpha = 100;
btnStart._alpha = 0;
btnSuc._alpha = 0;
btn_mc._visible = false;
if (count < turns)
{
_root.pointer._rotation = _root.pointer._rotation + 12 * count;
if (_root.pointer._rotation == 0)
{
count = count + 1;
} // end if
}
else if (count2 > 0)
{
_root.pointer._rotation = _root.pointer._rotation + 12 * count2;
if (_root.pointer._rotation == 0)
{
count2 = count2 - 1;
} // end if
}
else
{
_root.pointer._rotation = _root.pointer._rotation + 12;
if (_root.pointer._rotation == 360 / totleNum * (stopNum - 1) || _root.pointer._rotation == 360 / totleNum * (stopNum - 1) - 360)
{
_root.pointer._rotation = 360 / totleNum * (stopNum - 1);
clearInterval(t);
btnSuc._alpha = 100;
btnWait._alpha = 0;
getURL("javascript:flashOver(" + stopNum + ")", "");
} // end else if
} // end else if
} // End of the function------------------------------
我这样写的调不了start方法,试了好多次都不行
但是 js的写法好老
as 还是2.0的语法估计有flash的兄弟都是玩3.0的了 想帮你调试都不大可能我这里有个资源 里面有js 调用as as调用 js的方法如果你有 flash编辑器 (必须支持as3.0)
可以到 页面在出事化的时候就是js掉as 的init方法http://download.csdn.net/download/wtcsy/4888375
php看不懂啊。也没看到JS的代码
然后 记住要在本地的服务中运行 直接打开运行掉不到<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<style>
#c{ text-align:left; font-size:12px;}
#c div.btn{ width:90px; height:30px; border:1px solid #9C9C9B; background:url(btn.gif) 0 0 no-repeat;}
#c div.btn:hover{ background:url(btn.gif) 0 -30px no-repeat}
#c .file{width:90px; height:30px; opacity:0; cursor:pointer;}
#c .bar{
width:350px; display:none; padding:0 5px 5px; background:#FFFFE1; border:1px solid #9C9C9B; margin-top:10px;
}
#c .list{ overflow:hidden; margin-top:5px; position:relative}
#c .loadbar{ width:100px; height:10px; overflow:hidden; border:1px solid #9C9C9B; float:left; margin-right:5px;}
#c .bai{ float:left; display:inline-block;_zoom:1;*display:inline; width:35px; margin-left:10px; }
#c .info{float:left; height:14px; display:inline-block;_zoom:1;*display:inline; width:165px;overflow:hidden;word-break: break-all;word-wrap: break-word;}
#c .block{ width:0; height:10px; background:#9C9C9B;}
#c a{color:#2D5169; position:absolute; right:5px; top:0;}
</style>
<body><div id="c">
</div><script language="javascript" type="text/javascript">
(function(doc){
var window = this;
var _extend = function(obj,o){
for(var name in o){
obj[name] = o[name];
}
}
var _$q = function(name,p){
return p.getElementsByTagName(name);
}
var _$c = function(name,p){
var elem = doc.createElement(name);
p&&p.appendChild(elem);
return elem;
} window.upload = {
options : {
maxSize : 35, //30m的意思
message : "文件不能超过{size}m"
},
init : function(options){
_extend(this.options,options);
_extend(this,this.options);
if(!this.elem || !this.elem.nodeName){
return;
}
var t = new Date().getTime();
var ie = doc.all,
self = this;
if(ie){
this.elem.innerHTML = [
"<object id='flash_z' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='90' height='30'>",
"<param name='FlashVars' VALUE='' />",
"<param name='wmode' value='transparent'/>",
"<param name='Movie' value='upload.swf?"+t+"' />",
"<param name='Src' value='upload.swf?"+t+"' />",
"<param name='WMode' value='Window' />",
"<param name='Scale' value='NoScale' />",
"<param name='BGColor' value='#cccccc' />",
"<param name='AllowNetworking' value='all' />",
"<param name='AllowFullScreen' value='true' />",
"<param name='AllowScriptAccess' value='always' />",
"</object><div class='bar'></div>"
].join("");
this.flash = this.elem.childNodes[0];
this.bar = this.elem.childNodes[1];
this.flash.style.display = "none";
this.flashComplete = function(){
alert("弹出了这个 说明as 调用了 js"); //看这里
this.flash.style.display = "block";
this.flash.init(this.url+"_____"+this.maxSize); //这里是js调用as的
}
}
}
}
})(document);
upload.init({
elem : document.getElementById("c"),
url : "upload.php",
maxSize : 30
});
</script></body>
</html>
----------------- *绑定方法star,要显示声明为public才行吧,
*addCallback只有二个参数我记得