点击下载:上海明天天气查询 上海明天的天气 明天上海天气情况 上海市天气预报一周 上海明天什么天气
缩略图: 我写的这个mp3播放器已实行的效:
1、加载进度条、播放进度条
2、mp3文件总时长、已播放年华流露
3、已加载百分比、已播放百分比流露
4、提取歌曲演唱者.id3.artist 和 歌曲名.id3.song天天上海明天天气查询Name 并流露
5、音量限制
6、播放、暂停、制止按钮效
7、播放时不妨拖动播放进度条,暂停时不妨拖动播放进度条,改动播放进度
8、频谱 实行
9、加载歌曲时,播放列表同时也流露歌曲名、歌曲总时长
10、不妨掀开当地mp3文件并加载;
11、在输入框中输入http://地址后点击左边按钮首先加载上海明天天气查询天天网络mp3文件;
//企图实行效:
1、歌词流露 ************************************************** 以下是源码:
Rockman 类(主类)
package
{
imp
ort fla天气查询sh.display.Sprite;
import flash.URLRequest;
import flash.media.Sound;
import flash.media.SoundChannel;<天气明天>“上海明天天气查询 上海明天的天气 明”br>
import flash.media.SoundTransform;
import flash.media.SoundLoaderContext;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.Progres上海明sEvent;
//import fl.controls.Slider;
import fl.events.SliderEvent;
import flash.FileReference;
import flash.FileFilter;
import MusicWave;
public 查询上海class Rockman extends Sprite
{
public var s:Sound;
private var channel:SoundChan明查询nel;
private var flag_play:uint = 0;
private var position:Number=0;
private var req:URLRequest = new URLRequest();
var myFileRef = new FileReference();
public function Rockman()
{
a.width = 0;
slider1.value = 5;
down_b上海明天的天气天气tn.addEventListener(MouseEvent.CLICK, down1);
slider1.addEventListener(SliderEvent.CHANGE, changeVolume);
open_btn.addEventListener(MouseEvent.CLICK,fileOpe n);
查询明天 }
private function changeVolume(e:Event):void
{
var soundTransform1:SoundTransform = new SoundTransform;
soundTransform1.volume = slider1.value*0.1;
channel.sound上海明天天气查询上海Transform = soundTransform1;
}
private function playMp3()
{
s = new Sound(re上海明天的天气上海q);
this.addEventListener(Event.ENTER_FRAME,progress1) ;
//s.addEventListener(ProgressEvent.PROGRESS, progress1);
//this.上海上海明天的天气addEventListener(Event.ENTER_FRAME,progress 2);
play_btn.addEventListener(MouseEvent.CLICK, play1);
stop_btn.addEventListener(MouseEvent.CLICK, stop1);
上海明天的天气明天
var musicWaves:MusicWave=new MusicWave(musicWave_mc.width,musicWave_mc.height);
musicWave_mc.musicWave.addChild(musicWaves);
}
private 天气上海明天天气查询function progress1(e:Event):void
{
var loaded:int = s.bytesLoaded;//已加载的字节
var total:int = s.bytesTotal;//总共字节
var length1:int = s.length;//已加载长度(毫秒)
var 上海明天天气查询明loadedPct:Number = loaded/total;
var length_total:Number = length1/loadedPct;//总时长(毫秒)
var playPct:Number = position/length_total;;
s.addEventListener(Event.ID3, onID天天上海明天的天气3);
a.addEventListener(MouseEvent.MOUSE_DOWN,function( ){position =(mouseX-a.x)/(a.width)*length_total;if(flag_play= =1){channel.stop();channel = s.p明天气lay(position);}});
if(flag_play == 1)
{
position = channel.position;//眼前目今播放名望(毫秒)
if(isNaN(pl明上海明天天气查询ayPct))
{
playPct = 0;
}
}
a.scaleX = loaded/total;
a_txt.text = loadedPct*100+'%';
b.x = a.x + (a.width)*playPct;
b_txt.tex上海明天的天气上海明天天气查询t = (playPct*100).toFixed(1)+'%';
time_txt.text = timeFormat(position/1000) + "-" + timeFormat(length_total/1000);
totaltime_txt.text =上海明天 timeFormat(length_total/1000)
}
public function onID3(e:Event):void {
artist_txt.text = s.id3.artist + "-" + s.id3.songName; //+ s.id3.album + " - "
}
pri上海上海明天天气查询vate function play1(e:Event):void
{
if(flag_play == 1)
{
channel.stop();//制止播放
flag_play = 0;
}
else
{
明天查询
channel = s.play(position);//首先播放
flag_play = 1;
}
play_btn.play();
}
private function stop1(e:Event):void
{
天天上海 if(flag_play == 1)
{
channel.stop();//制止播放
flag_play = 0;
play_btn.play();
}
position = 0;//下次点播放时,从上海天气上海明天天气查询 上海明天的天气 明头首先播放
b.x = a.x;
b_txt.text = '0.0%';
}
private function down1(e:Ev上海明天的天气天天ent):void
{
req.url = net_txt.text;
name_txt.text = e.target.name;
playMp3();
trace(req.url);
}
上海天天 private function fileOpen(e:MouseEvent)
{
var allFilter:FileFilter = new FileFilter("mp3", "*.mp3");
myFileRef.browse([allFilter]);
myFileRef.addEventListene明天天气r(Event.SELECT,open1);
}
private function open1(e)
{
//trace (e.天气明target.name);
name_txt.text = e.target.name;
req.url = e.target.name;
playMp3();
<明上海br> trace(req.url);
}
private function timeFormat(_n:uint):String
{
return ("0"+u查询上海明天的天气int(_n/60)).substr(-2)+":"+("0"+_n%60).subst r(-2);
}
}
}
musicWave类:
package {
import flash.dis明天上海明天的天气play.Sprite;
//混合形式类
import flash.display.BlendMode;
//变乱类
import flash.events.*;
//声响类
import flash.media.Sound;
//混音器类
import flash.media.SoundMixer;
//声道类
import flash.media.SoundChannel;
//URLRequest类
import flash.URLReque明明天st;
//ByteArray类
import flash.utils.ByteArray;
//位图类
import flash.display.Bitmap;
import flash.display.BitmapData;
//滤镜类
import flash.filters.BlurFi上海明天天气查询明天lter;
import flash.filters.ColorMatrixFilter;
//滤镜品格类
import flash.filters.BitmapFilterQuality;
//矩形类
impor查询上海明天天气查询t flash.geom.Rectangle;
//Point类(点)
import flash.geom.Point;
//类及变量声明
//============上海明天天气查询查询==================================== ======================================//
public class MusicWave extends Sprite {
// 波形图的长和宽
private var w:int,h:int;
//声明明明用来包括line和bg的Sprite
private var Main:Sprite=new Sprite;
//声明用来画线的Sprite
private var line:Sprite=new Sprite;
//声明用来放位图数据的BitmapData
private v上海明天天气查询天气ar bmpData:BitmapData;
//声明用来流露就的Bitmap
private var bmp:Bitmap;
//声明一个ByteArray对象
<天天明br> private var bArray:ByteArray=new ByteArray;
//声明一个数组对象
private var Ary:Array;
//声明两个数字对象
private var n:Number=0;
private var c:Number=0;
/上海明天天气查询上海明天的天气/声明一个ColorMatrix滤镜
private var colorM:ColorMatrixFilter=new ColorMatrixFilter([0.99,0,0,0,0,0,0.99,0,0,0,0,0,0 .99,0,0,0,0,0,0.99,0.02,]);
//声明一个BlurFilter滤镜
private var blur:Bl明天上海明天天气查询urFilter=new BlurFilter(5,5,BitmapFilterQuality.HIGH);
//声明一个矩形
private var r:Rectangle;
//声明一个点
priv上海查询ate var p:Point=new Point(0,0);
//================================================ ======================================//
//组织函数
//生实例时必要传入宽和高
public func上海明天的天气明tion MusicWave(_w:int=100,_h:int=50):void {
w=_w;
h=_h;
init();
}
//初始化
明天上海
private function init():void {
Main.blendMode=BlendMode.ADD;
bmpData=new BitmapD天气上海明天的天气ata(w,h,true,0xFF0);
bmp=new Bitmap(bmpData);
r=new Rectangle(0,0,w,h);
Main.addChi上海明天的天气查询上海明天天气查询 上海明天的天气 明ld(bmp);
line.x=5;
Main.addChild(line);
addChild(Main);
this.addEventLi天天天气stener(Event.ENTER_FRAME,showWave);
}
//================================================》
//经常更新波形图画线函数
明天明
private function showWave(event:Event) {
//将Main的形式绘制到bmpData
bmpData.draw(Main);
//纵滤查询天气镜
bmpData.applyFilter(bmpData,r,p,colorM);
bmpData.applyFilter(bmpData,r,p,blur);
//清扫绘图
line.graphics.clear();
//设置线条样子,彩湖蓝,宽度1,透亮度100
var s:int=Math.floo天天查询r(Math.random() * 20);
if (s == 10) {
var color:uint=colorRandom();
line.graphics.lineS天气上海tyle(1,color,100);
} else {
line.graphics.lineStyle(1,0xFF5500,100);
}
//将眼前目今声响输入为ByteArray,
//false用来创造波形图(-1-1输入),true则用来做直方块式的图(0-1输入)
SoundMixerputeSpectrum(bArra明天天天y,false,0);
for (var i=0; i < 256; i+= 4) {
//在ByteArray中读取一个32位的单精度浮点数(就是把数据流读取浮点数)
n=bArray.readFloat();
//将n缩小波形图一半大小以内
n=Math.floor(n * h / 2);
//若是i不为0
if (i != 0) {
//画波形图
line.graphics.lineTo((w - 10)/ 256 * i,n + h / 2);
} else {
//挪动转移
line.graphics.moveTo(0,n + h / 2);
}
}
}
//================================================》
//获取一个随机16进制数
private function colorRandom():uint {
var r:String=Math.floor(Math.random() * 200 + 55).toString(16);
var g:String=Math.floor(Math.random() * 255 + 55).toString(16);
var b:String=Math.floor(Math.random() * 255 + 55).toString(16);
//补位
r=r.length < 2?"0" + r:r;
g=g.length < 2?"0" + g:g;
b=b.length < 2?"0" + b:b;
var color:uint=uint("0x" + r + g + b);
return color;
}
}
}
文章来源地址:http://noeltoy86otw.blog.163.com/天天明br>明上海br>天气明天>