flash 所有代码

 我来答
局势君
2011-05-05 · 知道合伙人教育行家
局势君
知道合伙人教育行家
采纳数:409 获赞数:466

向TA提问 私信TA
展开全部
import com.greensock.TweenLite;
import gfx.controls.Button;
import gfx.events.EventTypes;
import mx.utils.Delegate;
import selectCamp.message.MsgDefined;
/**
* 角色标签
* @author Tiger
*/
class selectCamp.roleReadyPanel.RoleReadyLabel extends MovieClip
{

private var m_readymc:MovieClip;
private var m_selectEft:MovieClip;
private var m_headmc:MovieClip;
private var m_hotArea:Button;
//private var m_hotArea:MovieClip;
private var m_nameTxt:TextField;
private var keyListener:Object;
private var m_nameYellowTxt:TextField;

private var m_ready:Number;
private var m_camp:Number;
private var m_name:String;
public var m_id:Number;
private var m_lelvel:Number;

private var m_readyPos:Number;

private var isGetOwnerData:Boolean = false; //房主,id
private var m_selected:Boolean;
private var myID:Number;
private var mouseListener:Object;

public var sss:Number = 3;

public function RoleReadyLabel()
{
initVar();
}

private function initVar():Void
{
m_readymc = this["mcReady"];
m_headmc = this["mcHead"];
m_selectEft = this["mcSelectBg"];
m_hotArea = this["mcHot"];
m_nameTxt = this["txtName"];
m_nameYellowTxt = this["txtNameYellow"];

m_ready = -1;
m_camp = -1;
m_lelvel = -1;
m_name = "";
m_id = -1;
m_selected = false;
isGetOwnerData = false;
m_nameYellowTxt._visible = false;
}

private function onLoad():Void
{
initEffectMc(false);
addMouseEvent();
}

public function setLabelInfor(readyStatus:Number, campStatus:Number, nameInfor:String,id:Number,isOwner:Boolean,level:Number):Void
{
if (!isGetOwnerData) getIDdata();
readyState(readyStatus);
setName(nameInfor,id);
setIsOwner(isOwner);
headState(campStatus,level);
m_id = id;

}

//设置是否为房主
private function getIDdata():Void
{
isGetOwnerData = true;
myID = MsgDefined.Instance.getSlefID();
}
private function setIsOwner(isOwner:Boolean):Void
{
if (isOwner) readyState(3);
}

//0:None,1:ready 2:Ingame 3:owner,
private function readyState(d:Number):Void
{
if (isNaN(d))
{
trace(MsgDefined.Instance.INFOR_WRONG_READY);
return;
}
m_readymc.gotoAndStop(d + 1);
m_readyPos = m_readymc._width;
}
//1:right,2:wrong,3:none
private function headState(d:Number,level:Number):Void
{
m_lelvel = level;
if (isNaN(d))
{
trace(MsgDefined.Instance.INFOR_WRONG_CAMP + ":1");
return;
}
m_headmc.gotoAndStop(d + 1);

if (d == 1)
{
m_readymc._x = -(m_readyPos + 6);
}
m_camp = d;

var midImgName:String = (d == 0)?"policeCamp":"torristCamp";
MsgDefined.Instance.drawCampImag(midImgName,m_camp,m_lelvel);
}

private function setName(mName:String,id:Number):Void
{
if (myID == id)
{
m_nameYellowTxt._visible = true;
m_nameYellowTxt.text = mName;
m_nameTxt._visible = false;
}
else
{
m_nameTxt._visible = true;
m_nameTxt.text = mName;
m_nameYellowTxt._visible = false;
}

}

public function getName():String
{
return m_nameTxt.text;
}
/**
* 返回角色标签信息
* @return ready*camp*name*id
*/
public function getRoleInfor():String
{
return m_ready + "*" + m_camp + "*" + m_name + "*" + m_id;
}
//选中条处理
public function initEffectMc(b:Boolean):Void
{
m_selectEft._visible = b;
if (b) m_selectEft._alpha = 0;
m_selected = false;
}
//添加鼠标事件
private function addMouseEvent():Void
{
m_hotArea.addEventListener(EventTypes.ROLL_OVER, this, "overLabelEffect");
m_hotArea.addEventListener(EventTypes.ROLL_OUT, this, "outLabelEffect");
//m_hotArea.addEventListener(EventTypes.PRESS, this, "downLabelEffect");

mouseListener = new Object();
mouseListener.self = this;
mouseListener.onMouseDown = function(button, target)
{
var parents:MovieClip = MovieClip(target)._parent._parent;
//MsgDefined.Instance.flashTraceMsg("parents:" + parents + "," + parents.m_container);
if (button == 2 && parents.m_container)
{
this.self.downLabelEffect(null);
}
else
{
this.self.initEffectMc(false);
}
}

Mouse.addListener(mouseListener);
}

//删除侦听
public function removeKeyEvent():Void
{
Mouse.removeListener(mouseListener);
mouseListener = null;
}

private function overLabelEffect(e:Object):Void
{
//setOverID(m_id);
if (m_selected) return;
initEffectMc(true);
TweenLite.to(m_selectEft, MsgDefined.Instance.HOLD_TIMIE, { _alpha:50 } );
}

private function outLabelEffect(e:Object):Void
{
if (m_selected) return;
TweenLite.to(m_selectEft, MsgDefined.Instance.HOLD_TIMIE, { _alpha:0, onComplete:initEffectMc, onCompleteParams:[false] } );
}

private function downLabelEffect(e:Object):Void
{
if (m_selected)
{
m_selectEft._alpha = 100;
return;
}
m_selected = true;
TweenLite.to(m_selectEft, MsgDefined.Instance.HOLD_TIMIE, { _alpha:100 } );
sendOutKickPanel();
}
//右键菜单
private function sendOutKickPanel():Void
{
this._parent.selectLabel(m_camp, m_id, this);
}
//选中态
public function get selected():Boolean { return m_selected; }

public function set selected(value:Boolean):Void
{
m_selected = value;
}
//经过id
private function setOverID(id:Number):Void
{
MsgDefined.Instance.curtOverID = id;
}
private function getOverID():Number
{
return MsgDefined.Instance.curtOverID;
}
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
AiPPT
2024-09-19 广告
在北京饼干科技有限公司,我们致力于提供便捷高效的办公解决方案。关于AIPPT制作,我们虽不直接提供软件服务,但深知市场上有众多免费或成本效益高的PPT制作工具可供选择。用户可通过在线平台或软件市场轻松获取,享受从模板选择到内容编辑的一站式免... 点击进入详情页
本回答由AiPPT提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式