home *** CD-ROM | disk | FTP | other *** search
- function displayInfo(which)
- {
- win_info.ch_message.str = dict_win_info_message;
- win_info.ch_name.str = data["ch_name" + which];
- win_install.ch_name.str = data["ch_name" + which];
- if(data["ch_size" + which].length >= 1)
- {
- win_info.ch_size.str = dict_win_info_estimated + data["ch_size" + which] + "Kb";
- }
- win_info.ch_details.str = data["ch_details" + which];
- win_info.ch_name.str = data["ch_name" + which];
- win_info.ch_icon.ph.loadMovie(data["ch_icon" + which]);
- win_install.ch_icon.ph.loadMovie(data["ch_icon" + which]);
- win_result.ch_icon.ph.loadMovie(data["ch_icon" + which]);
- win_info.ch_details.scrollObj.gotoAndPlay("set");
- win_info._visible = true;
- win_install._visible = false;
- win_result._visible = false;
- }
- function displayInstall()
- {
- win_install.percBar.colour = new colour(win_install.percBar);
- win_install.percBar.dark._xScale = 1;
- win_install.message = "2Sync is installing the " + win_info.ch_name.str + " channel:";
- win_install.ch_icon.ph.loadMovie(data["ch_icon" + data.ch_current]);
- win_info._visible = false;
- win_install._visible = true;
- win_result._visible = false;
- }
- function displayResult()
- {
- win_info._visible = false;
- win_install._visible = false;
- win_result._visible = true;
- }
- function installOK(result)
- {
- if(retryOrigPos == null)
- {
- retryOrigPos = win_result.retry._x;
- }
- win_result.next._visible = false;
- if(result == 1)
- {
- win_result.ok._visible = true;
- win_result.fail._visible = false;
- win_result.success = "Successful";
- win_result.message = "Successfully installed the " + win_info.ch_name.str + " channel";
- _level0.data.installed.push(_level0.data.ch_current);
- _level0.data.installed.sort();
- if(_level0.data.installed.length < _level0.data.ch_count)
- {
- win_result.message += "\r\rClick next to see more channels\ror click finish to launch 2Sync.";
- win_result.next._visible = true;
- }
- win_result.retry._visible = false;
- win_result.finish._visible = true;
- }
- else
- {
- win_result.ok._visible = false;
- win_result.fail._visible = true;
- win_result.success = "Failed";
- win_result.message = "The following error occured:\r\r" + win_result.error;
- if(_level0.data.installed.length < _level0.data.ch_count)
- {
- win.result.next._visible = true;
- win_result.retry._x = retryOrigPos;
- win_result.message += "\r\rClick retry to try again, next to see more channels\ror click finish to launch 2Sync.";
- }
- else
- {
- win_result.message += "\r\rClick retry to try again or click finish to launch 2Sync.";
- win_result.retry._x = win.result.next._x;
- win.result.next._visible = false;
- }
- win_result.retry._visible = true;
- win_result.finish._visible = true;
- }
- displayResult();
- }
- function prevChannel(count)
- {
- if(100 < count)
- {
- cancel();
- }
- else
- {
- if(_level0.data.ch_current < 2)
- {
- _level0.data.ch_current = _level0.data.ch_count;
- }
- else
- {
- _level0.data.ch_current--;
- }
- if(_level0.getPos(_level0.data.installed,_level0.data.ch_current) == -1)
- {
- _level0.displayInfo(_level0.data.ch_current);
- }
- else
- {
- _level0.prevChannel(count++);
- }
- }
- }
- function nextChannel(count)
- {
- if(100 < count)
- {
- cancel();
- }
- else
- {
- if(_level0.data.ch_current == _level0.data.ch_count)
- {
- _level0.data.ch_current = 1;
- }
- else
- {
- _level0.data.ch_current = _level0.data.ch_current + 1;
- }
- if(_level0.getPos(_level0.data.installed,_level0.data.ch_current) == -1)
- {
- _level0.displayInfo(_level0.data.ch_current);
- }
- else
- {
- _level0.nextChannel(count++);
- }
- }
- }
- function finish()
- {
- sendFS("ch_new","finish");
- }
- function install()
- {
- sendFS("ch_new","install");
- displayInstall();
- }
- function remind()
- {
- _level0.data.installed.push(_level0.data.ch_current);
- sendFS("ch_new","remind_" + win_info.ch_name.str);
- if(_level0.data.installed.length < _level0.data.ch_count)
- {
- nextChannel();
- }
- else
- {
- sendFS("ch_new","cancel");
- }
- }
- function forget()
- {
- _level0.data.installed.push(_level0.data.ch_current);
- sendFS("ch_new","forget_" + win_info.ch_name.str);
- if(_level0.data.installed.length < _level0.data.ch_count)
- {
- nextChannel();
- }
- else
- {
- sendFS("ch_new","cancel");
- }
- }
- function cancel()
- {
- sendFS("ch_new","cancel");
- }
- function next()
- {
- nextChannel();
- }
- function retry()
- {
- sendFS("ch_new","retry");
- displayInstall();
- }
- function sendFS(command, args)
- {
- fscommand(command,args);
- }
- function getPos(thisArray, searchItem)
- {
- for(item in "thisArray")
- {
- if(searchItem == thisArray[item])
- {
- return item;
- }
- }
- return -1;
- }
- function setScroll(scrollObj, fieldObj)
- {
- scrollObj.totalLines = fieldObj.visibleLines + fieldObj.str.maxScroll + 1;
- scrollObj.scrollBar._yScale = int(fieldObj.visibleLines / scrollObj.totalLines * 100);
- scrollObj.scrollBar._y = 0;
- scrollObj.travel = scrollObj.constraint._height - scrollObj.scrollBar._height;
- fieldObj.str.scroll = 1;
- scrollObj._visible = true;
- }
- function setChannelColour()
- {
- if(_level0.env != null && _level0.env.ch != null)
- {
- var tempObjRef = _level0.env.ch;
- var states = ["normal","over","pressed"];
- var colObjects = ["dark","light","text"];
- var setTrans = ["ra","rb","ga","gb","ba","bb","aa","ab"];
- tempObjRef.none = new Object();
- tempObjRef.none.dark = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
- tempObjRef.none.light = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
- tempObjRef.none.text = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
- tempObjRef.clear = new Object();
- tempObjRef.clear.dark = {ra:0,rb:0,ga:0,gb:0,ba:0,bb:0,aa:0,ab:0};
- tempObjRef.clear.light = {ra:0,rb:0,ga:0,gb:0,ba:0,bb:0,aa:0,ab:0};
- tempObjRef.clear.text = {ra:0,rb:0,ga:0,gb:0,ba:0,bb:0,aa:0,ab:0};
- i = 0;
- while(i < states.length)
- {
- tempObjRef[states[i]] = new Object();
- var stateObj = tempObjRef[states[i]];
- c = 0;
- while(c < colObjects.length)
- {
- stateChar1 = states[i].charAt(0);
- stateObj[colObjects[c]] = new Object();
- t = 0;
- while(t < setTrans.length)
- {
- stateObj[colObjects[c]][setTrans[t]] = tempObjRef.colour[stateChar1 + "_" + colObjects[c] + "_" + setTrans[t]];
- t++;
- }
- c++;
- }
- i++;
- }
- if(_level0.colourObjStack == null)
- {
- _level0.colourObjStack = [];
- }
- else
- {
- for(i in "_level0:colourObjStack")
- {
- if(colourObjStack[i] == null or colourObjStack[i].colour == null)
- {
- colourObjStack.splice(i,1);
- }
- else
- {
- colourObjStack[i].colour.refresh();
- }
- }
- }
- }
- }
- function colour(me)
- {
- this.state = new Object();
- this.state.clear = _level0.env.ch.clear;
- this.state.none = _level0.env.ch.none;
- this.state.normal = _level0.env.ch.normal;
- this.state.over = _level0.env.ch.over;
- this.state.pressed = _level0.env.ch.pressed;
- this.dInst = new Color(me.dark);
- this.lInst = new Color(me.light);
- this.tInst = new Color(me.text);
- this.setState = colourObj_setState;
- this.none = function()
- {
- this.setState("none");
- };
- this.normal = function()
- {
- this.setState("normal");
- };
- this.rollover = function()
- {
- this.setState("over");
- };
- this.pressed = function()
- {
- this.setState("pressed");
- };
- this.clear = function()
- {
- this.setState("clear");
- };
- this.init = colourObj_init;
- this.refresh = colourObj_refresh;
- this.init();
- _level0.colourObjStack.push(me);
- }
- function colourObj_setState(which)
- {
- this.dInst.setTransform(this.state[which].dark);
- this.lInst.setTransform(this.state[which].light);
- this.tInst.setTransform(this.state[which].text);
- this.currentState = which;
- }
- function colourObj_init()
- {
- this.normal();
- }
- function colourObj_refresh()
- {
- this.state.normal = _level0.env.ch.normal;
- this.state.over = _level0.env.ch.over;
- this.state.pressed = _level0.env.ch.pressed;
- this.state.clear = _level0.env.ch.clear;
- this.setState(this.currentState);
- }
- function initDlg()
- {
- _level0.data.installed = new Array();
- setChannelColour();
- win_title.colour = new colour(_level0.win_title);
- win_frame.colour = new colour(_level0.win_frame);
- win_bottom.colour = new colour(_level0.win_bottom);
- win_result.ok.colour = new colour(win_result.ok);
- win_result.fail.colour = new colour(win_result.fail);
- win_frame.dark._alpha = 45;
- if(1 < _level0.data.ch_count)
- {
- win_info.ch_prev.colour = new colour(win_info.ch_prev);
- win_info.ch_prev.colour.none();
- win_info.ch_next.colour = new colour(win_info.ch_next);
- win_info.ch_next.colour.none();
- win_info.backFrame.colour = new colour(win_info.backFrame);
- win_install.backFrame.colour = new colour(win_install.backFrame);
- win_result.backFrame.colour = new colour(win_result.backFrame);
- win_info.ch_prev.release = prevChannel;
- win_info.ch_next.release = nextChannel;
- }
- else
- {
- win_info.ch_prev._visible = false;
- win_info.ch_next._visible = false;
- }
- win_info.ch_details.scrollObj.prev.press = function()
- {
- _level0.scrollRoutine.scrollObj = this._parent;
- _level0.scrollRoutine.fieldObj = this._parent._parent;
- _level0.scrollRoutine.dir = -1;
- _level0.scrollRoutine.gotoAndPlay("scroll");
- };
- win_info.ch_details.scrollObj.prev.release = function()
- {
- _level0.scrollRoutine.gotoAndStop("stop");
- };
- win_info.ch_details.scrollObj.next.press = function()
- {
- _level0.scrollRoutine.scrollObj = this._parent;
- _level0.scrollRoutine.fieldObj = this._parent._parent;
- _level0.scrollRoutine.dir = 1;
- _level0.scrollRoutine.gotoAndPlay("scroll");
- };
- win_info.ch_details.scrollObj.next.release = function()
- {
- _level0.scrollRoutine.gotoAndStop("stop");
- };
- win_title.text.str = dict_win_info_title;
- win_info.ch_details.scrollObj.gotoAndPlay("set");
- displayInfo(data.ch_current);
- }
- fscommand("allowScale",0);
- stop();
- win_info._visible = false;
- win_install._visible = false;
- win_result._visible = false;
- dict_win_info_title = "2Sync: New channel available";
- dict_win_info_estimated = "Download size: ";
- fscommand("ch_new","init");
-