第一次提交

This commit is contained in:
dengtongyu committed 2018-12-03 17:31:53 +08:00
commit 8121362a03
4412 files changed
+1091845

No files matched your search

@@ -0,0 +1,100 @@
package com.yy.vip.pk.components
{
import com.yy.vip.pk.base.components.TabButton;
import flash.display.Graphics;
import org.flexlite.domUI.components.Label;
public class TabButtonMiddel extends TabButton
{
public var fontSize : int = 14;
public var selectedColor : uint = 0xcb9d3a;
public var unSelectedColor : uint = 0x95899d;
public static var STYLE_1:uint = 0;
public static var STYLE_2:uint = 1;
public var style : uint = TabButtonMiddel.STYLE_1;
public var tabWidth:Number = 90;
public var tabHeight : Number = 30;
override protected function createChildren():void
{
super.createChildren();
this.width = tabWidth;
this.height = tabHeight ;
_label = new Label();
_label.width = this.width;
_label.textAlign = "center";
_label.size = this.fontSize;
_label.textColor = 0xcb9d3a;
_label.fontFamily = "SimSun";
addChild(_label);
}
override protected function commitProperties():void
{
super.commitProperties();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth,unscaledHeight);
updateBg();
}
public function updateBg():void{
var g:Graphics = _bg1.graphics;
if(_selected)
{
_label.textColor = selectedColor;
g.clear();
if(style == STYLE_1)
{
g.beginFill(0x1b276d,1);
g.moveTo(0,this.height);
g.lineTo(0,0);
g.lineTo(this.width,0);
g.lineTo(this.width,this.height);
g.endFill();
g.lineStyle(1,0x2bcdfb,1);
g.moveTo(0,this.height);
g.lineTo(0,0);
g.lineTo(this.width-1,0);
g.lineTo(this.width-1,this.height);
}
else if(style == STYLE_2)
{
g.beginFill(0xcb9d3a,1);
g.drawRect(0,this.height,this.width,2);
g.endFill();
}
}
else
{
_label.textColor = unSelectedColor;
g.clear();
if(style == STYLE_1)
{
g.lineStyle(1,0x2bcdfb,1);
g.moveTo(0,this.height - 1);
g.lineTo(this.width,this.height - 1);
}
else if(style == STYLE_2)
{
}
}
}
override public function depose():void{
super.depose();
}
}
}
@@ -0,0 +1,33 @@
package com.yy.vip.pk.components
{
import com.yy.vip.pk.base.layout.HLayout;
import org.flexlite.domUI.events.UIEvent;
public class TabHeader extends HLayout
{
public var tabItemWidth:Number = 41;
public function TabHeader()
{
super();
this.addEventListener(UIEvent.UPDATE_COMPLETE,headerUpdateHandler);
}
protected function headerUpdateHandler(event:UIEvent):void
{
var firstChid :* = this.getChildAt(0);
var lastChid :* = this.getChildAt(this.numChildren - 1);
for(var i:int = 0;i<this.numChildren;i++)
{
var chid :* = this.getChildAt(i);
if(!isNaN(tabItemWidth) && chid != lastChid)
chid.width = tabItemWidth;
}
if(firstChid && lastChid)
lastChid.width = (this.width - (this.numChildren - 1) * firstChid.width);
}
}
}
@@ -0,0 +1,66 @@
package com.yy.vip.pk.diamondrank
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.system.Security;
[SWF(width=260,height=284,backgroundColor=0xfcfcfc,frameRate=15)]
public class MainDiamondRank extends MovieClip
{
public function MainDiamondRank()
{
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if(stage)
{
this.addEventListener(Event.ADDED_TO_STAGE,initHandler);
}
else
{
this.initHandler();
}
}
private function initHandler(event:Event = null):void
{
try{
this.stage.addEventListener(MouseEvent.RIGHT_CLICK,rightClickHandler);
}
catch(e:Error)
{
}
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
var t : String = this.loaderInfo.parameters.t;
var loader :Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteHandler);
loader.load(new URLRequest("http://show.vip.yy.com/clientpkchatpub/notices/MainDiamondRankCore.swf?t="+t));
}
protected function ioErrorHandler(event:Event):void
{
}
protected function loadCompleteHandler(event:Event):void
{
addChild(event.currentTarget.loader);
}
protected function rightClickHandler(event:MouseEvent):void
{
event.stopImmediatePropagation();
}
}
}
@@ -0,0 +1,102 @@
package com.yy.vip.pk.diamondrank
{
import com.yy.vip.pk.diamondrank.service.AppService;
import com.yy.vip.pk.diamondrank.view.module.ListGroup;
import com.yy.vip.pk.event.CommonEvent;
import com.yy.vip.pk.event.JsCallEvent;
import com.yy.vip.pk.service.JsService;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.system.Security;
[SWF(width=260,height=284,backgroundColor=0xfcfcfc,frameRate=15)]
public class MainDiamondRankCore extends MovieClip
{
/*public static var NORMAL_SIZE:Number = 165;
public static var GOLD_SIZE:Number = 250;
public static var APP_SIZE:Number = NORMAL_SIZE;*/
public static var NORMAL_SIZE:Number = 165;
public static var GOLD_SIZE:Number = 250;
public static var APP_SIZE:Number = NORMAL_SIZE;
private var _listGroup:ListGroup;
public function MainDiamondRankCore()
{
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if(!stage)
{
this.addEventListener(Event.ADDED_TO_STAGE,initHandler);
}
else
{
this.initHandler();
}
}
protected function callByMainSwfHandler(event:JsCallEvent):void
{
if(event.cmd == JsService.CMD_GET_CURRENT_USERINFO)
AppService.getInstance().currentUserInfo = event.data;
}
private function initHandler(event:Event = null):void
{
try{
this.stage.addEventListener(MouseEvent.RIGHT_CLICK,rightClickHandler);
}
catch(e:Error)
{
}
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
_listGroup = new ListGroup();
_listGroup.width = stage.stageWidth;
this.addChild(_listGroup);
this.stage.addEventListener(Event.RESIZE,resizeHandler);
resizeHandler(null);
JsService.getInstance().addEventListener(JsCallEvent.CALL_BY_MAIN_SWF,callByMainSwfHandler);
JsService.getInstance().start(JsService.PUBLIC_TOP_NOTICE_SWF_ID);
JsService.getInstance().callMainSwf(JsService.CMD_GET_CURRENT_USERINFO,JsService.PUBLIC_TOP_NOTICE_SWF_ID);
AppService.getInstance().addEventListener(AppService.SIZE_CHANGE_EVENT,appSizeChangeHandler);
}
protected function appSizeChangeHandler(event:CommonEvent):void
{
if(event.data == 0)
{
APP_SIZE = NORMAL_SIZE;
JsService.getInstance().setSwfSize(JsService.PUBLIC_TOP_NOTICE_SWF_ID,NORMAL_SIZE);
}
else if(event.data == 1){
APP_SIZE = GOLD_SIZE;
JsService.getInstance().setSwfSize(JsService.PUBLIC_TOP_NOTICE_SWF_ID,GOLD_SIZE);
}
}
protected function resizeHandler(event:Event):void
{
_listGroup.width = this.stage.stageWidth;
_listGroup.height = this.stage.stageHeight;
_listGroup.update();
}
protected function rightClickHandler(event:MouseEvent):void
{
event.stopImmediatePropagation();
}
}
}
@@ -0,0 +1,110 @@
package com.yy.vip.pk.diamondrank.service
{
import com.yy.vip.pk.diamondrank.view.module.DiamondRankList;
import com.yy.vip.pk.diamondrank.view.module.NoticePanel;
import flash.events.Event;
import flash.events.EventDispatcher;
public class AppService extends EventDispatcher
{
private static var _instance:AppService;
private var _diamondRankList:DiamondRankList;
private var _noticePanel:NoticePanel;
private var _tid:uint;
private var _anchorLeftUid:uint;
private var _anchorRightUid:uint;
private var _currentUserUid:uint;
private var _currentUserInfo:Object = {};
public static var CURRENT_USER_CHANGE:String = "CURRENT_USER_CHANGE" ;
public static var SIZE_CHANGE_EVENT:String = "SIZE_CHANGE_EVENT" ;
public static var ANCHOR_CHANGE_EVENT:String = "ANCHOR_CHANGE_EVENT" ;
public var isZhubo:Boolean;
public function get currentUserUid():uint
{
return _currentUserUid;
}
public function set currentUserUid(value:uint):void
{
_currentUserUid = value;
}
public function set currentUserInfo(value:Object):void
{
this._currentUserInfo = value;
dispatchEvent(new Event(CURRENT_USER_CHANGE));
}
public function get currentUserInfo():Object
{
return this._currentUserInfo;
}
public function AppService()
{
}
public function get anchorRightUid():uint
{
return _anchorRightUid;
}
public function set anchorRightUid(value:uint):void
{
_anchorRightUid = value;
}
public function get anchorLeftUid():uint
{
return _anchorLeftUid;
}
public function set anchorLeftUid(value:uint):void
{
_anchorLeftUid = value;
}
public function get tid():uint
{
return _tid;
}
public function set tid(value:uint):void
{
_tid = value;
}
public function get noticePanel():NoticePanel
{
return _noticePanel;
}
public function set noticePanel(value:NoticePanel):void
{
_noticePanel = value;
}
public function get diamondRankList():DiamondRankList
{
return _diamondRankList;
}
public function set diamondRankList(value:DiamondRankList):void
{
_diamondRankList = value;
}
public static function getInstance():AppService{
if(!_instance)
_instance = new AppService();
return _instance;
}
}
}
@@ -0,0 +1,93 @@
package com.yy.vip.pk.diamondrank.view.module
{
import com.greensock.TweenLite;
import com.yy.vip.pk.event.JsCallEvent;
import com.yy.vip.pk.service.JsService;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.utils.setInterval;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.core.UIComponent;
import org.flexlite.domUI.layouts.VerticalAlign;
public class BobaoPanel extends UIComponent
{
private var queue : Array = [];
private var showTimer :Timer ;
private var isTimeEnd:int = 0 ;
private var label :Label;
public function BobaoPanel()
{
var bobaoBg :MC_zhankuangbobao_bg = new MC_zhankuangbobao_bg();
this.addChild(bobaoBg);
this.label = new Label();
this.label.verticalAlign = VerticalAlign.MIDDLE;
this.label.htmlText = "年度总决赛,激战中…";
this.label.textColor = 0xfff7e1;
this.label.x = 31;
this.label.y = 60;
this.label.leading = 2;
this.label.width = 200;
this.label.height = 40;
this.addChild(this.label);
JsService.getInstance().addEventListener(JsCallEvent.CALL_BY_MAIN_SWF,callByMainHandler);
}
protected function callByMainHandler(event:JsCallEvent):void
{
if(event.cmd == JsService.CMD_SET_BOBAO_DEFAUT_TEXT || event.cmd == JsService.CMD_SET_BOBAO_TEXT )
addTextShow( event.data as String);
}
public function addTextShow(str : String):void{
queue.push(str);
if(!showTimer)
{
showTimer = new Timer(8000);
showTimer.addEventListener(TimerEvent.TIMER,showTimerHandler);
showTimer.start();
isTimeEnd = 0;
showText();
}
}
private function showText():void
{
var str : String;
if(isTimeEnd == 0)
{
if(queue.length > 0)
str = queue.shift();
if(str){
var self : * = this;
TweenLite.to(self.label,.2,{y:20,alpha:0,onComplete:function handler():void{
self.label.htmlText = str;
self.label.y = 100;
self.label.alpha = 0;
TweenLite.to(self.label,.2,{y:60,alpha:1,onComplete:function handler():void{
TweenLite.killTweensOf(self.label);
}});
}});
}
isTimeEnd = 1;
}
}
protected function showTimerHandler(event:TimerEvent):void
{
isTimeEnd = 0;
showText();
}
}
}
@@ -0,0 +1,343 @@
package com.yy.vip.pk.diamondrank.view.module
{
import com.yy.vip.pk.base.BaseGroup;
import com.yy.vip.pk.base.components.MaskLoader;
import com.yy.vip.pk.diamondrank.service.AppService;
import com.yy.vip.pk.diamondrank.view.renderer.TopListItemRenderer;
import com.yy.vip.pk.event.CommonEvent;
import com.yy.vip.pk.event.JsCallEvent;
import com.yy.vip.pk.service.JsService;
import com.yy.vip.pk.skin.NoticeScrollerSkin;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.LocalConnection;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.system.SecurityDomain;
import org.flexlite.domUI.collections.ArrayCollection;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.components.List;
import org.flexlite.domUI.components.Scroller;
import org.flexlite.domUI.core.UIComponent;
public class DiamondRankList extends UIComponent
{
private var _bg:Shape;
private var _subchannelBg:MC_Subchannel_170807_V2;
protected var _list:List;
protected var _listUI:UIComponent;
protected var _listBG:BaseGroup;
private var _myselfUI:UIComponent;
private var _quickUpgradeLabel:Label;
private var _quickUpgrade:MC_QuickUpgrade_170807_v2;
private var _head:MC_Head_170807;
private var _myLogo:MaskLoader;
private var _nameLabel:Label;
private var _lvIcon:MovieClip;
private var _lvLabel:Label;
private var _scoreLabel:Label;
private var _rankLabel:Label;
private var _scrollPanel:Scroller;
private static var _tips:TipsPanel;
private var _bobaoUI:BobaoPanel;
public function DiamondRankList()
{
AppService.getInstance().diamondRankList = this;
this.width = 260;
this.height = 228;
drawBack();
_myselfUI = new UIComponent();
_myselfUI.y = 137;
_myselfUI.visible = false;
this.addChild(_myselfUI);
mySelfBack();
_quickUpgradeLabel = new Label();
_quickUpgradeLabel.fontFamily = "simsun";
_quickUpgradeLabel.x = 77;
_quickUpgradeLabel.y = 58;
_quickUpgradeLabel.height = 20;
_quickUpgradeLabel.truncateToFit = false;
_quickUpgradeLabel.text = "";
_quickUpgradeLabel.textColor = 0xcb9d3a;
_myselfUI.addChild(_quickUpgradeLabel);
_quickUpgrade = new MC_QuickUpgrade_170807_v2();
_quickUpgrade.buttonMode = true;
_quickUpgrade.x = 187;
_quickUpgrade.y = 58;
_quickUpgrade.addEventListener(MouseEvent.CLICK,clickHandler);
_myselfUI.addChild(_quickUpgrade);
_nameLabel = new Label();
_nameLabel.fontFamily = "simsun";
_nameLabel.x = 78;
_nameLabel.y = 8;
_nameLabel.width = 100;
_nameLabel.maxWidth = 100;
_nameLabel.height = 20;
_nameLabel.truncateToFit = false;
_nameLabel.textColor = 0xcb9d3a;
_myselfUI.addChild(_nameLabel);
_lvLabel = new Label();
_lvLabel.fontFamily = "Arial";
_lvLabel.x = 205;
_lvLabel.y = 8;
_lvLabel.width = 40;
_lvLabel.maxWidth = 40;
_lvLabel.height = 20;
_lvLabel.truncateToFit = false;
_lvLabel.textColor = 0x95899d;
_myselfUI.addChild(_lvLabel);
_scoreLabel = new Label();
_scoreLabel.fontFamily = "simsun";
_scoreLabel.x = 78;
_scoreLabel.y = 34;
_scoreLabel.width = 100;
_scoreLabel.maxWidth = 100;
_scoreLabel.height = 20;
_scoreLabel.truncateToFit = false;
_scoreLabel.textColor = 0x95899d;
_myselfUI.addChild(_scoreLabel);
_rankLabel = new Label();
_rankLabel.fontFamily = "simsun";
_rankLabel.x = 187;
_rankLabel.y = 34;
_rankLabel.width = 80;
_rankLabel.maxWidth = 80;
_rankLabel.height = 20;
_rankLabel.truncateToFit = false;
_rankLabel.textColor = 0xcb9d3a;
_myselfUI.addChild(_rankLabel);
_head = new MC_Head_170807();
_head.x = 11;
_head.y = 9;
_myselfUI.addChild(_head);
_myLogo = new MaskLoader(52,52,26);
_myLogo.x = 1;
_myLogo.y = 1;
_head.addChild(_myLogo);
_subchannelBg = new MC_Subchannel_170807_V2();
_subchannelBg.y = 0;
this.addChild(_subchannelBg);
_listUI = new UIComponent();
_listUI.width = 237;
_listUI.height = 120;
_listUI.y = 10;
_listUI.x = 25;
this.addChild(_listUI);
_listBG = new BaseGroup();
_listBG.width = _listUI.width;
_listBG.height = _listUI.height + 5;
_listUI.addChild(_listBG);
setListItemRenderer();
_scrollPanel = new Scroller();
_scrollPanel.viewport = _listBG;
_scrollPanel.width = _listUI.width;
_scrollPanel.height = _listUI.height;
_scrollPanel.skinName = NoticeScrollerSkin;
_listUI.addChild(_scrollPanel);
_scrollPanel.verticalScrollBar.fixedThumbSize = true;
_bobaoUI = new BobaoPanel();
_bobaoUI.y = 134;
_bobaoUI.visible = true;
this.addChild(_bobaoUI);
_bobaoUI.addTextShow("");
_tips = new TipsPanel();
_tips.x = 100;
this.addChild(_tips);
JsService.getInstance().addEventListener(JsCallEvent.CALL_BY_MAIN_SWF,callByMainSwfHandler);
JsService.getInstance().callMainSwf(JsService.CMD_GET_SVIP_LIST,JsService.PUBLIC_TOP_NOTICE_SWF_ID);
JsService.getInstance().callMainSwf(JsService.CMD_GET_MYSELF_DATA,JsService.PUBLIC_TOP_NOTICE_SWF_ID);
//--------------ceshi--------------------
/*var st:String = "00000以上PK\n" +
"无下限自定义 \n" +
"粉丝福利群yy://qun-[gaid=14113059&action=add]\n" +
"输赢必须惩罚,除了巨额PK值大哥说过!\n" +
"惩罚救输的一方一律10倍救,刷给输方,刷给赢得一方救5倍\n" +
"变超人链接https://pay.duowan.com/"+
"00000以上PK\n" +
"无下限自定义 \n" +
"粉丝福利群yy://qun-[gaid=14113059&action=add]\n" +
"输赢必须惩罚,除了巨额PK值大哥说过!\n" +
"惩罚救输的一方一律10倍救,刷给输方,刷给赢得一方救5倍\n" +
"变超人链接https://pay.duowan.com/";
//AppService.getInstance().noticePanel.setContentLab(st);
var obj:Object = new Object();
obj = {uid:1362154759,nickName:"答非所问",is_svip:1,score:5000,grade:15,rank:999999,score_type:1};
//AppService.getInstance().diamondRankList.setMySelfData(obj)
var haoDatasArr:Array;
haoDatasArr = [{index:1,uid:50016139,name:"222232",value:11111,lv:22,type:0},
{index:2,uid:1362154759,name:"8888",value:222222,lv:12,type:1},
{index:3,uid:1362154759,name:"wwwerdfr",value:3333333,lv:17,type:1},
{index:4,uid:1362154759,name:"电风扇定位",value:4444444,lv:25,type:1},
{index:5,uid:50016139,name:"大幅度",value:666,lv:13,type:2},
{index:6,uid:50016139,name:"3434瑞丰光电如果",value:88,lv:14,type:2},
{index:7,uid:50016139,name:"而噩噩",value:44444,lv:15,type:2},
{index:8,uid:50016139,name:"而噩噩",value:44444,lv:16,type:2},
{index:9,uid:1362154759,name:"wwwerdfr",value:3333,lv:11,type:2},
{index:10,uid:1362154759,name:"电风扇定位",value:44444,lv:12,type:1},
{index:11,uid:50016139,name:"大幅度",value:666,lv:13,type:2},
{index:12,uid:50016139,name:"3434瑞丰光电如果",value:88,lv:14,type:2},
{index:13,uid:50016139,name:"而噩噩",value:44444,lv:15,type:2},
{index:14,uid:50016139,name:"而噩噩",value:44444,lv:16,type:2},
{index:15,uid:1362154759,name:"wwwerdfr",value:3333,lv:11,type:1}];
setList(haoDatasArr);*/
//setMySelfData({});
//--------------ceshi--------------------
}
protected function callByMainSwfHandler(event:JsCallEvent):void
{
if(event.cmd == JsService.CMD_GET_SVIP_LIST)
{
this.setList(event.data as Array);
}
else if(event.cmd == JsService.CMD_GET_MYSELF_DATA)
{
this.setMySelfData(event.data);
}
}
private function clickHandler(event:MouseEvent):void{
//navigateToURL(new URLRequest("http://svip.yy.com"),"_blank");
JsService.getInstance().callMainSwf(JsService.OPEN_URL,JsService.PUBLIC_TOP_NOTICE_SWF_ID,"http://svip.yy.com");
}
protected function setListItemRenderer():void
{
_list = new List();
//_list.scrollRect = new Rectangle(0,0,_listUI.width,_listUI.height);
_list.width = 230;
_list.itemRenderer = TopListItemRenderer;
// _list.skinName = ListSkin;
_listBG.addElement(_list);
}
private function drawBack():void{
var backUi:UIComponent = new UIComponent();
backUi.graphics.clear();
backUi.graphics.beginFill(0xf3f3f3,1);
backUi.graphics.drawRect(0,0,this.width,this.height);
backUi.graphics.endFill();
this.addChild(backUi);
}
private function mySelfBack():void{
var backUi:UIComponent = new UIComponent();
backUi.graphics.clear();
backUi.graphics.beginFill(0xfcfcfc,1);
backUi.graphics.drawRect(0,0,this.width,this.height);
backUi.graphics.endFill();
_myselfUI.addChild(backUi);
}
public function setTips(x:int,y:int,obj:Object):void{
_tips.x = x;
_tips.y = y;
_tips.setData(obj);
}
public function get context():LoaderContext{
var domain:String = new LocalConnection().domain;
var loaderURL:String = domain;
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain(); //这个是关键
context.checkPolicyFile = true;
context.securityDomain = SecurityDomain.currentDomain;
if(loaderURL && loaderURL == "localhost")
context.securityDomain = null;
return context;
}
public function setMySelfData(obj:Object):void{
return;
var e : CommonEvent = new CommonEvent(AppService.SIZE_CHANGE_EVENT);
if(!obj || obj.is_svip == 0){//不是金钻
_myselfUI.visible = false;
e.data = 0;
AppService.getInstance().dispatchEvent(e);
return;
}
e.data = 1;
AppService.getInstance().dispatchEvent(e);
if(obj.hasOwnProperty("uid")){
_myLogo.load("http://pk.yy.com/avatar/" + (obj.uid),this.context);
}
if(obj.hasOwnProperty("score_type")){
if(obj.score_type != 0){
if(_lvIcon && _lvIcon.parent){
_lvIcon.parent.removeChild(_lvIcon);
}
if(obj.score_type == 1){
_lvIcon = new MC_VIP_Icon_170807();
}else if(obj.score_type == 2){
_lvIcon = new MC_PK_Icon_170807();
}
if(_lvIcon){
_lvIcon.x = 187;
_lvIcon.y = 10;
_myselfUI.addChild(_lvIcon);
}
}
}
if(obj.hasOwnProperty("nickName")){
_nameLabel.text = obj.nickName;
}
if(obj.hasOwnProperty("grade")){
_lvLabel.text = "Lv " + obj.grade;
}
if(obj.hasOwnProperty("score")){
_scoreLabel.text = "贡献值:" + obj.score;
}
if(obj.hasOwnProperty("rank")){
_rankLabel.text = "排名:" + obj.rank;
}
//{uid:1362154759,is_svip:1,score:5000,grade:15,rank:1,score_type:1};
_myselfUI.visible = true;
}
public function setList(arr:Array):void{
_list.dataProvider = new ArrayCollection(arr);
}
}
}
@@ -0,0 +1,104 @@
package com.yy.vip.pk.diamondrank.view.module
{
import com.yy.vip.pk.base.BaseGroup;
import com.yy.vip.pk.base.layout.HLayout;
import com.yy.vip.pk.components.TabButtonMiddel;
import com.yy.vip.pk.components.TabHeader;
import flash.display.Shape;
import flash.events.MouseEvent;
import org.flexlite.domUI.core.UIComponent;
import org.flexlite.domUI.layouts.HorizontalLayout;
public class ListGroup extends BaseGroup
{
private var _tabBtns:Array = new Array();
private var _header:HLayout;
private var _diamondRankList:DiamondRankList;
private var _noticePanel:NoticePanel;
private var _bg:UIComponent;
public function ListGroup()
{
super();
}
override protected function createChildren():void
{
super.createChildren();
_bg = new UIComponent();
this.addElement(_bg);
this.update();
_header = new HLayout();
_header.x = 5;
_header.y = 3;
_header.width = this.width;
_header.height = 25;
(_header.layout as HorizontalLayout).horizontalAlign = "center";
(_header.layout as HorizontalLayout).gap = 0;
addElement(_header);
_diamondRankList = new DiamondRankList();
_diamondRankList.y = _header.height+ _header.y + 1;
this.addElement(_diamondRankList);
_noticePanel = new NoticePanel();
_noticePanel.y = _header.height+ _header.y + 1;
_noticePanel.visible = false;
this.addElement(_noticePanel);
var tabBtn1:TabButtonMiddel = new TabButtonMiddel();//礼物栏按钮
tabBtn1.tabWidth = 116;
tabBtn1.tabHeight = 24;
tabBtn1.fontSize = 12;
tabBtn1.style = TabButtonMiddel.STYLE_2;
tabBtn1.clickManager = true;
_tabBtns.push(tabBtn1);
tabBtn1.text = "金钻排名";
_header.addElement(tabBtn1);
tabBtn1.selected();
tabBtn1.buttonMode = true;
tabBtn1.useHandCursor = true;
tabBtn1.mouseChildren = false;
tabBtn1.addEventListener(MouseEvent.CLICK,changeHandler);
tabBtn1.listView = _diamondRankList;
var tabBtn2:TabButtonMiddel= new TabButtonMiddel();//我的包裹按钮
tabBtn2.tabWidth = 116;
tabBtn2.tabHeight = 24;
tabBtn2.fontSize = 12;
tabBtn2.style = TabButtonMiddel.STYLE_2;
tabBtn2.clickManager = true;
_tabBtns.push(tabBtn2);
tabBtn2.text = "频道公告";
_header.addElement(tabBtn2);
tabBtn2.buttonMode = true;
tabBtn2.useHandCursor = true;
tabBtn2.mouseChildren = false;
tabBtn2.addEventListener(MouseEvent.CLICK,changeHandler);
tabBtn2.listView = _noticePanel;
}
private function changeHandler(event:MouseEvent):void{
event.stopPropagation();
}
public function update():void
{
if(_bg)
{
_bg.graphics.clear();
_bg.graphics.beginFill(0xfcfcfc,1);
_bg.graphics.drawRect(0,0,this.width,this.height);
_bg.graphics.endFill();
}
}
}
}
@@ -0,0 +1,218 @@
package com.yy.vip.pk.diamondrank.view.module
{
import com.yy.vip.pk.base.BaseGroup;
import com.yy.vip.pk.diamondrank.MainDiamondRankCore;
import com.yy.vip.pk.diamondrank.service.AppService;
import com.yy.vip.pk.event.JsCallEvent;
import com.yy.vip.pk.inter.ITabView;
import com.yy.vip.pk.service.JsService;
import com.yy.vip.pk.skin.NoticeScrollerSkin;
import com.yy.vip.pk.util.JSONUtil;
import com.yy.vip.pk.util.KeyUtil;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import flash.external.ExternalInterface;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.sampler.NewObjectSample;
import flash.utils.setTimeout;
import org.flexlite.domUI.components.Group;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.components.Scroller;
import org.flexlite.domUI.core.UIComponent;
import org.flexlite.domUI.events.UIEvent;
import org.flexlite.domUI.layouts.HorizontalAlign;
import org.flexlite.domUI.layouts.VerticalLayout;
import org.flexlite.domUI.skins.vector.ScrollerSkin;
import org.flexlite.domUI.skins.vector.VScrollBarSkin;
public class NoticePanel extends UIComponent implements ITabView
{
private var _editorBtn:MC_Editor_170807;
private var _bgGroup:Group;
private var _contentLabel:Label;
private var _scrollPanel:Scroller;
private var _contentUI:BaseGroup;
private var NOTICE_CONTENT_WIGHT:int = 235;
public function NoticePanel()
{
super();
}
override protected function createChildren():void
{
super.createChildren();
AppService.getInstance().noticePanel = this;
_bgGroup = new Group();
_bgGroup.x = 20;
_bgGroup.y = 5;
var _layout:VerticalLayout = new VerticalLayout();
_layout.horizontalAlign = HorizontalAlign.LEFT;
_bgGroup.layout = _layout;
this.addChild(_bgGroup);
_contentLabel = new Label();
_contentLabel.selectable = true;
_contentLabel.htmlText = "这家伙很懒,什么都没留下";
_contentLabel.leading = 6;
_contentLabel.textColor = 0xcb9d3a;
_contentLabel.size = 12;
_contentLabel.truncateToFit = false;
_contentLabel.width = NOTICE_CONTENT_WIGHT-15;
_contentLabel.toolTip = null;
_contentLabel.addEventListener(TextEvent.LINK,contentLabelClickHandler);
_contentUI = new BaseGroup();
_contentUI.width = NOTICE_CONTENT_WIGHT;
_contentUI.height = MainDiamondRankCore.GOLD_SIZE - 35;
_contentUI.addElement(_contentLabel);
_contentLabel.addEventListener(UIEvent.UPDATE_COMPLETE,contentLabelUpdateHandler);
_scrollPanel = new Scroller();
_scrollPanel.viewport = _contentUI;
_scrollPanel.width = NOTICE_CONTENT_WIGHT ;
_scrollPanel.height = MainDiamondRankCore.GOLD_SIZE - 35;
_scrollPanel.skinName = NoticeScrollerSkin;
_bgGroup.addElement(_scrollPanel);
_scrollPanel.verticalScrollBar.fixedThumbSize = true;
_editorBtn = new MC_Editor_170807();
_editorBtn.visible = false;
_editorBtn.x = 195;
_editorBtn.y = 5;
_editorBtn.addEventListener(MouseEvent.CLICK,clickHandler)
this.addChild(_editorBtn);
AppService.getInstance().addEventListener(AppService.CURRENT_USER_CHANGE,checkRoleHandler);
AppService.getInstance().addEventListener(AppService.SIZE_CHANGE_EVENT,sizeChangeHandler);
checkRoleHandler();
sizeChangeHandler();
}
protected function sizeChangeHandler(event:Event = null):void
{
if(MainDiamondRankCore.APP_SIZE == MainDiamondRankCore.NORMAL_SIZE)
{
_contentUI.height = MainDiamondRankCore.NORMAL_SIZE - 45;
}
else if(MainDiamondRankCore.APP_SIZE == MainDiamondRankCore.GOLD_SIZE)
{
_contentUI.height = MainDiamondRankCore.GOLD_SIZE - 45;
}
_scrollPanel.height = _contentUI.height;
_contentUI.setContentSize(_contentUI.width,_contentLabel.textHeight);
}
protected function contentLabelUpdateHandler(event:UIEvent):void
{
sizeChangeHandler();
}
protected function checkRoleHandler(event:Event = null):void
{
if(AppService.getInstance().currentUserInfo.role >= 255)
_editorBtn.visible = true;
else
JsService.getInstance().callMainSwf(JsService.CMD_CHECK_CANEDIT_NOTICE,JsService.PUBLIC_TOP_NOTICE_SWF_ID);
}
protected function contentLabelClickHandler(event:TextEvent):void
{
event.stopImmediatePropagation();
if(event.text.indexOf("http://") !=-1 || event.text.indexOf("https://")!=-1)
{
JsService.getInstance().callMainSwf(JsService.OPEN_URL,JsService.PUBLIC_TOP_NOTICE_SWF_ID,event.text);
}
else if(event.text.indexOf("yy://") !=-1)
{
var arr:Array = event.text.split(",");
JsService.getInstance().callMainSwf(JsService.CMD_GO_CHANNEL,JsService.PUBLIC_TOP_NOTICE_SWF_ID,[arr[1],arr[2]]);
}
else
{
navigateToURL(new URLRequest(event.text),"_blank");
}
}
protected function callByMainSwfHandler(event:JsCallEvent):void
{
if(event.cmd == JsService.CMD_CHECK_CANEDIT_NOTICE)
{
if(AppService.getInstance().currentUserInfo.role >= 255)
_editorBtn.visible = true;
else if(Boolean(event.data) == true)
_editorBtn.visible = true;
else
_editorBtn.visible = false;
JsService.getInstance().callMainSwf(JsService.DEBUG_LOG,JsService.PUBLIC_TOP_NOTICE_SWF_ID,"查公告编辑权返回:" + JSONUtil.encode(event.data) + "|" + AppService.getInstance().currentUserInfo.role);
}
else if(event.cmd == JsService.CMD_GET_ETIT_NOTICE_CONTENT)
{
this.setContentLab(event.data as String);
}
}
private function clickHandler(event:MouseEvent):void{
JsService.getInstance().callMainSwf(JsService.CMD_SHOW_ETIT_NOTICE_PANEL,JsService.PUBLIC_TOP_NOTICE_SWF_ID,this._contentLabel.text);
}
private function setContentLab(value:String):void{
var pattern : Object =/(http\:[\w\.\/]+)/gim;
value = value.replace(pattern,"<a href=\"event:$1\"><u><font color='#ff0000'>$1</font></u></a>");
pattern =/(https\:[\w\.\/]+)/gim;
value = value.replace(pattern,"<a href=\"event:$1\"><u><font color='#ff0000'>$1</font></u></a>");
value = filterAirTicket(value);
value = filterAirTicket2(value);
_contentLabel.htmlText = value;
}
private function filterAirTicket(msg : String):String{
//yy://pd-[sid=2710&subid=999315&type=wonder_channel]
//yy://pd-[sid=2710&amp;subid=999315&amp;type=wonder_channel]
var firstIndex : * = msg.indexOf("yy://pd-");
if(firstIndex >= 0){
msg = msg.replace(new RegExp("yy://pd-\\[sid=(\\d+)&(amp;)?subid=(\\d+)(&(amp;)?type=wonder_channel)?\\]","gm"),
'<a href=\"event:yy://pd-[sid=$1&subid=$3&type=wonder_channel],$1,$3\"><font color="#ff0000">[飞机票($1)]</font></a>' );
}
return msg;
}
private function filterAirTicket2(msg : String):String{
//yy://qun-[gaid=14113059&action=add]
var firstIndex : * = msg.indexOf("yy://qun-");
if(firstIndex >= 0){
msg = msg.replace(new RegExp("yy://qun-\\[gaid=(\\d+)(&(amp;)?action=add)?\\]","gm"),
'<a href=\"yy://qun-[gaid=$1&action=add]\"><font color="#ff0000">[加Y群($1)]</font></a>' );
}
return msg;
}
private var _selected:Boolean;
private var _initData:Boolean;
public function set selected(value:Boolean):void{
if(this._selected == value)
return;
this._selected = value;
if(this._selected && !_initData)
{
_initData = true;
JsService.getInstance().addEventListener(JsCallEvent.CALL_BY_MAIN_SWF,callByMainSwfHandler);
checkRoleHandler();
JsService.getInstance().callMainSwf(JsService.CMD_GET_ETIT_NOTICE_CONTENT,JsService.PUBLIC_TOP_NOTICE_SWF_ID);
}
}
}
}
@@ -0,0 +1,108 @@
package com.yy.vip.pk.diamondrank.view.module
{
import com.yy.vip.pk.service.JsService;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.text.TextFormatAlign;
import flash.utils.clearTimeout;
import flash.utils.setTimeout;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.core.UIComponent;
public class TipsPanel extends UIComponent
{
private var _nameLabel:Label;
private var _levelLabel:Label;
private var _valueLabel:Label;
private var _rankLabel:Label;
private var _bg:MC_Tips_Bg_170807;
private var _btn:MC_Diamond_Btn_170807;
private var _cit:int;
public function TipsPanel()
{
this.visible = false;
_bg = new MC_Tips_Bg_170807();
this.addChild(_bg);
_nameLabel = new Label();
_nameLabel.fontFamily = "simsun";
_nameLabel.textAlign = TextFormatAlign.CENTER;
_nameLabel.y = 5;
_nameLabel.width = 160;
_nameLabel.maxWidth = 160;
_nameLabel.height = 20;
_nameLabel.truncateToFit = false;
_nameLabel.textColor = 0x333333;
this.addChild(_nameLabel);
_levelLabel = new Label();
_levelLabel.x = 10;
_levelLabel.y = 25;
_levelLabel.width = 100;
_levelLabel.maxWidth = 100;
_levelLabel.height = 20;
_levelLabel.truncateToFit = false;
this.addChild(_levelLabel);
_valueLabel = new Label();
_valueLabel.x = 64;
_valueLabel.y = 25;
_valueLabel.width = 100;
_valueLabel.maxWidth = 100;
_valueLabel.height = 20;
_valueLabel.truncateToFit = false;
this.addChild(_valueLabel);
_rankLabel = new Label();
_rankLabel.x = 10;
_rankLabel.y = 45;
_rankLabel.width = 100;
_rankLabel.maxWidth = 100;
_rankLabel.height = 20;
_rankLabel.truncateToFit = false;
this.addChild(_rankLabel);
_btn = new MC_Diamond_Btn_170807();
_btn.x = (_bg.width - _btn.width) / 2;
_btn.y = 69;
_btn.addEventListener(MouseEvent.CLICK,clickHandler);
this.addChild(_btn);
this.addEventListener(MouseEvent.ROLL_OVER,overHandler);
this.addEventListener(MouseEvent.ROLL_OUT,hideTips);
}
private function overHandler(event:MouseEvent):void{
clearTimeout(_cit);
}
private function clickHandler(event:MouseEvent):void{
JsService.getInstance().callMainSwf(JsService.OPEN_URL,JsService.PUBLIC_TOP_NOTICE_SWF_ID,"http://svip.yy.com");
}
public function setData(obj:Object):void{
if(obj){
this.visible = true;
clearTimeout(_cit);
_cit = setTimeout(hideTips,1000);
_nameLabel.text = obj.name;
_levelLabel.htmlText = "<font color='#999999' face='simsun' size='12'>等级:</font><font color='#f63055' face='simsun' size='12'>"+obj.lv+"</font>";
_valueLabel.htmlText = "<font color='#999999' face='simsun' size='12'>贡献值:</font><font color='#f63055' face='simsun' size='12'>"+obj.value+"</font>";
_rankLabel.htmlText = "<font color='#999999' face='simsun' size='12'>排名:</font><font color='#f63055' face='simsun' size='12'>"+obj.index+"</font>";
}
}
private function hideTips(event:MouseEvent = null):void{
clearTimeout(_cit);
this.visible = false;
}
}
}
@@ -0,0 +1,228 @@
package com.yy.vip.pk.diamondrank.view.renderer
{
import com.yy.vip.pk.diamondrank.service.AppService;
import com.yy.vip.pk.util.FontUtil;
import com.yy.vip.pk.util.StringUtil;
import com.yy.vip.pk.util.TextEffect;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
import org.flexlite.domUI.components.IItemRenderer;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.core.UIComponent;
public class TopListItemRenderer extends UIComponent implements IItemRenderer
{
private var _main:UIComponent;
private var _topMc:*;
private var _nameLabel:Label;
private var _levelLabel:Label;
private var _valueLabel:Label;
private var _index:Number;
private var _data:*;
private var _lvIcon:MovieClip;
private var _lvLabel:Label;
public function TopListItemRenderer()
{
super();
this.height = 25;
}
override protected function createChildren():void{
super.createChildren();
_main = new UIComponent();
addChild(_main);
_nameLabel = new Label();
_nameLabel.fontFamily = "";
_nameLabel.x = 24;
_nameLabel.y = 1;
_nameLabel.width = 60;
_nameLabel.maxWidth = 80;
_nameLabel.height = 20;
_nameLabel.truncateToFit = false;
_nameLabel.textColor = 0xcb9d3a;
_nameLabel.mouseChildren =false;
_nameLabel.buttonMode = true;
_nameLabel.addEventListener(MouseEvent.MOUSE_OVER,overHandler);
_main.addChild(_nameLabel);
_levelLabel = new Label();
_levelLabel.fontFamily = "Arial";
_levelLabel.x = 140;
_levelLabel.y = 1;
_levelLabel.width = 60;
_levelLabel.maxWidth = 80;
_levelLabel.height = 20;
_levelLabel.truncateToFit = false;
_levelLabel.textColor = 0x95899d;
_main.addChild(_levelLabel);
_valueLabel = new Label();
_valueLabel.fontFamily = "Arial";
_valueLabel.x = 175;
_valueLabel.y = 1;
_valueLabel.width = 60;
_valueLabel.maxWidth = 80;
_valueLabel.height = 20;
_valueLabel.truncateToFit = false;
_valueLabel.textColor = 0xcb9d3a;
_main.addChild(_valueLabel);
_lvLabel = new Label();
_lvLabel.fontFamily = "Arial";
_lvLabel.x = 135;
_lvLabel.y = 1;
_lvLabel.width = 40;
_lvLabel.maxWidth = 40;
_lvLabel.height = 20;
_lvLabel.truncateToFit = false;
_lvLabel.textColor = 0x95899d;
_main.addChild(_lvLabel);
}
public function get data():Object
{
return _data;
}
/**
* 设置itemlistdata
* @param value
*
*/
public function set data(value:Object):void
{
if(this._data == value)
return;
this._data = value;
this._nameLabel.text = StringUtil.html_encode(value.name);
this._valueLabel.text = value.value;
if(_topMc is TextEffect)
{
(_topMc as TextEffect).depose();
}
if(_topMc is MovieClip)
{
(_topMc as MovieClip).stop();
}
if(_topMc && _topMc.parent){
_topMc.parent.removeChild(_topMc);
_topMc = null;
}
if(value.hasOwnProperty("index")){
switch(value.index){
case 1:
_topMc = new MC_First_170807();
_topMc.x = 1;
break;
case 2:
_topMc = new MC_Second_170807();
_topMc.x = 3;
break;
case 3:
_topMc = new MC_Third_170807();
break;
default:
_topMc = new TextEffect();
_topMc.createTxt("simsun",12,false,false,"right");
_topMc.glowFilter = null;
_topMc.Ccolors = [0x95899d,0x95899d,0x95899d];
_topMc.txtFilter((value.index).toString());
_topMc.x = -21;
_topMc.y = 2;
break;
}
if(_topMc){
_main.addChild(_topMc);
}
}
if(_lvIcon is MovieClip)
{
(_lvIcon as MovieClip).stop();
}
if(_lvIcon && _lvIcon.parent)
_lvIcon.parent.removeChild(_lvIcon)
_lvIcon = null;
if(value.hasOwnProperty("type")){
if(value.type == 1){
_lvIcon = new MC_VIP_Icon_170807();
}else if(value.type == 2){
_lvIcon = new MC_PK_Icon_170807();
}else{
_lvIcon = new MC_Level_Icon_170807();
}
if(_lvIcon){
_lvIcon.x = 117;
_lvIcon.y = 3;
_main.addChild(_lvIcon);
}
}
if(value.hasOwnProperty("lv") && _lvIcon){
_lvLabel.text = "Lv"+value.lv;
if(value.type == 1 || value.type == 2){
if(value.lv < 12){
_lvIcon.gotoAndStop(1);
}else if(value.lv < 17){
_lvIcon.gotoAndStop(2);
}else if(value.lv < 25){
_lvIcon.gotoAndStop(3);
}else{
_lvIcon.gotoAndStop(4);
}
}else{
if(value.lv < 4){
_lvIcon.gotoAndStop(1);
}else if(value.lv < 7){
_lvIcon.gotoAndStop(2);
}else if(value.lv < 13){
_lvIcon.gotoAndStop(3);
}else if(value.lv < 20){
_lvIcon.gotoAndStop(4);
}else if(value.lv < 25){
_lvIcon.gotoAndStop(5);
}else{
_lvIcon.gotoAndStop(6);
}
}
}
}
private function overHandler(even:MouseEvent):void{
AppService.getInstance().diamondRankList.setTips(90,25,this._data)//p.y - 5
}
public function get selected():Boolean
{
return false;
}
public function set selected(value:Boolean):void
{
}
public function get itemIndex():int
{
return this._index;
}
public function set itemIndex(value:int):void
{
this._index = value;
}
public function get label():String
{
return null;
}
public function set label(value:String):void
{
}
}
}
@@ -0,0 +1,51 @@
package com.yy.vip.pk.skin
{
import org.flexlite.domCore.dx_internal;
import org.flexlite.domUI.components.HScrollBar;
import org.flexlite.domUI.components.VScrollBar;
import org.flexlite.domUI.skins.VectorSkin;
use namespace dx_internal;
/**
* 垂直滚动条默认皮肤
* @author DOM
*/
public class NoticeScrollerSkin extends VectorSkin
{
public function NoticeScrollerSkin()
{
super();
}
public var horizontalScrollBar:HScrollBar;
public var verticalScrollBar:VScrollBar;
/**
* @inheritDoc
*/
override protected function createChildren():void
{
super.createChildren();
horizontalScrollBar = new HScrollBar();
horizontalScrollBar.visible = false;
addElement(horizontalScrollBar);
verticalScrollBar = new VScrollBar();
verticalScrollBar.skinName = NoticeVScrollBarSkin;
verticalScrollBar.visible = false;
addElement(verticalScrollBar);
}
/**
* @inheritDoc
*/
override protected function updateDisplayList(w:Number,h:Number):void
{
super.updateDisplayList(w,h);
this.alpha = currentState=="disabled"?0.5:1;
}
}
}
@@ -0,0 +1,65 @@
package com.yy.vip.pk.skin
{
import org.flexlite.domCore.dx_internal;
import org.flexlite.domUI.components.Button;
import org.flexlite.domUI.components.VScrollBar;
import org.flexlite.domUI.skins.VectorSkin;
import org.flexlite.domUI.skins.vector.VScrollBarThumbSkin;
use namespace dx_internal;
public class NoticeVScrollBarSkin extends VectorSkin
{
public function NoticeVScrollBarSkin()
{
super();
this.minWidth = 15;
this.minHeight = 50;
}
public var decrementButton:Button;
public var incrementButton:Button;
public var thumb:Button;
public var track:Button;
/**
* @inheritDoc
*/
override protected function createChildren():void
{
super.createChildren();
track = new Button();
track.top = 1;
track.bottom = 1;
track.height = 54;
track.left = 1;
track.skinName = NoticeVScrollBarTrackSkin;
addElement(track);
thumb = new Button();
thumb.alpha = .15;
thumb.left = 1;
thumb.skinName = NoticeVScrollBarThumbSkin;
addElement(thumb);
track.visible = (owner as VScrollBar).showTrack;
thumb.alpha = track.visible?.5:.15;
}
/**
* @inheritDoc
*/
override protected function updateDisplayList(w:Number,h:Number):void
{
super.updateDisplayList(w,h);
this.alpha = currentState=="disabled"?0.5:1;
track.visible = (owner as VScrollBar).showTrack;
thumb.alpha = track.visible?.7:.15;
}
}
}
@@ -0,0 +1,93 @@
package com.yy.vip.pk.skin
{
import flash.display.GradientType;
import org.flexlite.domCore.dx_internal;
import org.flexlite.domUI.components.VScrollBar;
import org.flexlite.domUI.skins.VectorSkin;
use namespace dx_internal;
/**
* 垂直滚动条thumb默认皮肤
* @author DOM
*/
public class NoticeVScrollBarThumbSkin extends VectorSkin
{
public function NoticeVScrollBarThumbSkin()
{
states = ["up","over","down","disabled"];
this.currentState = "up";
this.height = 30;
this.width = 11;
}
/**
* @inheritDoc
*/
override protected function updateDisplayList(w:Number, h:Number):void
{
super.updateDisplayList(w, h);
graphics.clear();
switch (currentState)
{
case "up":
case "disabled":
case "down":
/*drawRoundRect(
0, 0, w, h, 10,
borderColors[0], .8,
horizontalGradientMatrix(0, 0, w, h ),
GradientType.LINEAR, null,
{ x: 1, y: 1, w: w , h: h , r: 0}); */
drawRoundRect(
1, 1,w-2 , h-2, 7,
[0xcfcfcf,0xcfcfcf], 1,
horizontalGradientMatrix(1, 1, w-2 , h-2),GradientType.LINEAR);
//drawLine(w-1,0,w-1,h,bottomLineColors[0]);
break;
case "over":
/*drawRoundRect(
0, 0, w, h, 0,
borderColors[1], 1,
horizontalGradientMatrix(0, 0, w, h ),
GradientType.LINEAR, null,
{ x: 1, y: 1, w: w - 2, h: h - 2, r: 0});
drawRoundRect(
1, 1, w - 2, h - 2, 0,
[fillColors[2],fillColors[3]], 1,
horizontalGradientMatrix(1, 1, w - 2, h - 2),GradientType.LINEAR);
drawLine(w-1,0,w-1,h,bottomLineColors[1]);*/
drawRoundRect(
1, 1,w-2 , h-2, 7,
[0xcfcfcf,0xcfcfcf], 1,
horizontalGradientMatrix(1, 1, w-2 , h-2),GradientType.LINEAR);
//drawLine(w-1,0,w-1,h,bottomLineColors[0]);
break;
case "down":
/*drawRoundRect(
0, 0, w, h, 0,
borderColors[2], 1,
horizontalGradientMatrix(0, 0, w, h ),
GradientType.LINEAR, null,
{ x: 1, y: 1, w: w - 2, h: h - 2, r: 0});
drawRoundRect(
1, 1, w - 2, h - 2, 0,
[fillColors[4],fillColors[5]], 1,
horizontalGradientMatrix(1, 1, w - 2, h - 2),GradientType.LINEAR);
drawLine(w-1,0,w-1,h,bottomLineColors[2]);*/
drawRoundRect(
1, 1,w-2 , h-2, 7,
[0xcfcfcf,0xcfcfcf], 1,
horizontalGradientMatrix(1, 1, w-2 , h-2),GradientType.LINEAR);
break;
}
//this.alpha = currentState=="disabled"?0.5:1;
this.alpha = 1;
}
}
}
@@ -0,0 +1,36 @@
package com.yy.vip.pk.skin
{
import flash.display.GradientType;
import org.flexlite.domCore.dx_internal;
import org.flexlite.domUI.skins.VectorSkin;
use namespace dx_internal;
/**
* 垂直滚动条track默认皮肤
* @author DOM
*/
public class NoticeVScrollBarTrackSkin extends VectorSkin
{
public function NoticeVScrollBarTrackSkin()
{
super();
states = ["up","over","down","disabled"];
this.currentState = "up";
this.minHeight = 15;
this.width = 11;
}
/**
* @inheritDoc
*/
override protected function updateDisplayList(w:Number, h:Number):void
{
super.updateDisplayList(w, h);
graphics.clear();
}
}
}
@@ -0,0 +1,66 @@
package com.yy.vip.pk.videolists
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.system.Security;
//[SWF(width=260,height=200,backgroundColor=0xe7e7e7,frameRate=15)]
[SWF(width=260,height=266,backgroundColor=0xe7e7e7,frameRate=15)]
public class MainVideoLists extends MovieClip
{
public function MainVideoLists()
{
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if(stage)
init();
else
this.addEventListener(Event.ADDED_TO_STAGE,this.init);
Security.loadPolicyFile("http://vipweb.bs2cdn.yy.com/crossdomain.xml");
}
private function init(event : Event = null):void{
try{
this.stage.addEventListener(MouseEvent.RIGHT_CLICK,rightClickHandler);
}
catch(e:Error)
{
}
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
var t : String = this.loaderInfo.parameters.t;
var loader :Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteHandler);
loader.load(new URLRequest("http://show.vip.yy.com/clientpkchatpub/notices/MainVideoListsCore.swf?t="+t));
}
protected function ioErrorHandler(event:IOErrorEvent):void
{
}
protected function loadCompleteHandler(event:Event):void
{
addChild(event.currentTarget.loader);
}
protected function rightClickHandler(event:MouseEvent):void
{
event.stopImmediatePropagation();
}
}
}
@@ -0,0 +1,136 @@
package com.yy.vip.pk.videolists
{
import com.yy.vip.pk.diamondrank.service.AppService;
import com.yy.vip.pk.event.JsCallEvent;
import com.yy.vip.pk.service.JsService;
import com.yy.vip.pk.videolists.module.ListGroup;
import flash.display.Bitmap;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.system.Security;
import org.flexlite.domCore.Injector;
import org.flexlite.domUI.core.Theme;
import org.flexlite.domUI.skins.themes.VectorTheme;
//[SWF(width=260,height=200,backgroundColor=0xe7e7e7,frameRate=15)]
[SWF(width=260,height=266,backgroundColor=0xe7e7e7,frameRate=15)]
public class MainVideoListsCore extends MovieClip
{
private var _listGroup:ListGroup;
//private var USER_SIZE:Number = 170;
//private var ZHUBO_SIZE:Number = 200;
private var USER_SIZE:Number = 236;
private var ZHUBO_SIZE:Number = 266;
public function MainVideoListsCore()
{
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if(stage)
init();
else
this.addEventListener(Event.ADDED_TO_STAGE,this.init);
Security.loadPolicyFile("http://vipweb.bs2cdn.yy.com/crossdomain.xml");
Injector.mapClass(Theme,VectorTheme);
if(!stage)
{
this.addEventListener(Event.ADDED_TO_STAGE,initHandler);
}
else
{
this.initHandler();
}
}
protected function initHandler(event:Event = null):void
{
JsService.getInstance().addEventListener(JsCallEvent.CALL_BY_MAIN_SWF,callByMainHandler);
JsService.getInstance().setSwfSize(JsService.PUBLIC_TOP_VIDEOS_SWF_ID,USER_SIZE);
JsService.getInstance().start(JsService.PUBLIC_TOP_VIDEOS_SWF_ID);
JsService.getInstance().callMainSwf(JsService.CMD_GET_INIT_VIDEO_LIST_DATA,JsService.PUBLIC_TOP_VIDEOS_SWF_ID);
}
private function init(event : Event = null):void{
try{
try{
this.stage.addEventListener(MouseEvent.RIGHT_CLICK,rightClickHandler);
}
catch(e:Error)
{
}
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.addEventListener(Event.RESIZE,resizeHandler);
_listGroup = new ListGroup();
this.addChild(_listGroup);
resizeHandler(null);
_listGroup.x = 0;
_listGroup.y = 0;
}
catch(e:Error)
{
}
}
protected function resizeHandler(event:Event):void
{
if(_listGroup)
{
_listGroup.width = this.stage.stageWidth;
_listGroup.height = this.stage.stageHeight;
_listGroup.update();
}
}
protected function rightClickHandler(event:MouseEvent):void
{
event.stopImmediatePropagation();
}
protected function callByMainHandler(event:JsCallEvent):void
{
if(event.cmd == JsService.CMD_GET_INIT_VIDEO_LIST_DATA)
{
this.seInfo(event.data[0],event.data[1],event.data[2],event.data[3]);
}
}
public function seInfo(tid:uint,anchorLeftUid:uint,anchorRightUid:uint,currentUserUid:uint):void{
AppService.getInstance().tid = tid;
AppService.getInstance().anchorLeftUid = anchorLeftUid;
AppService.getInstance().anchorRightUid = anchorRightUid;
AppService.getInstance().currentUserUid = currentUserUid;
if(anchorLeftUid == currentUserUid || anchorRightUid == currentUserUid)
{
AppService.getInstance().isZhubo = true;
JsService.getInstance().setSwfSize(JsService.PUBLIC_TOP_VIDEOS_SWF_ID,ZHUBO_SIZE);
}
else
{
AppService.getInstance().isZhubo = false;
JsService.getInstance().setSwfSize(JsService.PUBLIC_TOP_VIDEOS_SWF_ID,USER_SIZE);
}
AppService.getInstance().dispatchEvent(new Event(AppService.ANCHOR_CHANGE_EVENT));
}
}
}
@@ -0,0 +1,225 @@
package com.yy.vip.pk.videolists.module
{
import com.yy.vip.pk.base.BaseGroup;
import com.yy.vip.pk.base.layout.HLayout;
import com.yy.vip.pk.base.layout.VLayout;
import com.yy.vip.pk.components.TabButtonMiddel;
import com.yy.vip.pk.service.DataReportService;
import com.yy.vip.pk.service.JsService;
import com.yy.vip.pk.util.BULoader;
import flash.display.Bitmap;
import flash.display.Loader;
import flash.display.Shape;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.external.ExternalInterface;
import flash.filters.DropShadowFilter;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import org.flexlite.domUI.core.UIComponent;
import org.flexlite.domUI.layouts.HorizontalLayout;
public class ListGroup extends UIComponent
{
private var _tabBtns:Array = new Array();
private var _header:HLayout;
private var _videoList:VideoList;
private var sp:Shape;
private var core:BaseGroup;
public function ListGroup()
{
super();
}
private var bannerUI :UIComponent = new UIComponent();
override protected function createChildren():void
{
super.createChildren();
drawBg();
bannerUI.addEventListener(MouseEvent.CLICK,clickHandler);
bannerUI.x = 15;
bannerUI.y = 10;
this.addChild(bannerUI);
var _loader:BULoader = new BULoader("http://vip.yy.com/vip/actpushs?adNo=60028",function completeHandler(res:Object,res1:Object):void{
if(res.code == 0){
if(res.data && res.data.length > 0)
{
var obj :Object = res.data[0];
var url : String = obj.images;
var des : String = obj.desc;
var imageLinks : String = obj.imageLinks;
if(url){
var loader :Loader =new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,loadErrorHandler);
loader.load(new URLRequest(url));
bannerUI.addChild(loader);
if(imageLinks && imageLinks.split("+").length > 0)
{
var channelIds : Array = imageLinks.split("+");
bannerUI.mouseChildren = false;
bannerUI.buttonMode = true;
bannerUI.useHandCursor = true;
var channleId :Number = Number(channelIds[0]);
var subChannleId :Number = Number(channleId);
if(channelIds.length > 1)
subChannleId = Number(channelIds[1]);
bannerUI.addEventListener(MouseEvent.CLICK,function imageLinksHandler(e:MouseEvent):void{
ExternalInterface.call("callExternal","IChannel_JoinChannel",0,channleId,subChannleId,subChannleId,"");
});
}
}
}
}
});
_loader.timestamp = true;
var params:Object = {};
_loader.dataFormat ="JSON";
_loader.method = "get";
_loader.start();
this.core = new BaseGroup();
this.core.y = 66;
this.addChild(this.core);
_header = new HLayout();
_header.width = 260;
_header.x = 0;
_header.y = 10;
_header.height = 25;
(_header.layout as HorizontalLayout).horizontalAlign = "center";
(_header.layout as HorizontalLayout).gap = 0;
this.core.addElement(_header);
_videoList = new VideoList();
_videoList.y = _header.height + 1;
this.core.addElement(_videoList);
var tabBtn1:TabButtonMiddel = new TabButtonMiddel();//礼物栏按钮
tabBtn1.fontSize = 12;
tabBtn1.tabWidth = 75;
tabBtn1.tabHeight = 25;
tabBtn1.style = TabButtonMiddel.STYLE_2;
tabBtn1.clickManager = true;
_tabBtns.push(tabBtn1);
tabBtn1.text = "公会惩罚";
_header.addElement(tabBtn1);
tabBtn1.selected();
tabBtn1.buttonMode = true;
tabBtn1.useHandCursor = true;
tabBtn1.mouseChildren = false;
tabBtn1.addEventListener(MouseEvent.CLICK,changeHandler);
tabBtn1.listView = _videoList;
_videoList.selectTad(1);
var tabBtn2:TabButtonMiddel= new TabButtonMiddel();//我的包裹按钮
tabBtn2.tabWidth = 75;
tabBtn2.tabHeight = 25;
tabBtn2.fontSize = 12;
tabBtn2.style = TabButtonMiddel.STYLE_2;
tabBtn2.clickManager = true;
_tabBtns.push(tabBtn2);
tabBtn2.text = "最热惩罚";
_header.addElement(tabBtn2);
tabBtn2.buttonMode = true;
tabBtn2.useHandCursor = true;
tabBtn2.mouseChildren = false;
tabBtn2.addEventListener(MouseEvent.CLICK,changeHandler);
tabBtn2.listView = _videoList;
var tabBtn3:TabButtonMiddel= new TabButtonMiddel();//我的包裹按钮
tabBtn3.tabWidth = 75;
tabBtn3.tabHeight = 25;
tabBtn3.fontSize = 12;
tabBtn3.style = TabButtonMiddel.STYLE_2;
tabBtn3.clickManager = true;
_tabBtns.push(tabBtn3);
tabBtn3.text = "主播惩罚";
_header.addElement(tabBtn3);
tabBtn3.buttonMode = true;
tabBtn3.useHandCursor = true;
tabBtn3.mouseChildren = false;
tabBtn3.addEventListener(MouseEvent.CLICK,changeHandler);
tabBtn3.listView = _videoList;
}
protected function loadErrorHandler(event:IOErrorEvent):void
{
}
protected function clickHandler(event:Event):void
{
JsService.getInstance().callMainSwf(JsService.CMD_CLICK_VIDEOS_BANNE,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,null);
}
private function drawBg():void
{
var coreWidth : Number = this.width - 10;
var coreHeight : Number = this.height - 14;
if(!sp)
{
var spUI:UIComponent = new UIComponent();
sp = new Shape();
sp.filters = [new DropShadowFilter(4,90,0x000000,0.1)];
this.addChild(spUI);
spUI.addChild(sp);
}
sp.graphics.clear();
sp.graphics.beginFill(0xfcfcfc,1);
sp.graphics.drawRoundRect(7,7,coreWidth,coreHeight,10,10);
sp.graphics.endFill();
}
private function changeHandler(event:MouseEvent):void{
event.stopPropagation();
for(var i:uint = 0;i < _tabBtns.length;i++){
if(_tabBtns[i] == event.currentTarget){
_videoList.selectTad(i+1);
reportClick(i);
return;
}
}
}
private function reportClick(i:uint):void
{
if(i == 0)
{
JsService.getInstance().callMainSwf(JsService.CMD_DATA_REPORT,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,{type:DataReportService.DATA_TYPE_CLICK_CHENFA_VDEIOS_GONGHUI,remark:"工会惩罚主播视频菜单"});
}
else if(i == 1)
{
JsService.getInstance().callMainSwf(JsService.CMD_DATA_REPORT,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,{type:DataReportService.DATA_TYPE_CLICK_CHENFA_VDEIOS_HOT,remark:"最热惩罚主播视频菜单"});
}
else if(i == 2)
{
JsService.getInstance().callMainSwf(JsService.CMD_DATA_REPORT,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,{type:DataReportService.DATA_TYPE_CLICK_CHENFA_VDEIOS_ZHUBO,remark:"主播惩罚视频菜单"});
}
}
public function update():void
{
drawBg();
}
}
}
@@ -0,0 +1,60 @@
package com.yy.vip.pk.videolists.module
{
import com.yy.vip.pk.util.UnicodeCheck;
import flash.display.Sprite;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.core.UIComponent;
public class TipsPanel extends UIComponent
{
private static var _msg_tlp:String = "<textformat leading='4'><font color='#333333' face='SimSun' size='12'>{0}\n</font>" +
"<font color='#999999' face='SimSun' size='12'>上传时间:{1}\n共有</font>" +
"<font color='#f63055' face='SimSun' size='12'>{2}</font>" +
"<font color='#999999' face='SimSun' size='12'>人看过</font></textformat>";
private var _bgSpr:Sprite;
private var _lab:Label;
public function TipsPanel()
{
this.mouseChildren = this.mouseEnabled = false;
_bgSpr = new Sprite();
this.addChild(_bgSpr);
_lab = new Label();
_lab.x = 5;
_lab.y = 5;
_lab.width = 140;
_lab.maxWidth = 140;
_lab.height = 70;
_lab.truncateToFit = false;
this.addChild(_lab);
}
public function setData(obj:Object):void{
if(obj){
var date:Date;
if(obj.createDate){
date = new Date(obj.createDate);
}
var nameStr:String = UnicodeCheck.strProcessing(obj.nickName,18,true);
var timeStr:String = date ? date.fullYear+"."+(date.month+1)+"."+date.date : "";
var msg:String = _msg_tlp;
msg = msg.replace("{0}",nameStr);
msg = msg.replace("{1}",timeStr);
msg = msg.replace("{2}",obj.count);
_lab.htmlText = msg;
this.width = _lab.textWidth + 10;
this.height = _lab.textHeight + 10;
_bgSpr.graphics.clear();
_bgSpr.graphics.lineStyle(1,0xA42CCB,1,true);
_bgSpr.graphics.beginFill(0xFFFFFF,1);
_bgSpr.graphics.drawRoundRect(0,0,this.width,this.height,6,6);
_bgSpr.graphics.endFill();
}
}
}
}
@@ -0,0 +1,133 @@
package com.yy.vip.pk.videolists.module
{
import flash.display.Bitmap;
import flash.display.Loader;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLRequest;
import flash.system.LoaderContext;
import flash.text.TextFormatAlign;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.core.UIComponent;
public class VideoItem extends UIComponent
{
private var _itemObj:Object;
private var _url:String;
private var _loader:Loader;
private var _image:Bitmap;
private var swidth:Number;
private var sheight:Number;
private var _nameLabel:Label;
public function VideoItem()
{
this.mouseChildren = false;
this.buttonMode = true;
this.width = 110;
this.height = 103;
swidth = 110;
sheight = 80;
drawBg();
_nameLabel = new Label();
_nameLabel.fontFamily = "simsun";
_nameLabel.textAlign = TextFormatAlign.CENTER;
_nameLabel.y = sheight + 8;
_nameLabel.width = swidth;
_nameLabel.maxWidth = swidth;
_nameLabel.height = 20;
_nameLabel.truncateToFit = false;
_nameLabel.textColor = 0x95899d;
this.addChild(_nameLabel);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,onLoaderErrorHandler);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
}
protected function onLoaderErrorHandler(event:IOErrorEvent):void
{
}
private function drawBg():void{
}
public function get itemObj():Object
{
return _itemObj;
}
public function set itemObj(value:Object):void
{
_itemObj = value;
}
private function onLoaderComplete(e:Event):void{
var loader:Loader;
loader= Loader(e.target.loader);
if(_image && _image.bitmapData)
_image.bitmapData.dispose();
if(_image && _image.parent)
_image.parent.removeChild(_image);
_image = Bitmap(loader.content);
_image.smoothing = true;
//110 80
var rx:Number = swidth / loader.contentLoaderInfo.width;
var ry:Number = sheight / loader.contentLoaderInfo.height;
_image.scaleY = _image.scaleX = rx < ry ? rx : ry;
_image.x = (swidth - _image.width) / 2;
_image.y = (sheight - _image.height) / 2;
addChild(_image);
_image.visible = true;
}
public function unloadAndStop():void
{
if(_loader)
_loader.unloadAndStop();
if(_image && _image.bitmapData)
_image.bitmapData.dispose();
if(_image && _image.parent)
_image.parent.removeChild(_image);
}
public function load(obj:Object,context:LoaderContext):void{
if(!_itemObj || _itemObj.pic != obj.pic){
_itemObj = obj;
_nameLabel.text = _itemObj.name;
if(_image && _image.bitmapData)
_image.bitmapData.dispose();
if(_image && _image.parent)
_image.parent.removeChild(_image);
if(_itemObj.pic)
_loader.load(new URLRequest(_itemObj.pic),new LoaderContext(true));
}
}
}
}
@@ -0,0 +1,305 @@
package com.yy.vip.pk.videolists.module
{
import com.yy.vip.pk.base.BaseGroup;
import com.yy.vip.pk.diamondrank.service.AppService;
import com.yy.vip.pk.service.DataReportService;
import com.yy.vip.pk.service.JsService;
import com.yy.vip.pk.skin.NoticeScrollerSkin;
import com.yy.vip.pk.util.BULoader;
import com.yy.vip.pk.util.JSONUtil;
import flash.events.Event;
import flash.events.MouseEvent;
import org.flexlite.domUI.components.Label;
import org.flexlite.domUI.components.Scroller;
import org.flexlite.domUI.core.UIComponent;
public class VideoList extends UIComponent
{
protected var _listUI:UIComponent;
protected var _listBG:BaseGroup;
private var _scrollPanel:Scroller;
private var _tab:uint = 1;
private var _nullBg:MC_PunishBg_170823;
private var _uploadBtn:MC_UploadBtn_170823_v2;
private var _recommendBtn:MC_RecommendBtn_170823_v2;
private var _refreshLab:Label;
private var _refreshBtn:MC_RefreshBtn_170823;
private var _loader:BULoader;
private var _videoItemsArr:Array;
private static var _tips:TipsPanel;
public function VideoList()
{
this.width = 260;
this.height = 170;
_videoItemsArr = new Array();
_loader = new BULoader(null,completeHandler,this.errorHandler);
_refreshLab = new Label();
_refreshLab.fontFamily = "simsun";
_refreshLab.x = 20;
_refreshLab.y = 15;
_refreshLab.width = 150;
_refreshLab.maxWidth = 150;
_refreshLab.height = 20;
_refreshLab.truncateToFit = false;
_refreshLab.textColor = 0x95899d;
_refreshLab.text = "下拉可查看更多惩罚哦~";
//this.addChild(_refreshLab);
_refreshBtn = new MC_RefreshBtn_170823();
_refreshBtn.x = 200;
_refreshBtn.y = _refreshLab.y + 2;
_refreshBtn.addEventListener(MouseEvent.CLICK,refreshHandler);
//this.addChild(_refreshBtn);
_nullBg = new MC_PunishBg_170823();
_nullBg. x = (this.width - _nullBg.width) / 2;
_nullBg.y = 34;
_nullBg.visible = false;
this.addChild(_nullBg);
_listUI = new UIComponent();
_listUI.y = 20;
_listUI.width = 250;
_listUI.height = 100;
this.addChild(_listUI);
_listBG = new BaseGroup();
_listBG.width = _listUI.width;
_listBG.height = _listUI.height + 5;
_listUI.addChild(_listBG);
_scrollPanel = new Scroller();
_scrollPanel.viewport = _listBG;
_scrollPanel.width = _listUI.width + 10;
_scrollPanel.height = _listUI.height;
_listUI.addChild(_scrollPanel);
_scrollPanel.skinName = NoticeScrollerSkin;
_scrollPanel.verticalScrollBar.fixedThumbSize = true;
_recommendBtn = new MC_RecommendBtn_170823_v2();
_recommendBtn.mouseChildren = false;
_recommendBtn.buttonMode = true;
_recommendBtn.useHandCursor = true;
_recommendBtn.x = 134;
_recommendBtn.y = 132;
_recommendBtn.addEventListener(MouseEvent.CLICK,recommendHandler);
this.addChild(_recommendBtn);
_uploadBtn = new MC_UploadBtn_170823_v2();
_uploadBtn.mouseChildren = false;
_uploadBtn.buttonMode = true;
_uploadBtn.useHandCursor = true;
_uploadBtn.x = 38;
_uploadBtn.y = 132;
_uploadBtn.addEventListener(MouseEvent.CLICK,uploadHandler);
this.addChild(_uploadBtn);
if(!_tips)
{
_tips = new TipsPanel();
}
this.addEventListener(MouseEvent.MOUSE_OVER,overHandler);
this.addEventListener(MouseEvent.MOUSE_OUT,outHandler);
this.addEventListener(MouseEvent.CLICK,clickHandler);
AppService.getInstance().addEventListener(AppService.ANCHOR_CHANGE_EVENT,changeHandler);
btnStatus();
}
private function recommendHandler(event:MouseEvent):void{
JsService.getInstance().callMainSwf(JsService.OPEN_URL,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,"http://test.yy.com/pkacttest/1708videoupload/index.html");
}
private function uploadHandler(event:MouseEvent):void{
JsService.getInstance().callMainSwf(JsService.OPEN_URL,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,"http://test.yy.com/pkacttest/1708videoupload/index.html");
}
private function changeHandler(event:Event):void{
btnStatus();
}
private function btnStatus():void{
if(AppService.getInstance().currentUserUid > 0 &&
(AppService.getInstance().anchorLeftUid == AppService.getInstance().currentUserUid ||
AppService.getInstance().anchorRightUid == AppService.getInstance().currentUserUid)){
_uploadBtn.visible = _recommendBtn.visible = true;
}else{
_uploadBtn.visible = _recommendBtn.visible = false;
}
}
private function clickHandler(event:MouseEvent):void{
if(event.target == "[object VideoItem]"){
JsService.getInstance().callMainSwf(JsService.CMD_SHOW_VIDEO_PLAYER,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,event.target.itemObj);
JsService.getInstance().callMainSwf(JsService.CMD_DATA_REPORT,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,{type:DataReportService.DATA_TYPE_PLAY_CHENGFA_VIDEO,remark:"点击播放惩罚视频"});
}
}
private function overHandler(event:MouseEvent):void{
if(event.target == "[object VideoItem]"){
this.addChild(_tips);
_tips.setData(event.target.itemObj);
if(event.target.x < 11){
_tips.x = 110;
}else{
_tips.x = 10;
}
_tips.y = 50;
_tips.visible = true;
}else{
_tips.visible = false;
}
}
private function outHandler(event:MouseEvent):void{
_tips.visible = false;
}
private function refreshHandler(event:MouseEvent):void{
selectTad(_tab);
}
private function clear():void{
_nullBg.visible = true;
for(var i:uint = 0; i < _videoItemsArr.length;i++){
if(_videoItemsArr[i] && _videoItemsArr[i].parent){
_videoItemsArr[i].parent.removeElement(_videoItemsArr[i]);
}
}
}
private function loadData():void{
var urlStr: String = "http://pk.yy.com/service/web/anchorvideo/index";
_loader.source = urlStr;
_loader.timestamp = true;
var params:Object = {};
params.tid = AppService.getInstance().tid;
params.left = AppService.getInstance().anchorLeftUid;
params.right = AppService.getInstance().anchorRightUid;
params.tab = _tab;
_loader.params = params;
_loader.dataFormat ="JSON";
_loader.method = "get";
_loader.start();
}
private function errorHandler(rsp:Object,s:Object):void
{
JsService.getInstance().callMainSwf(JsService.DEBUG_LOG,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,"请求惩罚视频数据返回错误:" + rsp.toString());
}
private function completeHandler(rsp:Object,s:Object):void
{
try
{
JsService.getInstance().callMainSwf(JsService.DEBUG_LOG,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,"请求惩罚视频数据返回");
}
catch(e:Error)
{
JsService.getInstance().callMainSwf(JsService.DEBUG_LOG,JsService.PUBLIC_TOP_VIDEOS_SWF_ID,"请求惩罚视频数据返回错误");
}
if(rsp)
{
if(rsp.hasOwnProperty("result") && rsp.result == true){
if(rsp.hasOwnProperty("data") && rsp.data.length > 0){
_nullBg.visible = false;
createList(rsp.data)
return;
}
}
}
}
private function createList(obj:Object):void{
var i:uint;
var id:uint = 0;
for(i = 0; i < _videoItemsArr.length;i++){
if(_videoItemsArr[i] && _videoItemsArr[i].parent){
_videoItemsArr[i].parent.removeElement(_videoItemsArr[i]);
}
}
for(i = 0; i < obj.length;i++){
if(obj[i].hasOwnProperty("pic")){
if(i >= _videoItemsArr.length){
var videoItem:VideoItem = new VideoItem();
_videoItemsArr.push(videoItem);
}
_videoItemsArr[id].x = id % 2 * (_videoItemsArr[id].width + 9) + 15;
_videoItemsArr[id].y = int(id / 2) * (_videoItemsArr[id].height + 10);
//_videoItemsArr[id].load(obj[i],AppService.getInstance().context);
_videoItemsArr[id].load(obj[i],null);
_listBG.addElement(_videoItemsArr[id]);
id++;
}
}
}
public function selectTad(tab:uint):void{
_tab = tab;
clear();
loadData();
//ceshi();
}
private function ceshi():void{
var str:String = '{"result": true, "code": 0,"desc": null, "data":[' +
' {"id": 1,"filename": "刘晓霞《数阵.mp4","name": "脱衣舞","uid": 50013335,"auditStatus": null,"auditReson": null,' +
'"transVideoUrl": null,"videoUrl": "http://pkvideo.bs2dl.yy.com/刘晓霞《数阵》.mp4",' +
'"count": 999,"tid": 12345, "asid": 80012,"auditBy": null,"createBy": null, "createDate": 1503480550292,' +
'"sid": 123412235,"nickName": "80012-xxxxx","pic":"50016139"},' +
' {"id": 2,"filename": "刘晓霞《数阵.mp4","name": "脱衣舞","uid": 50013335,"auditStatus": null,"auditReson": null,' +
'"transVideoUrl": null,"videoUrl": "http://pkvideo.bs2dl.yy.com/刘晓霞《数阵》.mp4",' +
'"count": 999,"tid": 12345, "asid": 80012,"auditBy": null,"createBy": null, "createDate": 1303480550292,' +
'"sid": 123412235,"nickName": "80012-xxxxx","pic":"1362154759"},' +
' {"id": 1,"filename": "刘晓霞《数阵.mp4","name": "脱衣舞","uid": 50013335,"auditStatus": null,"auditReson": null,' +
'"transVideoUrl": null,"videoUrl": "http://pkvideo.bs2dl.yy.com/刘晓霞《数阵》.mp4",' +
'"count": 999,"tid": 12345, "asid": 80012,"auditBy": null,"createBy": null, "createDate": 1403480550292,' +
'"sid": 123412235,"nickName": "80012-xxxxx","pic":"50016139"},' +
' {"id": 2,"filename": "刘晓霞《数阵.mp4","name": "脱衣舞","uid": 50013335,"auditStatus": null,"auditReson": null,' +
'"transVideoUrl": null,"videoUrl": "http://pkvideo.bs2dl.yy.com/刘晓霞《数阵》.mp4",' +
'"count": 999,"tid": 12345, "asid": 80012,"auditBy": null,"createBy": null, "createDate": 1603480550292,' +
'"sid": 123412235,"nickName": "80012-xxxxx","pic":"1362154759"}' +
']}';
var obj:Object = JSONUtil.decode(str);
createList(obj.data);
}
}
}
/**
* {
"result": true,
"code": 0,
"desc": null,
"data": [
{
"id": 1,
"filename": "刘晓霞《数阵.mp4",
"name": "脱衣舞",
"uid": 50013335,
"auditStatus": null,
"auditReson": null,
"transVideoUrl": null,
"videoUrl": "http://pkvideo.bs2dl.yy.com/刘晓霞《数阵》.mp4",
"count": 999,
"tid": 12345,
"asid": 80012,
"auditBy": null,
"createBy": null,
"createDate": null,
"sid": 123412235,
"nickName": "80012-xxxxx",
"pic":"http://234354365546"
}
]
}**/
@@ -0,0 +1,307 @@
package com.yy.vip.pk.yyshow
{
import com.yy.vip.pk.event.JsCallEvent;
import com.yy.vip.pk.service.JsService;
import com.yy.vip.pk.util.DeposeUtil;
import com.yy.vip.pk.util.UrlUtil;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.system.Security;
import flash.text.TextField;
import flash.utils.clearTimeout;
import flash.utils.setTimeout;
[SWF(width=260,height=75,frameRate=15)]
public class YYShowBrocast extends MovieClip
{
private var it : uint
private var logoLoader :Loader;
private var bgLoader:Loader;
private var bgSprite:Sprite;
private var label1:TextField;
private var label2:TextField;
private var iconLoader:Loader;
private var label3:TextField;
private var label4:TextField;
private var data:Object;
private var mainSprite:Sprite;
private var logoSprite:Sprite;
private var bgLoaderUI:Sprite;
private var iconLoaderUI:Sprite;
public function YYShowBrocast()
{
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if(stage)
initHandler();
else
this.addEventListener(Event.ADDED_TO_STAGE,this.initHandler);
}
protected function initHandler(event:Event = null):void
{
this.visible = false;
bgSprite = new Sprite();
this.addChild(bgSprite);
logoSprite = new Sprite();
bgSprite.addChild(logoSprite);
mainSprite = new Sprite();
mainSprite.x = 65;
bgSprite.addChild(mainSprite);
label1 = new TextField();
label2 = new TextField();
label3 = new TextField();
label4 = new TextField();
mainSprite.addChild(label1);
mainSprite.addChild(label2);
mainSprite.addChild(label3);
mainSprite.addChild(label4);
this.addEventListener(MouseEvent.CLICK,clickHandler);
JsService.getInstance().addEventListener(JsCallEvent.CALL_BY_MAIN_SWF,callByMainSwfHandler);
JsService.getInstance().start(JsService.PUBLIC_TOP_YYSHOW_SWF_ID);
try{
this.stage.addEventListener(MouseEvent.RIGHT_CLICK,rightClickHandler);
}
catch(e:Error)
{
}
}
protected function rightClickHandler(event:MouseEvent):void
{
event.stopImmediatePropagation();
}
protected function clickHandler(event:MouseEvent):void
{
if(this.data && this.data.url)
JsService.getInstance().callMainSwf(JsService.CMD_SHOW_ETIT_NOTICE_PANEL,JsService.PUBLIC_TOP_YYSHOW_SWF_ID,this.data.url);
}
protected function callByMainSwfHandler(event:JsCallEvent):void
{
var data:Object = event.data;
this.data = data;
if(event.cmd == JsService.CMD_BROCAST_YYSHOW)
{
this.visible = false;
bgSprite.graphics.clear();
bgSprite.graphics.beginFill(data.bgColor,1);
bgSprite.graphics.drawRect(0,0,260,75);
bgSprite.graphics.endFill();
clearLoader();
var bgUrl:String = data.bgUrl;
if(!bgLoaderUI)
{
bgLoaderUI = new Sprite()
bgSprite.addChildAt(bgLoaderUI,0);
}
if(!bgLoader){
bgLoader = new Loader();
bgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,bgCompleteHandler)
bgLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
bgLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
bgLoaderUI.addChild(bgLoader);
}
if(bgUrl.indexOf("http")!=-1 && (bgUrl.indexOf(".png")!=-1 || bgUrl.indexOf(".jpg")!=-1))
bgLoader.load(new URLRequest(UrlUtil.checkHttps(bgUrl)));
label1.width = 80;
label1.x = 15;
label1.y = 10;
label1.textColor = uint(data.msgInfo.tip1Color);
label1.text = data.msgInfo.tip1;
if(!iconLoaderUI)
{
iconLoaderUI = new Sprite()
mainSprite.addChild(iconLoaderUI);
}
if(!iconLoader){
iconLoader = new Loader();
iconLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
iconLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,iconLoaderComplete);
iconLoaderUI.addChild(iconLoader);
}
iconLoaderUI.x = label1.x + label1.textWidth + 20;
iconLoaderUI.y = 10;
if(data.msgInfo.img )
{
var iconUrl:String = data.msgInfo.img;
if(iconUrl.indexOf("http")!=-1 && (iconUrl.indexOf(".png")!=-1 || iconUrl.indexOf(".jpg")!=-1))
iconLoader.load(new URLRequest(UrlUtil.checkHttps(iconUrl)));
}
label2.width = 90;
label2.x = iconLoaderUI.x + 30;
label2.y = 10;
label2.textColor = uint(data.msgInfo.nickColor);
label2.text = data.msgInfo.nick;
label3.width = 90;
label3.x = 15;
label3.y = 36;
label3.textColor = uint(data.msgInfo.roleNameColor);
label3.text = data.msgInfo.roleName;
label4.width = 90;
label4.x = label3.x + label3.textWidth + 5;
label4.y = 36;
label4.textColor = uint(data.msgInfo.roleTipColor);
label4.text = data.msgInfo.roleTip;
if(data.logo)
{
if(!logoLoader)
{
logoLoader = new Loader();
logoLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
logoLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
logoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,logoLoaderCompleteHandler);
}
if(data.logo.indexOf("http")!=-1 && (data.logo.indexOf(".png")!=-1 || data.logo.indexOf(".jpg")!=-1))
logoLoader.load(new URLRequest(UrlUtil.checkHttps(data.logo)));
}
}
}
protected function logoLoaderCompleteHandler(event:Event):void
{
if(logoLoader && logoSprite)
{
logoLoader.x = 3;
logoLoader.y = 3;
logoLoader.scaleX = logoLoader.scaleY = 0.85;
logoSprite.addChild(logoLoader);
}
if(logoLoader && logoLoader.contentLoaderInfo)
{
logoLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
logoLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
logoLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,logoLoaderCompleteHandler);
}
}
protected function iconLoaderComplete(event:Event):void
{
if(iconLoaderUI && iconLoader)
iconLoaderUI.addChild(iconLoader);
if(iconLoader)
{
iconLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
iconLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
iconLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,iconLoaderComplete);
}
}
protected function bgCompleteHandler(event:Event):void
{
if(!bgLoader)
return;
bgLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,bgCompleteHandler)
bgLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
bgLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
this.mouseEnabled = this.buttonMode = this.useHandCursor = this.data.url?true:false;
JsService.getInstance().showYYShowDiv();
this.visible = true;
try{
var contentWidth:Number = bgLoader.contentLoaderInfo.width;
var contentHeight:Number = bgLoader.contentLoaderInfo.height;
var rx:Number = 260/ contentWidth;
var ry:Number = 75 / contentHeight;
bgLoaderUI.scaleY = ry;
bgLoaderUI.scaleX = rx;
clearTimeout(it);
it = setTimeout(function ():void{
depose();
}
,data.showTime * 1000);
}
catch(e:Error){
depose();
}
}
private function depose():void
{
clearTimeout(it);
clearLoader();
JsService.getInstance().hideYYShowDiv();
}
protected function ioErrorHandler(event:Event):void
{
}
private function clearLoader():void
{
try{
this.visible = false;
clearTimeout(it);
this.mouseEnabled = this.buttonMode = this.useHandCursor = false;
DeposeUtil.removeFromStage(bgLoader);
if(bgLoader)
{
bgLoader.unloadAndStop(true);
bgLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,bgCompleteHandler)
bgLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
bgLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
}
bgLoader = null;
DeposeUtil.removeFromStage(iconLoader);
if(iconLoader)
{
iconLoader.unloadAndStop(true);
iconLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
iconLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
iconLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,iconLoaderComplete);
}
iconLoader = null;
DeposeUtil.removeFromStage(logoLoader);
if(logoLoader)
{
logoLoader.unloadAndStop(true);
logoLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
logoLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
logoLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,logoLoaderCompleteHandler);
}
logoLoader = null;
}
catch(e:Error){
}
}
}
}