万分火急!请教高手一个问题!!!

周小山 2012-08-20 11:23:13
与php交互,浏览器能接收到值,但flash不播放动画,而且重复加载该swf文件

下面是flash的代码,请高手看看有什么问题吗?我自己看了一下午也没找出问题在哪里???非常感谢!!!!

stop();

import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.SimpleButton;
import flash.text.TextField;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.external.ExternalInterface;
import com.greensock.*;
import com.greensock.easing.*;

var box0:SimpleButton;
var box1:SimpleButton;
var box2:SimpleButton;
var box3:SimpleButton;
var box4:SimpleButton;
var mov0:MovieClip;
var mov1:MovieClip;
var mov2:MovieClip;
var mov3:MovieClip;
var mov4:MovieClip;
var pic_mc:MovieClip;
var pop_mc:MovieClip;
var boxArr:Array = new Array(box0,box1,box2,box3,box4);
var movArr:Array = new Array(mov0,mov1,mov2,mov3,mov4);

pop_mc.visible = false;
box0.visible = true;
box1.visible = true;
box2.visible = true;
box3.visible = true;
box4.visible = true;
mov0.visible = false;
mov1.visible = false;
mov2.visible = false;
mov3.visible = false;
mov4.visible = false;

for(var i:int=0; i<boxArr.length; i++){
boxArr[i].addEventListener(MouseEvent.CLICK,link);
}

function link(evt:MouseEvent):void{
var req:URLRequest = new URLRequest("fortuneWheel.php"); //php通信地址
req.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.load(req);
loader.addEventListener(Event.COMPLETE,phpLoader);
}

function phpLoader(evt:Event):void{
var getData:String = String(evt.target.data); //获取从PHP传过来的值
//var getData:String = "1";
var totalData:String = getData.substr(0,2);
var movieName:String = evt.target.name; //当前影片剪辑的实例名称
var num:int = int(movieName.substr(3,1)); //字符串截取
boxArr[num].removeEventListener(MouseEvent.CLICK,link);
//trace(movieName);
box0.mouseEnabled = false;
box1.mouseEnabled = false;
box2.mouseEnabled = false;
box3.mouseEnabled = false;
box4.mouseEnabled = false;
boxArr[num].visible = false;

var timer:Timer = new Timer(8000,1); //设置时间函数1
timer.start(); //开始计时
var timer2:Timer = new Timer(2000,1); //设置时间函数2
timer2.start(); //开始计时
if(totalData == "nl"){
ExternalInterface.call("sendToJavaScript", "nl"); //未登录,告诉JS
}else if(totalData == "dj"){
ExternalInterface.call("sendToJavaScript", "dj"); //积分冻结,告诉JS
}else if(totalData == "sd"){
ExternalInterface.call("sendToJavaScript", "sd"); //用户锁定,告诉JS
}else if(totalData == "nk"){
ExternalInterface.call("sendToJavaScript", "nk"); //没有钥匙,告诉JS
}else if(totalData=="1" || totalData=="2" || totalData=="3" || totalData=="4" || totalData=="5" || totalData=="6" || totalData=="7" || totalData=="8" || totalData=="9" || totalData=="10" || totalData=="11" || totalData=="12"){
movArr[num].visible = true;
movArr[num].gotoAndPlay(1);
movArr[num].pic_mc.gotoAndStop(totalData); //中奖信息

timer2.addEventListener(TimerEvent.TIMER,frewin2); //侦听时间时间
function frewin2(evt:TimerEvent){
ExternalInterface.call("sendToJavaScript", totalData); //抽奖完成,告诉JS完成事件
}
}else{
timer.addEventListener(TimerEvent.TIMER,frewin); //侦听时间时间
function frewin(evt:TimerEvent){
pop_mc.scaleX = pop_mc.scaleY = 0.7;
pop_mc.visible=true;
TweenMax.to(pop_mc, 1, {scaleX:1, scaleY:1, ease:Elastic.easeOut});
}
}
}

pop_mc.close_btn.addEventListener(MouseEvent.CLICK,hidePop); //关闭弹出层按钮添加鼠标侦听事件
function hidePop(evt:MouseEvent):void{
pop_mc.visible = false; //弹出层隐藏
}
...全文
67 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
周小山 2012-08-20
有人在吗? 楼主在线等
回复
相关推荐
发帖
非技术区
创建于2007-09-28

2073

社区成员

Web 开发 非技术区
申请成为版主
帖子事件
创建了帖子
2012-08-20 11:23
社区公告
暂无公告