Difference between revisions of "Server-monitor.as"

From Organic Design wiki
(add actionscript)
 
(paste logo code)
Line 1: Line 1:
// Instantiate the ball from classes supplied by swf.php
+
textcol = '#' + textcol;
attachMovie( 'triangle', 'ball', 1 );
+
background = parseInt( background, 16 );
 +
bg_r = ( background & 0xff0000 ) >> 16;
 +
bg_g = ( background & 0x00ff00 ) >> 8;
 +
bg_b = ( background & 0x0000ff );
 +
fw = 20; // width of fades
 +
id0 = 1;
 +
changes = [];
 +
change = false;
 +
nchanges = 10;
 +
offset = -200;
  
// Set ball scale & colour
+
// Set up async connection with server
ball._xscale = ball._yscale = 50;
+
server = new LoadVars();
col = new Color( ball );
+
server.title = 'RC-Summary'; // wiki page to request
col.setTransform( { rb:0x22, gb:0xff, bb:0 } );
+
server.onLoad = function(success) {
 +
if (success) {
 +
for ( i = 0; i < nchanges; i++ ) {
 +
row = this['item'+i].split(',');
 +
id = row.shift();
 +
if ( ( i == 0 ) && ( id != id0 ) ) {
 +
if ( id0 ) offset = -20;
 +
id0 = id;
 +
}
 +
time = row.shift();
 +
user = row.shift();
 +
user = '<u><a href="/User:'+user+'">'+user+'</a></u>';
 +
title = row.shift();
 +
title = '<a href="/'+title+'">'+title+'</a>';
 +
comment = row.join(',');
 +
if (comment != '') title = comment;
 +
changes[i] = '<font face="arial, helvetica" color="'+textcol+'"><i><b>'+user+' &nbsp;</b> ';
 +
changes[i] += title+'</i></font><font face="arial" size="17">&nbsp;</font><br>';
 +
}
 +
rc.htmlText = changes.join('');
 +
}
 +
};
  
// Initialise dynamics
+
// Textbox
x = 0.0; y = 0.0;
+
createTextField( 'rc', 1, 0, 0, 190, 200 );
vx = 2.0; vy = 0.0;
+
with (rc) {
mx = 2.0; my = 12.0;
+
selectable = false;
 +
_quality = 'BEST';
 +
border = false;
 +
multiline = true;
 +
wordWrap = false;
 +
html = true;
 +
}
  
// Dynamics (called each frame)
+
// Top fade
 +
attachMovie( 'linear', 'top', 2 );
 +
col = new Color( top );
 +
col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } );
 +
top._width = fw;
 +
top._height = width;
 +
top._x = width / 2;
 +
top._y = fw / 2;
 +
top._rotation = 90;
 +
 
 +
// Bottom fade
 +
attachMovie( 'linear', 'bot', 3 );
 +
col = new Color( bot );
 +
col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } );
 +
bot._width = fw;
 +
bot._height = width;
 +
bot._x = width / 2;
 +
bot._y = height - fw / 2;
 +
bot._rotation = 270;
 +
 
 +
// Right fade
 +
attachMovie( 'linear', 'right', 4 );
 +
col = new Color( right );
 +
col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } );
 +
right._width = fw;
 +
right._height = height;
 +
right._x = width - fw / 2;
 +
right._y = height / 2;
 +
right._rotation = 180;
 +
 
 +
// Logo
 +
attachMovie( 'xmlwiki', 'xmlwiki', 5 );
 +
 
 +
// Per-frame function
 
function reduce() {
 
function reduce() {
x += vx; y += vy; vy += 0.5;
+
 
if ( vy > my ) vy = my;
+
// Scrolling
if ( x < 0 ) { x = 0; vx = mx; }
+
if ( offset < 0 ) offset++;
if ( x > 200 ) { x = 200.0; vx = -mx; }
+
rc._y = offset;
if ( y > 200 ) { vy = -my; y = 200.0; }
+
 
ball._x = x; ball._y = y; ball._rotation += vx*2;
+
// Make request on some regular cycle which seems about right
 +
if ( ++_root.ctr%400 == 1 ) {
 +
server.SWF = id0;
 +
server.sendAndLoad( '/wiki/index.php', server, 'GET' );
 +
}
 +
 
 
}
 
}

Revision as of 02:06, 20 March 2006

textcol = '#' + textcol; background = parseInt( background, 16 ); bg_r = ( background & 0xff0000 ) >> 16; bg_g = ( background & 0x00ff00 ) >> 8; bg_b = ( background & 0x0000ff ); fw = 20; // width of fades id0 = 1; changes = []; change = false; nchanges = 10; offset = -200;

// Set up async connection with server server = new LoadVars(); server.title = 'RC-Summary'; // wiki page to request server.onLoad = function(success) { if (success) { for ( i = 0; i < nchanges; i++ ) { row = this['item'+i].split(','); id = row.shift(); if ( ( i == 0 ) && ( id != id0 ) ) { if ( id0 ) offset = -20; id0 = id; } time = row.shift(); user = row.shift(); user = '<a href="/User:'+user+'">'+user+'</a>'; title = row.shift(); title = '<a href="/'+title+'">'+title+'</a>'; comment = row.join(','); if (comment != ) title = comment; changes[i] = ''+user+'   '; changes[i] += title+' 
'; } rc.htmlText = changes.join(); } };

// Textbox createTextField( 'rc', 1, 0, 0, 190, 200 ); with (rc) { selectable = false; _quality = 'BEST'; border = false; multiline = true; wordWrap = false; html = true; }

// Top fade attachMovie( 'linear', 'top', 2 ); col = new Color( top ); col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } ); top._width = fw; top._height = width; top._x = width / 2; top._y = fw / 2; top._rotation = 90;

// Bottom fade attachMovie( 'linear', 'bot', 3 ); col = new Color( bot ); col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } ); bot._width = fw; bot._height = width; bot._x = width / 2; bot._y = height - fw / 2; bot._rotation = 270;

// Right fade attachMovie( 'linear', 'right', 4 ); col = new Color( right ); col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } ); right._width = fw; right._height = height; right._x = width - fw / 2; right._y = height / 2; right._rotation = 180;

// Logo attachMovie( 'xmlwiki', 'xmlwiki', 5 );

// Per-frame function function reduce() {

// Scrolling if ( offset < 0 ) offset++; rc._y = offset;

// Make request on some regular cycle which seems about right if ( ++_root.ctr%400 == 1 ) { server.SWF = id0; server.sendAndLoad( '/wiki/index.php', server, 'GET' ); }

}