All pastes #828718 Raw Edit

Mine

public text v1 · immutable
#828718 ·published 2007-12-22 18:09 UTC
rendered paste body
// Action script...

// [onClipEvent of sprite 19 in frame 1]
on (rollOver)
{
    _parent.volumeSlider._visible = false;
}

// [onClipEvent of sprite 47 in frame 1]
on (release)
{
    _parent._parent.alternatePlayer._visible = true;
    _parent._visible = false;
    _parent.stopPlaying();
}

// [Action in Frame 1]
function result()
{
    trace ("///result result ");
    this.onResult = function (retVal)
    {
        playAudioNow = function ()
        {
            trace ("BUFFER LENGTH = " + subscribe_ns.bufferLength);
            subscribe_ns.setBufferTime(bufferSeconds);
            trace ("BUFFER TIME = " + subscribe_ns.bufferTime);
            speaker_mv.attachAudio(subscribe_ns);
            if (_root.streamRate)
            {
                subscribe_ns.play("mp3:mp3_" + _root.streamRate + "/" + __path + __id);
            }
            else
            {
                subscribe_ns.play("mp3:mp3_" + _global.defaultStreamRate + "/" + __path + __id);
            } // end else if
            trace ("BUFFER LENGTH = " + subscribe_ns.bufferLength);
        };
        _global.maxlength = retVal;
        streamLength_txt.html = true;
        streamLength_txt.htmlText = "<b>Stream Length</b><br>" + retVal + " Seconds" + "<br>";
        streamLength_txt.htmlText = streamLength_txt.htmlText + formatSeconds(retVal);
        id3_ns = new NetStream(myConnection);
        subscribe_ns = new NetStream(myConnection);
        _global.soundControl = new Sound(speaker_mv);
        if (_global.muteState)
        {
            trace ("SOUND OBJECT IS MUTED");
            _global.soundControl.setVolume(0);
        }
        else
        {
            _global.soundControl.setVolume(100);
        } // end else if
        if (_root.streamRate)
        {
            id3_ns.play("id3:mp3_" + _root.streamRate + "/" + __path + __id);
        }
        else
        {
            id3_ns.play("id3:mp3_" + _global.defaultStreamRate + "/" + __path + __id);
        } // end else if
        playAudioNow();
        id3_ns.onId3 = function (info)
        {
            if (info != undefined)
            {
                mp3metaArray = [__cd + info.TALB, __title + info.TIT2, __label + info.TPE1];
                playertext.gotoAndPlay(1);
            } // end if
        };
    };
} // End of the function
function getPlayerCMS()
{
    _global.srv.getCMS("PlayerCMS");
    _global.srv.getHTTPPathSiteURL();
    _global.srv.getRTMPPath();
} // End of the function
function getHTTPPathSiteURL_Result(result)
{
    http = result;
} // End of the function
function getHTTPPathSiteURL_Status(error)
{
} // End of the function
function getRTMPPath_Result(result)
{
    rtmp = result;
    if (_root.trackID)
    {
        createPath(_root.trackID);
    } // end if
} // End of the function
function getRTMPPath_Status(error)
{
} // End of the function
function getCMS_Result(result)
{
    alternatePlayer.useFlashPlayer_text.text = result.useFlashPlayer_txt;
    setPlayerCMS(result);
} // End of the function
function getCMS_Status(error)
{
    errorServer("getCMS(\"PlayerCMS\") FAILED:", error.description);
} // End of the function
stop ();
seek_mv._visible = false;
seekghost_mv._visible = false;
this.playertext.stop();
this.playertext.playertextdata_txt.text = "-- no tracks playing -- ";
_global.isTesting = false;
_global.defaultStreamRate = 112;
if (isTesting)
{
    _root.trackID = "319995";
    _root.StreamRate = 112;
} // end if
_global.isplaying = false;
formatSeconds = function (seconds)
{
    if (isNaN(seconds) != true)
    {
        var _loc1 = Math.floor(seconds / 60);
        var _loc2 = Math.round(seconds - _loc1 * 60);
        if (_loc1 < 10)
        {
            _loc1 = "0" + _loc1;
        } // end if
        if (_loc2 < 10)
        {
            _loc2 = "0" + _loc2;
        } // end if
        return (_loc1 + ":" + _loc2);
    }
    else
    {
        return ("00:00");
    } // end else if
};
myConnection = new NetConnection();
_global.checkPlaystatus = function ()
{
    trace ("IS PLAYING VAR" + isplaying);
    trace ("Checking Play Status");
    if (_global.isplaying)
    {
        trace ("It is Playing");
        pausePlaying();
    }
    else
    {
        trace ("It is not Playing");
        _global.isplaying = true;
        if (isStreaming)
        {
            subscribe_ns.pause();
        }
        else
        {
            progSound.start(pauseTime);
        } // end else if
    } // end else if
};
pausePlaying = function ()
{
    _global.isplaying = false;
    if (isStreaming)
    {
        subscribe_ns.pause();
    }
    else
    {
        pauseTime = progSound.position / 1000;
        progSound.stop();
    } // end else if
};
stopPlaying = function ()
{
    pauseTime = 0;
    if (_global.isplaying == true)
    {
        _global.isplaying = false;
        subscribe_ns.pause();
    } // end if
    if (isStreaming)
    {
        subscribe_ns.seek(0);
    }
    else
    {
        progSound.start(0);
        progSound.stop();
    } // end else if
    playpause_mv.gotoAndStop(2);
    playHead._x = seek_mv._x;
};
startPlaying = function (id, path)
{
    seekNow(false, 1);
    if (_global.muteState)
    {
        trace ("SOUND OBJECT IS MUTED");
        _global.soundControl.setVolume(0);
    }
    else
    {
        _global.soundControl.setVolume(100);
    } // end else if
    _global.isplaying = true;
    playpause_mv.gotoAndStop(1);
    myConnection.connect(rtmp);
    trace ("THIS IS THE PATH ---------------------------- " + path);
    trace ("THIS IS THE ID -------------------------------------" + id);
    if (_root.streamRate)
    {
        myConnection.call("audiolength", new result(), "mp3:mp3_" + _root.streamRate + "/" + path + id);
    }
    else
    {
        myConnection.call("audiolength", new result(), "mp3:mp3_" + _global.defaultStreamRate + "/" + path + id);
    } // end else if
    displayData();
};
var bufferSeconds = 1.000000E-001;
trace ("SHOULD LOAD BUFFER FILE NOW");
var bufferText = new LoadVars();
bufferText.onLoad = function (success)
{
    trace ("BUFFER TEXT LOADED");
    trace (this.bufferSeconds);
    bufferSeconds = this.bufferSeconds;
};
bufferText.load("BufferTime.txt");
var textInterval;
var mp3metaArray;
var counter = 0;
textUpdate = function ()
{
    ++counter;
    if (counter == 3)
    {
        counter = 0;
    } // end if
    playertextdata_txt.htmlText = mp3metaArray[counter];
};
seekNow = function (state, direction)
{
    scrollDirection = direction;
    if (direction == "1")
    {
        _parent.dd = "1";
    }
    else
    {
        _parent.dd = "-1";
    } // end else if
    var _loc3 = state;
    seekpt = subscribe_ns.time;
    scrollerTest = 0;
    i = 0;
    if (_loc3)
    {
        seektoPoint = function ()
        {
            ++i;
            _global.scrollerTest = _global.scrollerTest + _parent.dd * 2 * i;
            if (seekpt + _global.scrollerTest >= 0 && seekpt + _global.scrollerTest < _global.maxlength - 1)
            {
                seekghost_mv.dot._x = 149 * (seekpt + _global.scrollerTest) / (_global.maxlength + 1);
                seektimerdata_txt.text = "seek " + formatSeconds(seekpt + _global.scrollerTest);
                seekghost_mv._visible = true;
            }
            else if (seekpt + _global.scrollerTest >= _global.maxlength - 1)
            {
                seektimerdata_txt.text = "";
                seekghost_mv._visible = false;
                
            } // end else if
        };
        _global.SeekInterval = setInterval(seektoPoint, 250);
    }
    else
    {
        clearInterval(SeekInterval);
        if (seekpt + _global.scrollerTest >= 1 && seekpt + _global.scrollerTest < _global.maxlength)
        {
            subscribe_ns.seek(seekpt + _global.scrollerTest);
            
        } // end if
        seektimerdata_txt.text = "";
        _global.scrollerTest = 0;
        i = 0;
        seekghost_mv._visible = false;
    } // end else if
};
HorizScroll = function ()
{
    scrollerTest = _global.scrollDirection;
    if (scrollerTest)
    {
        playertextdata_txt.hscroll = playertextdata_txt.hscroll + 1;
        playertextdata_txt.background = false;
        if (playertextdata_txt.hscroll >= playertextdata_txt.maxhscroll)
        {
            _global.scrollDirection = false;
            
        } // end if
    }
    else
    {
        playertextdata_txt.hscroll = playertextdata_txt.hscroll - 1;
        playertextdata_txt.background = false;
        if (playertextdata_txt.hscroll <= 1)
        {
            _global.scrollDirection = true;
            
        } // end if
    } // end else if
};
refreshDataDisplay = function ()
{
    playertimerdata_txt.html = true;
    if (isStreaming)
    {
        seek_mv._xscale = subscribe_ns.time * 100 / (_global.maxlength + 1);
        playertimerdata_txt.htmlText = "<p align=\'right\'>" + formatSeconds(subscribe_ns.time) + " / " + formatSeconds(_global.maxlength) + "</p>";
    }
    else
    {
        seek_mv._xscale = progSound.position * 100 / (progSound.duration + 1);
        playertimerdata_txt.htmlText = "<p align=\'right\'>" + formatSeconds(progSound.position / 1000) + " / " + formatSeconds(progSound.duration / 1000) + "</p>";
    } // end else if
    if (!playHeadSelected)
    {
        playHead._x = seek_mv._x + seek_mv._width;
    } // end if
};
displayData = function ()
{
    seek_mv._visible = true;
    refreshDataDisplay();
    _global.RefreshInterval = setInterval(refreshDataDisplay, 250);
};
hittest_mv.onPress = function ()
{
    if (this.hitTest(_root._xmouse, _root._ymouse))
    {
        if (isStreaming)
        {
            subscribe_ns.seek(_global.maxlength * (hittest_mv._xmouse / hittest_mv._width));
        }
        else
        {
            var _loc4 = this._xmouse * 100 / this._width;
            var _loc5 = Math.floor(progSound.duration * _loc4 / 100000);
            progSound.stop();
            progSound.start(_loc5);
        } // end else if
        
    } // end if
};
var playHeadSelected = false;
playHead.onPress = function ()
{
    if (_global.isplaying != true)
    {
        return;
    } // end if
    playHeadSelected = true;
    if (isStreaming)
    {
        pausePlaying();
    } // end if
    _global.isplaying = true;
    startDrag (this, true, hittest_mv._x, 2.110000E+001, hittest_mv._x + hittest_mv._width, 2.110000E+001);
};
playHead.onRelease = playHead.onReleaseOutside = function ()
{
    if (_global.isplaying != true)
    {
        return;
    } // end if
    playHeadSelected = false;
    stopDrag ();
    if (isStreaming)
    {
        subscribe_ns.pause();
        subscribe_ns.seek(_global.maxlength * (hittest_mv._xmouse / hittest_mv._width));
    }
    else
    {
        var _loc2 = hittest_mv._xmouse * 100 / hittest_mv._width;
        var _loc3 = Math.floor(progSound.duration * _loc2 / 100000);
        progSound.stop();
        progSound.start(_loc3);
    } // end else if
    _global.isplaying = true;
};
playStreaming = function (id, path)
{
    mp3metaArray = ["", "", ""];
    pauseTime = 0;
    isStreaming = true;
    __path = path;
    __id = id;
    progSound.stop();
    startPlaying(id, path);
};
playProgressive = function (pathOfFile)
{
    pauseTime = 0;
    isStreaming = false;
    _global.isplaying = true;
    subscribe_ns.close();
    mp3metaArray = ["", "", ""];
    progSound = new Sound(speaker_mv);
    progSound.onID3 = function ()
    {
        mp3metaArray = [__cd + this.id3.TALB, __title + this.id3.TIT2, __label + this.id3.TPE1];
        playertext.gotoAndPlay(1);
    };
    progSound.loadSound(pathOfFile, true);
    progSound.start();
    displayData();
};
volumeSlider._visible = false;
volumeSlider.trackBall.onPress = function ()
{
    mute_mv.gotoAndStop(1);
    startDrag (this, true, 3, 5, 3, 55);
    this.onEnterFrame = function ()
    {
        theVolume = -this._y * 2 + 110;
        trackBallY = this._y;
        if (isStreaming)
        {
            _global.soundControl.setVolume(theVolume);
        }
        else
        {
            progSound.setVolume(theVolume);
        } // end else if
    };
};
volumeSlider.trackBall.onRelease = function ()
{
    delete this.onEnterFrame;
    stopDrag ();
};
volumeSlider.trackBall.onReleaseOutside = function ()
{
    delete this.onEnterFrame;
    stopDrag ();
};
externalShow.onRollOver = function ()
{
    HoverTip.display("000000000000000", this);
    HoverTip.display(__toolTipText, this);
};
externalShow.onRollOut = function ()
{
    HoverTip.hideHoverTip();
};
externalShow.onRelease = function ()
{
    stopPlaying();
    _root.alternatePlayer._visible = true;
    trace (_root.alternatePlayer);
    trace (_parent.alternatePlayer);
    trace (_parent.alternatePlayer);
    _root.player_mc._visible = false;
    getURL(httpPath, "_blank");
};
setMute = function ()
{
    volumeSlider.trackBall._y = 55;
    if (isStreaming)
    {
        _global.soundControl.setVolume(0);
    }
    else
    {
        progSound.setVolume(0);
    } // end else if
};
setUnMute = function ()
{
    volumeSlider.trackBall._y = trackBallY;
    if (isStreaming)
    {
        _global.soundControl.setVolume(theVolume);
    }
    else
    {
        progSound.setVolume(theVolume);
    } // end else if
};
showDetailsPage = function (__titleID)
{
    if (__titleID == "")
    {
        delete detailBtn.onRelease;
    }
    else
    {
        detailBtn.onRelease = function ()
        {
            LM.loadData(_root.getDiscAndTrackInfo, _root, [__titleID], "TRACK DATA");
        };
    } // end else if
};
detailBtn.onRollOver = function ()
{
    playertext.colorTo(3451791, 5.000000E-001, "easeOutQuad");
};
detailBtn.onRollOut = function ()
{
    playertext.colorTo(0, 5.000000E-001, "easeOutQuad");
};
var theVolume = 100;
var trackBallY;
var isStreaming;
var progSound;
var __path;
var __id;
var __title;
var __cd;
var __label;
var __toolTipText;
var http;
var rtmp;
var pauseTime;
var httpPath;
var id;
var path;
init = function ()
{
    trace ("init called ...");
    trace ("");
    if (!inited_ns)
    {
        inited_ns = true;
        var _loc3 = _url.split("/");
        if (_loc3[0] != "file:")
        {
            _loc3.pop();
            _loc3.pop();
            _loc3.pop();
            _loc3.pop();
            defaultGatewayURL = _loc3.join("/");
            defaultGatewayURL = defaultGatewayURL + "/gateway.aspx";
        }
        else
        {
            defaultGatewayURL = "http://qafc.alternetinc.com/gateway.aspx";
        } // end else if
        var _loc4 = "BMGZomba.FlashWebServices.Dispatcher";
        mx.remoting.NetServices.setDefaultGatewayUrl(defaultGatewayURL);
        _global.conn = mx.remoting.NetServices.createGatewayConnection();
        _global.srv = _global.conn.getService(_loc4, this);
        getPlayerCMS();
    } // end if
};
setPlayerCMS = function (_result)
{
    __title = _result.trackTitle_txt;
    __cd = _result.albumTitle_txt;
    __label = _result.composer_txt;
    __toolTipText = _result.useDefaultPlayer_txt;
};
createPath = function (id)
{
    if (id.length > 3)
    {
        var _loc4 = id.length;
        var _loc6 = id.slice(_loc4 - 4, _loc4 - 2);
        var _loc5 = id.slice(_loc4 - 2, _loc4);
        path = _loc6 + "/" + _loc5 + "/";
    }
    else
    {
        var _loc1 = 4 - id.length;
        var _loc2 = "";
        while (_loc1 > 0)
        {
            _loc2 = _loc2 + "0";
            --_loc1;
        } // end while
        _loc2 = _loc2 + id;
        _loc6 = _loc2.slice(0, 2);
        _loc5 = _loc2.slice(2, 4);
        path = _loc6 + "/" + _loc5 + "/";
    } // end else if
    httpPath = http + path + id + ".mp3";
    playStreaming(id, path);
};
init();
externalShow._visible = false;