vr4u 发表于 2012-3-14 14:14
可能是xml文件的路径不正确。。
如果可能,给个网址看下
同目录下的xml文件如下- <?xml version="1.0" encoding="UTF-8"?>
- <player urlskin="skin/nero.jpg" colorcircle="32363F" ipod_title="JuliusDesign" title_color="999999" ombra="si" buttoncolor="FFFFFF" autoStart="si" download="si">
- <song path="mp3/1.mp3" title="Madonna Hung Up" imgsong="cd_cover/img1.jpg" />
- </player>
复制代码 这是同目录下的ipodplayer_update.fla代码- Stage.showMenu = false;
- _quality = "Best";
- function loadData(success) {
- _root.pannello._visible = false;
- var _loc2 = this;
- if (success) {
- urlskin = _loc2.firstChild.attributes.urlskin;
- if (urlskin == "no" || urlskin == undefined) {
- trace("niente sfondo");
- _root.SkinIpod = "dafault.gif";
- } else {
- _root.SkinIpod = urlskin;
- loadMovie(urlskin, _root.skin);
- }
- ombra = _loc2.firstChild.attributes.ombra;
- if (ombra == "no" || ombra == undefined) {
- _root.mc_ombra._alpha = 0;
- trace("ombra no");
- } else {
- _root.mc_ombra._alpha = 100;
- trace("ombra si");
- }
- download = _loc2.firstChild.attributes.download;
- if (download == "no" || download == undefined) {
- trace("Download non abilitato");
- _root.top.dw._x = -200;
- } else {
- trace("Download abilitato");
- _root.top.dw._x = -89;
- }
- ipod_title = _loc2.firstChild.attributes.ipod_title;
- _root.ipod.barra.ipod_titles.text = ipod_title;
- // end if
- title_color = _loc2.firstChild.attributes.title_color;
- trace(title_color);
- _root.ipod.barra.ipod_titles.textColor = "0x"+title_color;
- colorcircle = _loc2.firstChild.attributes.colorcircle;
- my_color6 = new Color(dial);
- my_color6.setRGB("0x"+colorcircle);
- buttoncolor = _loc2.firstChild.attributes.buttoncolor;
- //trace(buttoncolor);
- my_color5 = new Color(menu);
- my_color5.setRGB("0x"+buttoncolor);
- my_color4 = new Color(prev_btn);
- my_color4.setRGB("0x"+buttoncolor);
- my_color2 = new Color(next_btn);
- my_color2.setRGB("0x"+buttoncolor);
- my_color3 = new Color(play_btn);
- my_color3.setRGB("0x"+buttoncolor);
- my_color1 = new Color(pause_btn);
- my_color1.setRGB("0x"+buttoncolor);
- // end if
- aPath = new Array();
- songTitel = new Array();
- imgsong = new Array();
- audioTracks = new Array();
- audioTracks.shuffle();
- audioTracks = _loc2.firstChild.childNodes;
- song_total = audioTracks.length;
- for (var _loc1 = 0; _loc1<song_total; ++_loc1) {
- aPath.push(audioTracks[_loc1].attributes.path);
- songTitel.push(audioTracks[_loc1].attributes.title);
- imgsong.push(audioTracks[_loc1].attributes.imgsong);
- bot.playlist.btn.duplicateMovieClip("btn"+_loc1, _loc1);
- bot.playlist["btn"+_loc1]._y = bot.playlist.btn._y+_loc1*int(bot.playlist.btn._height)+_loc1;
- bot.playlist["btn"+_loc1].txt = checkDigits(_loc1+1)+". "+songTitel[_loc1];
- bot.playlist["btn"+_loc1].hit.onPress = function() {
- top.gotoAndStop(2);
- loadMovie(imgsong[this._parent.getDepth()], _root.top.img_cover);
- _root.pannello._visible = false;
- bot.playlist._visible = false;
- bot.list_bg._visible = false;
- listClick(this._parent.getDepth()+1);
- _root.ipod.status.gotoAndStop(2);
- };
- }
- // end of for
- autoStart = _loc2.firstChild.attributes.autoStart;
- if (autoStart == "si") {
- _root.ipod.status.gotoAndStop(2);
- top.gotoAndStop(2);
- bot._visible = true;
- top._visible = true;
- _root.pannello._visible = false;
- bot.playlist._visible = false;
- bot.list_bg._visible = false;
- playSong();
- loadMovie(imgsong[_root.current_song-1], _root.top.img_cover);
- play_btn._visible = 0;
- } else if (autoStart == "no") {
- _root.ipod.status.gotoAndStop(1);
- play_btn._visible = 1;
- pause_btn._visible = 0;
- } else if (autoStart == "random") {
- _root.ipod.status.gotoAndStop(2);
- current_song = random(song_total)+1;
- playSong();
- play_btn._visible = 0;
- } else {
- _root.ipod.status.gotoAndStop(2);
- current_song = int(_loc2.firstChild.attributes.autoStart);
- playSong();
- play_btn._visible = 0;
- }
- // end else if
- }
- // end else if
- delete audioTracks;
- delete data_xml;
- }
- // End of the function
- function listClick(prm) {
- delete pausepos;
- current_song = prm;
- MySound.stop();
- playSong();
- }
- // End of the function
- function playSong() {
- var _loc1 = this;
- AudioPath = aPath[current_song-1];
- _root.song_url = AudioPath;
- if (pausePos>0) {
- top.equalizer._visible = 1;
- MySound.start(pausePos, 0);
- pausePos = 0;
- _root.ipod.status.gotoAndStop(2);
- } else {
- MySound = new Sound();
- //MySound.setVolume(volume);
- MySound.loadSound(AudioPath, true);
- MySound.setVolume(_root.volText);
- MySound.onSoundComplete = function() {
- top.equalizer._visible = 0;
- if (autoStart == "random") {
- current_song = random(song_total)+1;
- } else {
- current_song == song_total ? (current_song=1) : (current_song++);
- }
- // end else if
- loadMovie("cd_cover/img"+_root.current_song+".jpg", _root.top.img_cover);
- _root.ipod.status.gotoAndStop(2);
- playSong();
- };
- top.track_load.onEnterFrame = function() {
- var _loc1 = this;
- total = _loc1._parent._parent.MySound.getBytesTotal();
- geladen = _loc1._parent._parent.MySound.getBytesLoaded();
- if (geladen != total) {
- _loc1._parent.load_display = Math.round(geladen*100/total)+"% Loaded";
- _loc1._xscale = Math.round(geladen*100/total);
- return;
- }
- // end if
- _loc1._xscale = 100;
- top.equalizer._visible = 1;
- delete _loc1.onEnterFrame;
- delete _loc1._parent.load_display;
- };
- }
- // end else if
- play_btn._visible = 0;
- pause_btn._visible = 1;
- }
- // End of the function
- function checkDigits(toCheck) {
- var _loc1 = toCheck;
- return (_loc1<10 ? (_loc1=""+_loc1, ""+_loc1) : (_loc1));
- }
- // End of the function
- function scrollTitle() {
- top.title.txt.autoSize = true;
- if (songTitel[current_song-1].length>20) {
- top.title.txt.text = songTitel[current_song-1];
- //top.title._x + top.title._width / 2 + 4 < top.title_mask._x ? (top.title._x = top.title_mask._x) : (top.title._x--);
- } else {
- top.title.txt.text = songTitel[current_song-1];
- //top.title._x = top.title_mask._x - 3;
- }
- // end else if
- }
- // End of the function
- _root.playlist == undefined ? (playlist="IpodPlayerFlash.xml") : (playlist=_root.playlist);
- Stage.showMenu = false;
- Stage.scaleMode = "noScale";
- stop();
- volume = 90;
- current_song = 1;
- top.equalizer._visible = 0;
- data_xml = new XML();
- data_xml.ignoreWhite = true;
- data_xml.onLoad = loadData;
- data_xml.load(playlist);
- bot.list_bg.onEnterFrame = function() {
- var _loc1 = this;
- if (hitTest(_root._xmouse, _root._ymouse, true) && _loc1._parent.playlist._height>_loc1._height) {
- ymin = _loc1._y+_loc1._height-_loc1._parent.playlist._height;
- ymax = _loc1._y+3;
- conv = (_loc1._ymouse-15)*1.300000E+000/_loc1._height;
- conv>1 ? (conv=1) : (null);
- conv<0 ? (conv=0) : (null);
- _loc1._parent.playlist.easeY(ymax-conv*(ymax-ymin));
- }
- // end if
- };
- bot.playlist.setMask(bot.list_bg);
- play_btn.onRelease = function() {
- _root.ipod.status.gotoAndStop(2);
- top.gotoAndStop(2);
- bot._visible = true;
- top._visible = true;
- _root.pannello._visible = false;
- bot.playlist._visible = false;
- bot.list_bg._visible = false;
- trace(_root.current_song);
- loadMovie(imgsong[_root.current_song-1], _root.top.img_cover);
- playSong();
- };
- pause_btn.onRelease = function() {
- _root.ipod.status.gotoAndStop(3);
- this._visible = 0;
- play_btn._visible = 1;
- pausePos = MySound.position/1000;
- MySound.stop();
- top.equalizer._visible = 0;
- };
- next_btn.onRelease = function() {
- _root.ipod.status.gotoAndStop(2);
- top.gotoAndStop(2);
- bot._visible = true;
- top._visible = true;
- _root.pannello._visible = false;
- bot.playlist._visible = false;
- bot.list_bg._visible = false;
- delete pausepos;
- _root.current_song == song_total ? (_root.current_song=1) : (_root.current_song++);
- loadMovie(imgsong[_root.current_song-1], _root.top.img_cover);
- //trace(_root.current_song);
- MySound.stop();
- playSong();
- };
- prev_btn.onRelease = function() {
- _root.ipod.status.gotoAndStop(2);
- top.gotoAndStop(2);
- _root.pannello._visible = false;
- bot._visible = true;
- top._visible = true;
- bot.playlist._visible = false;
- bot.list_bg._visible = false;
- delete pausepos;
- _root.current_song == 1 ? (_root.current_song=song_total) : (_root.current_song--);
- loadMovie(imgsong[_root.current_song-1], _root.top.img_cover);
- //trace(_root.current_song);
- MySound.stop();
- playSong();
- };
- top.setMask(top_mask);
- //toppos = top._y;
- //top._y = int(toppos + top_mask._height - 29);
- topup = true;
- display_btn.onPress = function() {
- if (topup == true) {
- // top.easeY(toppos);
- topup = false;
- } else {
- //top.easeY(int(toppos + top_mask._height - 27));
- topup = true;
- }
- // end else if
- this._rotation = this._rotation+180;
- };
- bot.setMask(bot_mask);
- //botpos = bot._y;
- //bot._y = botpos - bot.list_bg._height - 6;
- //botup = true;
- list_btn.onPress = function() {
- if (botup == true) {
- // bot.easeY(botpos);
- botup = false;
- } else {
- bot.easeY(botpos-bot.list_bg._height-6);
- botup = true;
- }
- // end else if
- this._rotation = this._rotation+180;
- };
- this.onEnterFrame = function() {
- dur = int(MySound.duration/1000);
- pos = int(MySound.position/1000);
- playTime = {};
- playTime.minutes = int(pos/60);
- playTime.seconds = int(pos%60);
- playTime.total = checkDigits(playTime.minutes)+":"+checkDigits(playTime.seconds);
- trackTime = {};
- trackTime.minutes = int(dur/60);
- trackTime.seconds = int(dur%60);
- trackTime.total = checkDigits(trackTime.minutes)+":"+checkDigits(trackTime.seconds);
- if (top.load_display == undefined) {
- top.display = playTime.total+" / "+trackTime.total;
- } else {
- top.display = top.load_display;
- }
- // end else if
- if (top.trackDrag != true) {
- prozent = pos*100/dur;
- top.track_play._xscale = prozent;
- }
- // end if
- };
- top.track_back.onPress = function() {
- var _loc1 = this;
- _loc1._parent.trackDrag = true;
- _loc1._parent.track_play.onEnterFrame = function() {
- var _loc1 = this;
- perc = (_loc1._parent._xmouse-_loc1._parent.track_back._x)/_loc1._parent.track_back._width;
- max = _loc1._parent.track_load._width/_loc1._parent.track_back._width;
- perc>max ? (perc=max) : (null);
- perc<1.000000E-002 ? (perc=1.000000E-002) : (null);
- _loc1._width = _loc1._parent.track_back._width*perc;
- _loc1._parent._parent.pausePos = perc*_loc1._parent._parent.MySound.duration/1000;
- };
- };
- top.track_back.onRelease = top.track_back.onReleaseOutside=function () {
- delete this._parent.track_play.onEnterFrame;
- this._parent.trackDrag = false;
- MySound.stop();
- playSong();
- };
- top.title.setMask(top.title_mask);
- setInterval(scrollTitle, 40);
- MovieClip.prototype.easeY = function(t) {
- var _loc1 = this;
- _loc1.onEnterFrame = function() {
- var _loc1 = this;
- _loc1._y = int(t-(t-_loc1._y)/1.500000E+000);
- if (_loc1._y>t-1 && _loc1._y<t+1) {
- delete _loc1.onEnterFrame;
- }
- // end if
- };
- };
- angularDifference = 0;
- currentVol = 80;
- _root.volText = 80;
- currentAngularDifference = 0;
- volText.autoSize = "left";
- dial.onPress = function() {
- oldAngularDifference = angularDifference;
- oldAngle = undefined;
- this.onMouseMove = computeDotProduct;
- this.onRelease = this.onReleaseOutside=function () {
- this.onMouseMove = undefined;
- _root.top.volumeBar._visible = false;
- _root.top.sf_volbar._visible = false;
- };
- };
- function computeDotProduct() {
- var xVector, yVector, neg, vectorLength, dotProduct;
- xVector = this._xmouse;
- _root.top.volumeBar._visible = true;
- _root.top.sf_volbar._visible = true;
- if (xVector<0) {
- neg = true;
- }
- yVector = this._ymouse;
- vectorLength = Math.sqrt(xVector*xVector+yVector*yVector);
- if (vectorLength == 0) {
- return;
- }
- yVector = yVector/vectorLength;
- dotProduct = -yVector;
- newAngle = 180/Math.PI*Math.acos(dotProduct);
- if (neg) {
- newAngle *= -1;
- }
- if (oldAngle == undefined) {
- oldAngle = newAngle;
- }
- angularDifference += newAngle-oldAngle;
- currentAngularDifference = angularDifference-oldAngularDifference;
- this._rotation = angularDifference;
- oldAngularDifference = angularDifference;
- newVolume();
- }
- function newVolume() {
- tickSound.start();
- currentVol += currentAngularDifference/10;
- if (currentVol>100) {
- currentVol = 100;
- }
- if (currentVol<0) {
- currentVol = 0;
- }
- _root.volText = Math.round(currentVol);
- MySound.setVolume(_root.volText);
- _root.top.volumeBar._width = Math.round(currentVol*1.3);
- volText._x = _root.top.volumeBar._x+_root.top.volumeBar._width-Math.round(volText.textWidth/2)-2;
- }
复制代码 这是同个目录下的 flashobject.js_safe- /**
- * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
- *
- * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for
- * legal reasons.
- */
- if(typeof deconcept == "undefined") var deconcept = new Object();
- if(typeof deconcept.util == "undefined") deconcept.util = new Object();
- if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
- deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
- if (!document.createElement || !document.getElementById) { return; }
- this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
- this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
- this.params = new Object();
- this.variables = new Object();
- this.attributes = new Array();
- if(swf) { this.setAttribute('swf', swf); }
- if(id) { this.setAttribute('id', id); }
- if(w) { this.setAttribute('width', w); }
- if(h) { this.setAttribute('height', h); }
- if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
- this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
- if(c) { this.addParam('bgcolor', c); }
- var q = quality ? quality : 'high';
- this.addParam('quality', q);
- this.setAttribute('useExpressInstall', useExpressInstall);
- this.setAttribute('doExpressInstall', false);
- var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
- this.setAttribute('xiRedirectUrl', xir);
- this.setAttribute('redirectUrl', '');
- if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
- }
- deconcept.SWFObject.prototype = {
- setAttribute: function(name, value){
- this.attributes[name] = value;
- },
- getAttribute: function(name){
- return this.attributes[name];
- },
- addParam: function(name, value){
- this.params[name] = value;
- },
- getParams: function(){
- return this.params;
- },
- addVariable: function(name, value){
- this.variables[name] = value;
- },
- getVariable: function(name){
- return this.variables[name];
- },
- getVariables: function(){
- return this.variables;
- },
- getVariablePairs: function(){
- var variablePairs = new Array();
- var key;
- var variables = this.getVariables();
- for(key in variables){
- variablePairs.push(key +"="+ variables[key]);
- }
- return variablePairs;
- },
- getSWFHTML: function() {
- var swfNode = "";
- if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
- if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
- swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
- swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
- var params = this.getParams();
- for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
- var pairs = this.getVariablePairs().join("&");
- if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
- swfNode += '/>';
- } else { // PC IE
- if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
- swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
- swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
- var params = this.getParams();
- for(var key in params) {
- swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
- }
- var pairs = this.getVariablePairs().join("&");
- if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
- swfNode += "</object>";
- }
- return swfNode;
- },
- write: function(elementId){
- if(this.getAttribute('useExpressInstall')) {
- // check to see if we need to do an express install
- var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
- if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
- this.setAttribute('doExpressInstall', true);
- this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
- document.title = document.title.slice(0, 47) + " - Flash Player Installation";
- this.addVariable("MMdoctitle", document.title);
- }
- }
- if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
- var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
- n.innerHTML = this.getSWFHTML();
- return true;
- }else{
- if(this.getAttribute('redirectUrl') != "") {
- document.location.replace(this.getAttribute('redirectUrl'));
- }
- }
- return false;
- }
- }
- /* ---- detection functions ---- */
- deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
- var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
- if(navigator.plugins && navigator.mimeTypes.length){
- var x = navigator.plugins["Shockwave Flash"];
- if(x && x.description) {
- PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
- }
- }else{
- try{
- var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
- for (var i=3; axo!=null; i++) {
- axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
- PlayerVersion = new deconcept.PlayerVersion([i,0,0]);
- }
- }catch(e){}
- if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
- // this only does the minor rev lookup if the user's major version
- // is not 6 or we are checking for a specific minor or revision number
- // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
- if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
- try{
- PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
- }catch(e){}
- }
- }
- return PlayerVersion;
- }
- deconcept.PlayerVersion = function(arrVersion){
- this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;
- this.minor = parseInt(arrVersion[1]) || 0;
- this.rev = parseInt(arrVersion[2]) || 0;
- }
- deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
- if(this.major < fv.major) return false;
- if(this.major > fv.major) return true;
- if(this.minor < fv.minor) return false;
- if(this.minor > fv.minor) return true;
- if(this.rev < fv.rev) return false;
- return true;
- }
- /* ---- get value of query string param ---- */
- deconcept.util = {
- getRequestParameter: function(param){
- var q = document.location.search || document.location.hash;
- if(q){
- var startIndex = q.indexOf(param +"=");
- var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
- if (q.length > 1 && startIndex > -1) {
- return q.substring(q.indexOf("=", startIndex)+1, endIndex);
- }
- }
- return "";
- }
- }
- /* add Array.push if needed (ie5) */
- if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
- /* add some aliases for ease of use/backwards compatibility */
- var getQueryParamValue = deconcept.util.getRequestParameter;
- var FlashObject = deconcept.SWFObject; // for legacy support
- var SWFObject = deconcept.SWFObject;
复制代码 同目录下还有子目录cd_cover,mp3,skin三个文件夹
mp3文件夹中有歌曲,名字1.mp3 |