Проработал я в одной "елитной" флеш девелоперской конторе нашего города, фактически страны, ровно месяц, далее нервы не выдержали, сбежал. Задача была одна - копаться в коде (а таких сайтов у них под 50) и вносить изменения и добавлять новости в XML или прямо во флешку, никакой админки.
Вот пример:
Fla фаил, 2500 срочек в первом кадре, на втором в одном мувиклипе лежат все(!) мувики из библиотеки, на третем stop(). Всё ДИКО тормозит на QuadCore + 4GB RAM. Коментов нет.
Вопрос:
Это я дурак, что не смог с первого раза понять, что сей код делает? или это какой то особый зен-стайл кодинг?
Первые 250 строчек:

Код AS3:
stop();
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
var Root:MovieClip=new MovieClip();
Root.page=0;
var Desc:MovieClip=new MovieClip();
addChild(Root);
Root.val=0.03;
addChild(Desc);
Root.artAccess=true;
Root.Id=0;
initIntro();
function initIntro()
{
var intro:MovieClip=new MovieClip();
Root.addChild(intro);
var dis:MovieClip=new logodis();
var rus:MovieClip=new logorus();
var im:MovieClip=new logoim();
im.visible = false;
var txt:MovieClip=new introText();
txt.gotoAndStop(lang);
intro.addChild(dis);
intro.addChild(rus);
intro.addChild(im);
intro.addChild(txt);
dis.x=-2000;
rus.x=3000;
im.x=500;
dis.y=150;
rus.y=220;
im.y=2000;
txt.x=1000/2-txt.width/2;
txt.y=265; //355
txt.alpha=0;
intro.addEventListener(Event.ENTER_FRAME,introEnterFrame);
function introEnterFrame(event:Event):void
{
dis.x+=(500-dis.x)/3;
rus.x+=(500-rus.x)/3;
im.y+=(305-im.y)/3;
if(dis.x+1>500&&rus.x-1<500&&im.y-1<305)
{
txt.alpha+=(1-txt.alpha)/7;
if(txt.alpha>0.93)
{
intro.removeEventListener(Event.ENTER_FRAME,introEnterFrame);
setTimeout(closeIntro,1000);
}
}
}
function closeIntro()
{
txt.addEventListener(Event.ENTER_FRAME,txtEnterFrame);
function txtEnterFrame(event:Event):void
{
txt.alpha+=(0-txt.alpha)/7;
if(txt.alpha<0.05)
{
dis.x+=(stage.stageWidth+200-dis.x)/3;
rus.x+=((1000-stage.stageWidth)/2-200-rus.x)/3;
im.y+=(stage.stageHeight+200-im.y)/3;
if(dis.x+1>stage.stageWidth+200)
{
txt.removeEventListener(Event.ENTER_FRAME,txtEnterFrame);
Root.removeChild(intro);
setTimeout(initMenubg,500);
}
}
}
}
}
function initMenubg()
{
var head:MovieClip=new menu_bg1();
Root.addChild(head);
var bottom:MovieClip=new menu_bg2();
Root.addChild(bottom);
head.x=0;//-(stage.stageWidth-1000)/2;
head.y=0;
head.width=0;
head.height=40;
bottom.y=513;
bottom.width=0;
bottom.x=1013;//+(stage.stageWidth-1000)/2;
function ResizeEnterFrame(event:Event):void
{
//head.x=-(stage.stageWidth-1000)/2;
//bottom.x=1000+(stage.stageWidth-1000)/2;
head.width=1013;//stage.stageWidth;
bottom.width=head.width;
}
head.addEventListener(Event.ENTER_FRAME,headEnterFrame);
function headEnterFrame(event:Event):void
{
head.width+=(1013-head.width)/5;
bottom.width=head.width;
if(head.width+1>1013)
{
head.width=1013;
bottom.width=head.width;
head.removeEventListener(Event.ENTER_FRAME,headEnterFrame);
head.addEventListener(Event.ENTER_FRAME,ResizeEnterFrame);
initMenu();
initPoster();
initSlider();
}
}
}
function initMenu()
{
var menuHead:MovieClip=new MovieClip();
var menuBottom:MovieClip=new MovieClip();
Root.addChild(menuHead);
Root.art=menuHead;
Root.m=menuBottom;
Root.addChild(menuBottom);
var x0:Number=0;
var MenuX:Number=0;
for(var i=1;i<=14;i++)
{
var art:MovieClip=new (getDefinitionByName("art"+i) as Class);
art.gotoAndStop(lang);
menuHead.addChild(art);
art.y=40/2;
art.x=x0;
x0=art.x+art.width+20;
art.name="art"+i;
art.i=i;
art.alpha=0;
art.Alpha=1;
art.addEventListener(Event.ENTER_FRAME,artEnterFrame);
art.access=false;
art.timeOut=Math.floor(Math.random() * (1+50-1)) + 1;
art.norotation=true;
art.addEventListener(MouseEvent.CLICK,artClick);
}
x0=0;
var x1:Number=0;
for(i=0;i<=7;i++)
{
var m:MovieClip=new (getDefinitionByName("menu"+i) as Class);
m.gotoAndStop(lang);
menuBottom.addChild(m);
m.y=35/2-11/2-3;
m.x=x0+m.width/2;
x0=m.x+m.width/2+15;
if(i==0)
{
x1=x0;
x0+=49+15
}
m.alpha=0;
m.Alpha=1;
m.name="menu"+i;
m.access=false;
m.addEventListener(Event.ENTER_FRAME,artEnterFrame);
m.timeOut=Math.floor(Math.random() * (1+50-1)) + 1;
m.Rot=0;
m.i=i;
m.norotation=false;
m.addEventListener(MouseEvent.CLICK,MenuClick);
}
{
i=8;
m=new (getDefinitionByName("menu"+i) as Class);
m.gotoAndStop(lang);
menuBottom.addChild(m);
m.y=35/2-11/2-3;
m.x=x1+m.width/2;
m.alpha=0;
m.Alpha=1;
m.name="menu"+i;
m.access=false;
m.addEventListener(Event.ENTER_FRAME,artEnterFrame);
m.timeOut=Math.floor(Math.random() * (1+50-1)) + 1;
m.Rot=0;
m.i=i;
m.norotation=false;
m.addEventListener(MouseEvent.CLICK,MenuClick);
}
var menuMsk:MovieClip=new maska();
menuMsk.x=60;
menuMsk.y=menuHead.y;
menuMsk.width=1013-115;
Root.addChild(menuMsk);
var isr1:MovieClip=new Artisari();
isr1.x=30;
isr1.y=20;
isr1.alpha=0;
isr1.rotation=180;
isr1.Access=false;
Root.addChild(isr1);
var isr2:MovieClip=new Artisari();
isr2.x=menuMsk.width+60+30;
isr2.y=20;
isr2.alpha=0;
Root.addChild(isr2);
isr2.addEventListener(MouseEvent.CLICK,function(){menuHead.XX=60-(menuHead.width-menuMsk.width); isr2.Access=false; isr1.Access=true;})
isr1.addEventListener(MouseEvent.CLICK,function(){menuHead.XX=60; isr1.Access=false; isr2.Access=true;})
menuHead.mask=menuMsk;
menuHead.x=menuHead.XX=60;//stage.stageWidth/2-menuHead.width/2-(stage.stageWidth-1000)/2;
menuBottom.x=stage.stageWidth/2-menuBottom.width/2-(stage.stageWidth-1000)/2;
menuBottom.y=513;
function artEnterFrame(event:Event):void
{
var mc:MovieClip=event.currentTarget as MovieClip;
--mc.timeOut;
if(mc.timeOut<0)
mc.alpha+=(mc.Alpha-mc.alpha)/6;
if(mc.alpha>0.95)
{
mc.alpha=1;
mc.removeEventListener(Event.ENTER_FRAME,artEnterFrame);
mc.access=true;
mc.addEventListener(MouseEvent.MOUSE_OVER,MenuOver);
mc.addEventListener(MouseEvent.MOUSE_OUT,MenuOut);
mc.buttonMode=true;
if(!mc.norotation)
mc.addEventListener(Event.ENTER_FRAME,menuEnterFrame);
}
}
function menuEnterFrame(event:Event):void
{
isr1.alpha+=(1-isr1.alpha)/3;
isr2.alpha=isr1.alpha;
var mc:MovieClip=event.currentTarget as MovieClip;
mc.rotation+=(mc.Rot-mc.rotation)/3;
menuHead.x+=(menuHead.XX-menuHead.x)/10;
menuBottom.x=stage.stageWidth/2-menuBottom.width/2-(stage.stageWidth-1000)/2;
}
function MenuOver(event:MouseEvent):void
{
var mc:MovieClip=event.currentTarget as MovieClip;
if(!mc.access)return;
cl.color=0xFDB71B;
mc.transform.colorTransform=cl;
if(!mc.norotation)
mc.Rot=(Math.floor(Math.random() * (1+2-1)) + 1)==1?4:-4;
}
function MenuOut(event:MouseEvent):void
{
var mc:MovieClip=event.currentTarget as MovieClip;
if(!mc.access)return;
cl.color=0xFFFFFF;
mc.transform.colorTransform=cl;
if(!mc.norotation)
mc.Rot=0;
}
SelectArtist(-1);
function artClick(event:MouseEvent):void
{
var mc:MovieClip=event.currentTarget as MovieClip;
if(!mc.access)return;
if(!Root.artAccess)return;
Root.artAccess=false;
var mc1:MovieClip=Root.getChildByName("Poster") as MovieClip;
mc1.t.YYY=mc1.t.YY0;
mc1.bot.YYY=mc1.bot.YY0;
mc1.t.alpha=1;
mc1.bot.alpha=1;
mc.access=false;
Desc.alpha=1;
Root.postMask.Start(280);
Root.oq.Alpha=1;
openP();
function openP()
{
if(Desc.numChildren==0)
{
openDescription(mc.i);
}
else
{
closeDescription(mc.i);
}
}
}
В следующий раз будет плюс. ( wvxvw )