Difference between revisions of "Logo.as"

From Organic Design wiki
(Update to current with fade etc)
 
({{legacy}})
 
(202 intermediate revisions by 4 users not shown)
Line 1: Line 1:
// Textbox
+
{{legacy}}
createTextField( 'rc', 1, 0, 0, 190, 120 );
+
<as>
with ( fmt = new TextFormat() ) {
+
// This is the script which compiles the logo with dynamic changes behind it
align = "left";
+
// - compiles [[[[Logo_Test|here]]]]
bold = true;
+
// - the info it renders is obtained from [[[[Special:Recentchanges]]]] and is generated by [[[[transform-changes.php]]]]
bullet = false;
+
#include "box-model.as"
color = 0x808099;
+
 
font = "Arial";
+
// Constants
size = 12;
+
background = parseInt(background,16);
}
+
bg_r = (background & 0xff0000)>>16;
with ( rc ) {
+
bg_g = (background & 0x00ff00)>>8;
setNewTextFormat( fmt );
+
bg_b = (background & 0x0000ff);
 +
fw = 20; // width of fades
 +
id0 = 1;
 +
changes = [];
 +
change = false;
 +
offset = -200;
 +
stripes = (width >= 200);
 +
lineHeight = height/nchanges; // NOTE: don't use rects for stripes, use multiples positioned textboxes
 +
 
 +
// 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] = '<font size="9" face="arial, helvetica" color="'+textcol+'">'+time+': (<u><font color="#217A28">'+author+'</font></u>) ';
 +
changes[i] += title+'</font><font face="arial" size="10">&nbsp;</font><br>';
 +
}
 +
rc.htmlText = changes.join('');
 +
// Get info if any returned
 +
if (recv.user) _root.user = recv.user;
 +
}
 +
};
 +
 
 +
// Textbox for changes-text
 +
createTextField('rc', 1, 3, 0, width, height);
 +
with (rc) {
 +
autosize = 'left';
 
selectable = false;
 
selectable = false;
 
_quality = 'BEST';
 
_quality = 'BEST';
 
border = false;
 
border = false;
//multiline = true;
+
multiline = true;
 
wordWrap = false;
 
wordWrap = false;
 
html = true;
 
html = true;
htmlText = "<font face=\"arial\" color=\"#8080AA\">testing<br><u><a href=\"/testing\">testing</a></u><br>jehfk kwa fajkwfh akfhakwjfhaw hfa<br>wafua faf awufhwaif ak fhzafafipg<br>uwfhia</font>";
 
 
}
 
}
// Logo
+
 
attachMovie( 'logo', 'xmlwiki', 2 );
+
if (stripes) {
//xmlwiki._alpha = 75;
+
// Striped background
 +
createEmptyMovieClip('bg',0);
 +
for (i = 0; i<nchanges; i++) {
 +
createSymbol(bg,'rect','bg'+i,i);
 +
var bgi = bg['bg'+i];
 +
col = new Color(bgi);
 +
col.setTransform({rb:0xd4,gb:0xd4,bb:0xd4});
 +
bgi._width = width;
 +
bgi._height = lineHeight;
 +
bgi._x = 0;
 +
bgi._y = i*lineHeight;
 +
if (i%2) bgi._visible = false;
 +
}
 +
bg._x = width/2;
 +
bg._width = width;
 +
bg._height = height;
 +
}
 +
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 = 0;
 +
}
 +
}
 +
 
 +
// Per-frame function
 +
function reduce() {
 +
 
 +
// Scrolling
 +
if ( offset < 0 ) offset++;
 +
rc._y = offset;
 +
if (stripes) bg._y = offset+500;
 +
 
 +
// 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' );
 +
}
 +
 
 +
}
 +
</as>

Latest revision as of 06:30, 5 May 2007

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.

<as> // This is the script which compiles the logo with dynamic changes behind it // - compiles [[here]] // - the info it renders is obtained from [[Special:Recentchanges]] and is generated by [[transform-changes.php]]

  1. include "box-model.as"

// 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; stripes = (width >= 200); lineHeight = height/nchanges; // NOTE: don't use rects for stripes, use multiples positioned textboxes

// 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] = ''+time+': ('+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, 3, 0, width, height); with (rc) { autosize = 'left'; selectable = false; _quality = 'BEST'; border = false; multiline = true; wordWrap = false; html = true; }

if (stripes) { // Striped background createEmptyMovieClip('bg',0); for (i = 0; i<nchanges; i++) { createSymbol(bg,'rect','bg'+i,i); var bgi = bg['bg'+i]; col = new Color(bgi); col.setTransform({rb:0xd4,gb:0xd4,bb:0xd4}); bgi._width = width; bgi._height = lineHeight; bgi._x = 0; bgi._y = i*lineHeight; if (i%2) bgi._visible = false; } bg._x = width/2; bg._width = width; bg._height = height; } 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 = 0; } }

// Per-frame function function reduce() {

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

// 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' ); }

} </as>