⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glllplaylist.as

📁 flex开发的音乐播放程序程序。带歌词功能
💻 AS
📖 第 1 页 / 共 2 页
字号:

package com.ll19.sound {
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	import flash.text.TextFieldAutoSize;
	
	import com.ll19.sound.GlllSound;
	import com.ll19.util.GlllStringUtil;
	import com.ll19.util.GlllToolTip;
	import com.ll19.util.SetMyMask;
	import com.ll19.util.map.IMap;	

	/**
	 * - GL'LL. - 
	 * 
	 * 用在LRC-WAVE播放器中
	 * 用来在场景中生成曲目队列
	 * 用来构建操作按钮
	 * 
	 * @author <a href="http://www.LL19.com/">LL19.com</a>
	 * 
	 */
	public class GlllPlayList extends MovieClip {

		/**
		 * @param myMap 解析之后的XML
		 * @param target 生成的列表所在MC
		 * @param targetMask 列表的遮罩
		 * @param playlist 循环生成播放列表的影片剪辑
		 * @param buttonListMC 向后按钮的影片剪辑
		 * @param buttonListMCN 向前按钮的影片剪辑
		 * @param listButton 按钮生成的影片
		 * @param myTip 提示工具类
		 * @param thisMC this
		 * @param wave 波谱所在的影片位置
		 * @param lrcButton 歌词显示的影片
		 * @param Lyricsitems LRC影片
		 */
		function GlllPlayList(myMap:IMap,target:MovieClip,targetMask:MovieClip,playlist:Object,listButton:MovieClip,buttonListMC:Object,buttonListMCN:Object,wave:MovieClip,thisMC:MovieClip,myTip:GlllToolTip,lrcButton:Object,Lyricsitems:MovieClip) {
			var i:Number;
			var width:Array = new Array();
			var listX:Array = new Array();
			var buttonMC:MovieClip = new buttonListMC();
			buttonMC.x = 0;
			buttonMC.y = 0;
			//按钮 向后
			buttonMC.p.background = true;
			buttonMC.p.backgroundColor = "0xFFFFFF";
			buttonMC.p.textColor = "0x000000";
			buttonMC.p.selectable = false;
			buttonMC.p.mouseEnabled = false;
						
			buttonMC.addEventListener(MouseEvent.MOUSE_OVER, button_mouse_over);
			buttonMC.addEventListener(MouseEvent.MOUSE_OUT, button_mouse_out);
			buttonMC.addEventListener(MouseEvent.MOUSE_DOWN, button_mouse_down);
			buttonMC.addEventListener(MouseEvent.MOUSE_UP, button_mouse_up);
			
			var buttonMCN:MovieClip = new buttonListMCN();
			buttonMCN.x = 0;
			buttonMCN.y = 0;
			//按钮 向前
			buttonMCN.n.background = true;
			buttonMCN.n.backgroundColor = "0xFFFFFF";
			buttonMCN.n.textColor = "0x000000";
			buttonMCN.n.selectable = false;
			buttonMCN.n.mouseEnabled = false;
						
			buttonMCN.addEventListener(MouseEvent.MOUSE_OVER, buttonn_mouse_over);
			buttonMCN.addEventListener(MouseEvent.MOUSE_OUT, buttonn_mouse_out);
			buttonMCN.addEventListener(MouseEvent.MOUSE_DOWN, buttonn_mouse_down);
			buttonMCN.addEventListener(MouseEvent.MOUSE_UP, buttonn_mouse_up);
			
			listButton.addChild(buttonMC);
			listButton.addChild(buttonMCN);
			listButton.buttonMode = true;
			
			for (i = 0;i < myMap.get("songTotal"); i++) {
				//列表
				var listMC:MovieClip = new playlist();
				//				if (myMap.get("typeList")[i] == "cn") {
				//				listMC.musicTitle.htmlText = "* (" + GlllStringUtil.checkDigits((i + 1).toString()) + "/" + GlllStringUtil.checkDigits(myMap.get("songTotal").toString()) + ") " + ". <font size=\"12\">" + myMap.get("titleList")[i] + "</font>";
				//				}
				//				else {
				listMC.musicTitle.htmlText = "* (" + GlllStringUtil.checkDigits((i + 1).toString()) + "/" + GlllStringUtil.checkDigits(myMap.get("songTotal").toString()) + ") " + ". <b>" + myMap.get("titleList")[i] + "</b>";
				//				}
				listMC.musicTitle.background = true;
				listMC.musicTitle.backgroundColor = "0xFFFFFF";
				listMC.musicTitle.textColor = "0x000000";
				listMC.musicTitle.autoSize = TextFieldAutoSize.LEFT;
				listMC.musicTitle.selectable = false;
				listMC.musicTitle.mouseEnabled = false;
				listMC.data = i;
				width.push(listMC.musicTitle.width);
				if (listX[i - 1] == undefined) {
					listMC.x = 0;
				}
				else {
					listMC.x = width[i - 1] + listX[i - 1] + 5;
				}
				listX.push(listMC.x);
				listMC.y = 0;
				listMC.name = "list" + i.toString();
				listMC.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
				listMC.addEventListener(MouseEvent.MOUSE_OUT, mouse_out);
				listMC.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down);
				listMC.addEventListener(MouseEvent.MOUSE_UP, mouse_up);
				target.addChild(listMC);
			}
			
			
			var playing:MovieClip = new playlist();
			playing.musicTitle.text = ""; 
			playing.musicTitle.background = true;
			playing.musicTitle.backgroundColor = "0xFFFFFF";
			playing.musicTitle.textColor = "0x000000";
			playing.musicTitle.autoSize = TextFieldAutoSize.LEFT;
			playing.musicTitle.selectable = false;
			playing.musicTitle.mouseEnabled = true;
			playing.y = 0;
			playing.x = 0;
			playing.name = "playing";
			playing.visible = false;
			target.addChild(playing);
			
			playing.addEventListener(MouseEvent.MOUSE_OVER, playing_mouse_over);
			playing.addEventListener(MouseEvent.MOUSE_OUT, playing_mouse_out);

			
			target.buttonMode = true;			
			SetMyMask.buildMask(target, targetMask);
			if (myMap.get("autoPlayer") == "yes") {
				if (GlllSound.mySound != null) {
					GlllSound.removeListener();
					GlllSound.myPosition = 0;
				}
				GlllSound.soundPlay(myMap, 0, wave, thisMC, myTip, lrcButton, Lyricsitems, target);
				MovieClip(target.getChildByName("playing")).musicTitle.htmlText = "<b><u>" + MovieClip(target.getChildByName("list0")).musicTitle.text + "</u></b>";
				MovieClip(target.getChildByName("playing")).musicTitle.textColor = "0xCC0000";
				MovieClip(target.getChildByName("playing")).musicTitle.backgroundColor = "0xFFFFFF";
				MovieClip(target.getChildByName("playing")).x = MovieClip(target.getChildByName("list0")).x;
				MovieClip(target.getChildByName("playing")).y = MovieClip(target.getChildByName("list0")).y;
				MovieClip(target.getChildByName("playing")).visible = true;
			}
			else if (myMap.get("autoPlayer") == "random") {
				var random:Number = GlllStringUtil.randRange(1, myMap.get("songTotal")) - 1;
				if (GlllSound.mySound != null) {
					GlllSound.removeListener();
					GlllSound.myPosition = 0;
				}
				GlllSound.soundPlay(myMap, random, wave, thisMC, myTip, lrcButton, Lyricsitems, target);
				MovieClip(target.getChildByName("playing")).musicTitle.htmlText = "<b><u>" + MovieClip(target.getChildByName("list" + random.toString())).musicTitle.text + "</u></b>";
				MovieClip(target.getChildByName("playing")).musicTitle.textColor = "0xCC0000";
				MovieClip(target.getChildByName("playing")).musicTitle.backgroundColor = "0xFFFFFF";
				MovieClip(target.getChildByName("playing")).x = MovieClip(target.getChildByName("list" + random.toString())).x;
				MovieClip(target.getChildByName("playing")).y = MovieClip(target.getChildByName("list" + random.toString())).y;
				MovieClip(target.getChildByName("playing")).visible = true;
			}
			
			function playing_mouse_over(event:MouseEvent):void {
				var textList:String = "<b> * LL19.com </b> <u><font color=\"#CC0000\"> ...Now playing...  </u></font>";
				myTip.showTip(textList, 600, 23, " ");
				event.currentTarget.musicTitle.textColor = "0x000000";
				event.currentTarget.musicTitle.backgroundColor = "0xFFFFFF";
			}

			function playing_mouse_out(event:MouseEvent):void {
				myTip.removeTip();
				event.currentTarget.musicTitle.textColor = "0xCC0000";
				event.currentTarget.musicTitle.backgroundColor = "0xFFFFFF";
			}
			
			
			function mouse_down(event:MouseEvent):void {
				event.currentTarget.musicTitle.textColor = "0xCC0000";
				event.currentTarget.musicTitle.backgroundColor = "0xFFFFFF";
				if (GlllSound.mySound != null) {
					GlllSound.removeListener();
					GlllSound.myPosition = 0;
				}
				GlllSound.soundPlay(myMap, event.currentTarget.data, wave, thisMC, myTip, lrcButton, Lyricsitems, target);
			}

			function mouse_over(event:MouseEvent):void {
				var textList:String = " * (" + GlllStringUtil.checkDigits((event.currentTarget.data + 1).toString()) + "/" + GlllStringUtil.checkDigits(myMap.get("songTotal").toString()) + ") " + ". <b>" + myMap.get("titleList")[event.currentTarget.data] + "</b>  <u><font color=\"#CC0000\">(  " + GlllStringUtil.splitLast(myMap.get("urlList")[event.currentTarget.data], "/") + " + " + GlllStringUtil.splitLast(myMap.get("lrcList")[event.currentTarget.data], "/") + "  )</font></u>  ";
				myTip.showTip(textList, 600, 23, " ");
				event.currentTarget.musicTitle.textColor = "0xFFFFFF";
				event.currentTarget.musicTitle.backgroundColor = "0xCC0000";
			}

			function mouse_out(event:MouseEvent):void {
				myTip.removeTip();
				event.currentTarget.musicTitle.textColor = "0x000000";
				event.currentTarget.musicTitle.backgroundColor = "0xFFFFFF";
			}
			function mouse_up(event:MouseEvent):void {
				event.currentTarget.musicTitle.textColor = "0x000000";
				event.currentTarget.musicTitle.backgroundColor = "0xFFFFFF";
				MovieClip(MovieClip(event.currentTarget.parent).getChildByName("playing")).musicTitle.htmlText = "<b><u>" + event.currentTarget.musicTitle.text + "</u></b>";
				MovieClip(MovieClip(event.currentTarget.parent).getChildByName("playing")).musicTitle.textColor = "0xCC0000";
				MovieClip(MovieClip(event.currentTarget.parent).getChildByName("playing")).musicTitle.backgroundColor = "0xFFFFFF";
				MovieClip(MovieClip(event.currentTarget.parent).getChildByName("playing")).x = event.currentTarget.x;
				MovieClip(MovieClip(event.currentTarget.parent).getChildByName("playing")).y = event.currentTarget.y;
				MovieClip(MovieClip(event.currentTarget.parent).getChildByName("playing")).visible = true;
			}

			function button_mouse_over(event:MouseEvent):void {
				myTip.showTip(" <b> Down </b> ++Song++ ", 480, 23, " ");
				event.currentTarget.p.backgroundColor = "0x000000";
				event.currentTarget.p.textColor = "0xFFFFFF";
			}
			
			function button_mouse_out(event:MouseEvent):void {
				myTip.removeTip();
				event.currentTarget.p.backgroundColor = "0xFFFFFF";
				event.currentTarget.p.textColor = "0x000000";
			}
			
			function button_mouse_down(event:MouseEvent):void {
				event.currentTarget.p.backgroundColor = "0xCC0000";
				event.currentTarget.p.textColor = "0xFFFFFF";
				//X坐标在 0 - (0- event.currentTarget.width + 330 ) 330是影片中myMusicList的宽
				var xmin:Number = 0 - target.width + 330;
				if (target.x > xmin) {
					target.addEventListener(Event.ENTER_FRAME, easeX);
				}
			}
			
			function button_mouse_up(event:MouseEvent):void {
				event.currentTarget.p.backgroundColor = "0xFFFFFF";
				event.currentTarget.p.textColor = "0xCC0000";
				removeEaseX();
			}
			function buttonn_mouse_over(event:MouseEvent):void {
				myTip.showTip(" <b> Down </b> --Song-- ", 740, 23, " ");
				event.currentTarget.n.backgroundColor = "0x000000";
				event.currentTarget.n.textColor = "0xFFFFFF";
			}
			
			function buttonn_mouse_out(event:MouseEvent):void {
				myTip.removeTip();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -