All pastes #796823 Raw Edit

Miscellany

public text v1 · immutable
#796823 ·published 2007-11-25 13:39 UTC
rendered paste body
function init(Void)
{
    _root.thumbGallery.thumb._visible = false;
    nc.connect(infostruc[0].path);
    ns = new NetStream(nc);
    ns.setBufferTime(4);
    _root.createEmptyMovieClip("audio", this.getNextHighestDepth());
    audio.attachAudio(ns);
    soundObj = new Sound(audio);
    ns.onStatus = function (info)
    {
        trace ("{NS}" + info.code);
        if (info.code == "NetStream.Failed")
        {
            broadcast_mc.video.my_video.clear();
            broadcast_mc.video.videoText.text = "This Channel is now closed";
        }
        else if (info.code == "NetStream.Play.Start")
        {
            broadcast_mc.video.my_video.attachVideo(ns);
            audio.attachAudio(ns);
            trace ("MUTE OFF");
            setV();
            broadcast_mc.video._visible = true;
            broadcast_mc.video.videoText.text = "Channel " + (broadcast_mc.id + 99);
        }
        else
        {
            broadcast_mc.video._visible = true;
        } // end else if
    };
    for (item = 0; item < infostruc.length; item++)
    {
        _root.thumbGallery.thumb.duplicateMovieClip("thumb_" + item, 100 - item);
        _root.thumbGallery["thumb_" + item].attachMovie("video", "video", 1);
        _root.thumbGallery["thumb_" + item].video.videoText.text = "Channel " + (100 + item);
        _root.thumbGallery["thumb_" + item].video.swapDepths(_root.thumbGallery["thumb_" + item].getNextHighestDepth());
        _root.thumbGallery["thumb_" + item].video.videoText.text = item;
        _root.thumbGallery["thumb_" + item].video.playicon._visible = false;
        var _loc3 = 1.745329E-002 * item * spacer;
        _root.thumbGallery["thumb_" + item]._x = radius * Math.cos(_loc3) + centreX;
        var _loc4 = (Math.sin(_loc3) + 4) * 20;
        _root.thumbGallery["thumb_" + item]._xscale = _loc4;
        _root.thumbGallery["thumb_" + item]._yscale = _loc4;
        var _loc7 = Math.round(Math.sin(_loc3) * 100) + 200;
        _root.thumbGallery["thumb_" + item].swapDepths(_loc7);
        _root.thumbGallery["thumb_" + item].id = item;
        thumbPath = urlString + infostruc[item].img;
        var _loc6 = _root.thumbGallery["thumb_" + item].img;
        var _loc5 = new Object();
        mcLoader.addListener(_loc5);
        var mcLoader = new MovieClipLoader();
        mcLoader.loadClip(thumbPath, _loc6);
        _loc5.onLoadInit = function (target_mc)
        {
            if (target_mc._width > 200 || target_mc._height > 150)
            {
                target_mc._height = 150;
                target_mc._width = 200;
            } // end if
            trace (">> target_mc._width: " + target_mc._width);
            trace (">> httpStatus: " + httpStatus);
        };
        _loc6.setMask(_root.thumbGallery.thumb.mask);
        _root.thumbGallery["thumb_" + item].bg.onPress = function ()
        {
            current = this._parent.id;
            ns.stop();
            trace ("MUTE ON");
            soundObj.setVolume(0);
            if (broadcast_mc.img._width > 200 || broadcast_mc.img._height > 150)
            {
                broadcast_mc.img._height = 150;
                broadcast_mc.img._width = 200;
            } // end if
            broadcast_mc.video.my_video.clear();
            broadcast_mc.video._visible = false;
            broadcast_mc = this._parent;
            if (_xmouse >= 450)
            {
                moveDirection = 1;
            }
            else
            {
                moveDirection = -1;
            } // end else if
            centreImage(current);
        };
        _root.thumbGallery["thumb_" + item].video.onPress = function ()
        {
            trace ("video clicks..>" + this);
            playState = !playState;
            this._parent.video.playicon._visible = !playState;
            ns.pause();
        };
    } // end of for
    current = 3;
    img_info.artist.text = infostruc[3].artist;
    img_info.track = infostruc[3].track;
} // End of the function
function centreImage(_id)
{
    trace ("centre for " + _id);
    img_info.artist.text = infostruc[_id].artist;
    img_info.track = infostruc[_id].track;
    ns.stop();
    broadcast_mc.video.my_video.clear();
    broadcast_mc.video._visible = false;
    broadcast_mc = _root.thumbGallery["thumb_" + _id];
    this.onEnterFrame = function ()
    {
        xPos = _root.thumbGallery["thumb_" + _id]._x + _root.thumbGallery._x;
        newAngle = 1.745329E-002 * (current * spacer + rotation);
        var _loc3 = new Date();
        var _loc4;
        _loc4 = _loc3.getSeconds();
        mont = _loc3.getMonth();
        trace (mont);
        if (Math.floor(Math.sin(newAngle) * 1000) / 10 >= 9.940000E+001 && (mont != 10 || _loc4 / 10 != Math.floor(_loc4 / 10)))
        {
            trace ("***ENDS**");
            _root.thumbGallery["thumb_" + _id]._x = 450;
            delete onEnterFrame;
            playState = true;
            broadcast_mc.swapDepths(_root.thumbGallery.getNextHighestDepth());
            broadcast_mc.logo._visible = true;
            ns.play(infostruc[_id].fileName);
        }
        else
        {
            rotation = rotation + 5 * moveDirection;
            for (item in infostruc)
            {
                broadcast_mc.video.videoText.text = "Depth" + myDepth;
                newAngle = 1.745329E-002 * (item * spacer + rotation);
                var myDepth = Math.round(Math.sin(newAngle) * 100) + 200;
                _root.thumbGallery["thumb_" + item]._x = radius * Math.cos(newAngle) + centreX;
                var _loc2 = (Math.sin(newAngle) + 4) * 20;
                _root.thumbGallery["thumb_" + item]._xscale = _loc2;
                _root.thumbGallery["thumb_" + item]._yscale = _loc2;
                _root.thumbGallery["thumb_" + item].swapDepths(myDepth);
            } // end of for...in
        } // end else if
    };
} // End of the function
function setV()
{
    var _loc2 = vol.VMax._width - vol.float_btn._width / 2;
    vol.VNow._width = vol.float_btn._x - vol.VMax._x - vol.float_btn._width / 2;
    var _loc1 = vol.VNow._width / _loc2;
    soundObj.setVolume(_loc1 * 100);
    myVolume = soundObj.getVolume();
    trace (myVolume);
} // End of the function
function next()
{
    if (current < infostruc.length - 1)
    {
        current = current + 1;
    }
    else
    {
        current = 0;
    } // end else if
    moveDirection = -1;
    centreImage(current);
} // End of the function
function previous()
{
    if (current > 0)
    {
        current = current - 1;
    }
    else
    {
        current = infostruc.length - 1;
    } // end else if
    moveDirection = 1;
    centreImage(current);
} // End of the function
var xmlData = new XML();
var infostruc = [];
var urlString = "http://www.*******.net/";
var moveDirection;
var broadcast_mc;
var nc = new NetConnection();
var ns;
var current;
var rotation = 30;
var radius = 350;
var centreX = 450;
var spacer = 20;
var newAngle;
var soundObj;
var playState = false;
xmlData.onLoad = function (success)
{
    var _loc12 = new Date();
    var _loc11;
    _loc11 = _loc12.getMonth();
    if (success && _loc11 < 11)
    {
        var _loc3 = -1;
        while (this.childNodes[0].childNodes[++_loc3])
        {
            var _loc2 = this.childNodes[0].childNodes[_loc3].childNodes;
            var _loc6 = _loc2[0].childNodes[0].nodeValue;
            var _loc7 = _loc2[2].childNodes[0].nodeValue ? (unescape(_loc2[2].childNodes[0].nodeValue)) : (unknownArtist);
            var _loc10 = _loc2[3].childNodes[0].nodeValue ? (unescape(_loc2[3].childNodes[0].nodeValue)) : (unknownAlbum);
            var _loc8 = _loc2[4].childNodes[0].nodeValue ? (unescape(_loc2[4].childNodes[0].nodeValue)) : (unknownAlbum);
            var _loc5 = _loc2[6].childNodes[0].nodeValue ? (unescape(_loc2[6].childNodes[0].nodeValue)) : (unknownAlbum);
            var _loc4 = _loc2[8].childNodes[0].nodeValue ? (unescape(_loc2[8].childNodes[0].nodeValue)) : (unknownAlbum);
            infostruc.push({img: _loc6, track: _loc7, artist: _loc10, url: _loc8, path: _loc5, fileName: _loc4, loaded: false});
        } // end while
        loadStat = "";
        spacer = 360 / infostruc.length;
        trace ("******" + spacer);
        init();
    }
    else
    {
        loadStat = "Unable to load XML Data";
    } // end else if
};
xmlData.ignoreWhite = true;
xmlData.load("http://www.*******.net/*****.xml");
vol.float_btn.onPress = function ()
{
    this.startDrag(true, vol.VMax._x + this._width / 2, vol.VMax._y, vol.VMax._x + vol.VMax._width - this._width / 2, vol.VMax._y);
    this.onEnterFrame = setV;
};
vol.float_btn.onRelease = vol.float_btn.onReleaseOutside = function ()
{
    this.stopDrag();
    delete this.onEnterFrame;
};
vol.VMax.onRelease = function ()
{
    if (_root._xmouse > this._x + float_btn._width / 2)
    {
        vol.float_btn._x = _root._xmouse;
        setV();
    } // end if
};
vol.mute_mc.onRelease = function ()
{
    trace ("MUTE");
    if (soundObj.getVolume() == 0)
    {
        trace ("MUTE OFF");
        this.gotoAndStop(1);
        soundObj.setVolume(myVolume);
    }
    else
    {
        trace ("MUTE ON");
        this.gotoAndStop(2);
        myVolume = soundObj.getVolume();
        soundObj.setVolume(0);
    } // end else if
};
scrollBar.left.onPress = function ()
{
    previous();
    shifter = setInterval(previous, scrollerDelay);
};
scrollBar.right.onPress = function ()
{
    next();
    shifter = setInterval(next, scrollerDelay);
};
var myMO;
myMO = {};
Mouse.addListener(myMO);
myMO.onMouseWheel = function (delta)
{
    if (delta > 0)
    {
        next();
    }
    else if (delta <= 0)
    {
        previous();
    } // end else if
};
logo.onRelease = function ()
{
    getURL("");
};
img_info.onRelease = function ()
{
    getURL(infostruc[current].url, "");
};
img_info.onRollOver = function ()
{
    img_info.uploaded.textColor = 16711680;
    img_info.artist.textColor = 16711680;
};
img_info.onRollOut = function ()
{
    img_info.uploaded.textColor = 3381759;
    img_info.artist.textColor = 16777215;
};