Difference between revisions of "Logo.as"
(rv - no tables) |
(add stripes) |
||
Line 6: | Line 6: | ||
// Constants | // Constants | ||
− | background = parseInt( background, 16 ); | + | background = parseInt(background,16); |
− | bg_r = ( background & 0xff0000 ) >> 16; | + | bg_r = (background & 0xff0000)>>16; |
− | bg_g = ( background & 0x00ff00 ) >> 8; | + | bg_g = (background & 0x00ff00)>>8; |
− | bg_b = ( background & 0x0000ff ); | + | bg_b = (background & 0x0000ff); |
fw = 20; // width of fades | fw = 20; // width of fades | ||
id0 = 1; | id0 = 1; | ||
changes = []; | changes = []; | ||
change = false; | change = false; | ||
− | |||
offset = -200; | offset = -200; | ||
Line 23: | Line 22: | ||
recv.onLoad = function(success) { | recv.onLoad = function(success) { | ||
if (success) { | if (success) { | ||
− | for ( i = 0; i < nchanges; i++ ) { | + | for (i = 0; i<nchanges; i++) { |
row = recv['item'+i].split(','); | row = recv['item'+i].split(','); | ||
id = row.shift(); | id = row.shift(); | ||
Line 46: | Line 45: | ||
// Textbox for changes-text | // Textbox for changes-text | ||
− | createTextField( 'rc', 1, 0, 0, width, height ); | + | createTextField('rc', 1, 0, 0, width, height); |
− | with ( rc ) { | + | with (rc) { |
selectable = false; | selectable = false; | ||
_quality = 'BEST'; | _quality = 'BEST'; | ||
Line 57: | Line 56: | ||
// Top fade | // Top fade | ||
− | createSymbol( this, 'linear', 'top', 2 ); | + | createSymbol(this, 'linear', 'top', 2); |
− | col = new Color( top ); | + | col = new Color(top); |
− | col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } ); | + | col.setTransform({rb:bg_r, gb:bg_g, bb:bg_b}); |
top._width = fw; | top._width = fw; | ||
top._height = width; | top._height = width; | ||
Line 67: | Line 66: | ||
// Bottom fade | // Bottom fade | ||
− | createSymbol( this, 'linear', 'bot', 3 ); | + | createSymbol(this, 'linear', 'bot', 3); |
− | col = new Color( bot ); | + | col = new Color(bot); |
− | col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } ); | + | col.setTransform({rb:bg_r, gb:bg_g, bb:bg_b}); |
bot._width = fw; | bot._width = fw; | ||
bot._height = width; | bot._height = width; | ||
Line 77: | Line 76: | ||
// Right fade | // Right fade | ||
− | createSymbol( this, 'linear', 'right', 4 ); | + | createSymbol(this, 'linear', 'right', 4); |
− | col = new Color( right ); | + | col = new Color(right); |
− | col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } ); | + | col.setTransform({rb:bg_r,gb:bg_g,bb:bg_b}); |
right._width = fw; | right._width = fw; | ||
right._height = height; | right._height = height; | ||
− | right._x = width - fw / 2; | + | right._x = width-fw/2; |
− | right._y = height / 2; | + | right._y = height/2; |
right._rotation = 180; | right._rotation = 180; | ||
− | // Logo (specified for inclusion in XML properties article) | + | if (stripes) { |
− | attachMovie( 'xmlwiki', ' | + | // Striped background |
− | with ( | + | createEmptyMovieClip('bg',0) |
− | + | for (i = 0; i<nchanges; i++) { | |
− | + | createSymbol(bg,'rect','bg'+i,i); | |
− | + | var bgi = bg['bg'+i]; | |
− | + | bgi._width = width; | |
+ | bgi._height = height/nchanges; | ||
+ | bgi._x = 0; | ||
+ | bgi._y = i*bgi._height; | ||
+ | bgi._visible = i%2; | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | // Logo in background (specified for inclusion in XML properties article) | ||
+ | attachMovie('xmlwiki','bg',0); | ||
+ | with (bg) { | ||
+ | _xscale = _yscale = 75; | ||
+ | _x = (width-_width)/2; | ||
+ | _y = (height-_height)/2; | ||
+ | _alpha = 50; | ||
+ | } | ||
} | } | ||
Line 100: | Line 114: | ||
// Scrolling | // Scrolling | ||
if ( offset < 0 ) offset++; | if ( offset < 0 ) offset++; | ||
− | rc._y = offset; | + | rc._y = bg._y = offset; |
// Make request on some regular cycle which seems about right | // Make request on some regular cycle which seems about right |
Revision as of 04:14, 23 September 2006
// This is the script which compiles the logo with dynamic changes behind it // Compile [[here]]
- include "box-model.as"
// Dynamic parameters
// Constants 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; offset = -200;
// Set up async connection with server
server = new LoadVars();
recv = new LoadVars();
server.title = 'Special:Recentchanges'; // wiki page to request
recv.onLoad = function(success) {
if (success) {
for (i = 0; i<nchanges; i++) {
row = recv['item'+i].split(',');
id = row.shift();
if ( ( i == 0 ) && ( id != id0 ) ) {
if ( id0 ) offset = -20;
id0 = id;
}
time = row.shift();
author = row.shift();
title = row.shift();
textcol = row.shift();
comment = row.join(',');
if (comment != ) title = comment;
changes[i] = ''+author+' ';
changes[i] += title+'
';
}
rc.htmlText = changes.join();
// Get info if any returned
if (recv.user) _root.user = recv.user;
}
};
// Textbox for changes-text createTextField('rc', 1, 0, 0, width, height); with (rc) { selectable = false; _quality = 'BEST'; border = false; multiline = true; wordWrap = false; html = true; }
// Top fade createSymbol(this, '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 createSymbol(this, '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 createSymbol(this, '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;
if (stripes) { // Striped background createEmptyMovieClip('bg',0) for (i = 0; i<nchanges; i++) { createSymbol(bg,'rect','bg'+i,i); var bgi = bg['bg'+i]; bgi._width = width; bgi._height = height/nchanges; bgi._x = 0; bgi._y = i*bgi._height; bgi._visible = i%2; } } else { // Logo in background (specified for inclusion in XML properties article) attachMovie('xmlwiki','bg',0); with (bg) { _xscale = _yscale = 75; _x = (width-_width)/2; _y = (height-_height)/2; _alpha = 50; } }
// Per-frame function function reduce() {
// Scrolling if ( offset < 0 ) offset++; rc._y = bg._y = offset;
// Make request on some regular cycle which seems about right // todo: move to socket.onData if ( ++_root.ctr%400 == 1 ) { server.SWF = id0; server.INFO = 1; // request info if user unknown server.sendAndLoad( '/wiki/index.php', recv, 'GET' ); }
}