home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
pendekar.swf
/
scripts
/
DefineSprite_485_oDimmer
/
frame_1
/
DoAction.as
Wrap
Text File
|
2006-05-08
|
2KB
|
88 lines
function init()
{
if(runOnce)
{
return undefined;
}
runOnce = true;
this.bgColor = new Color(_parent.bg);
this.envColor = new Array(_parent.envBuffer.length);
this.dimVal = false;
this.dimTransform = new Object();
this.currTransform = 100;
this.lock = false;
stop();
}
function turn(x)
{
if(lock)
{
trace("err: Dimmer is locked");
return undefined;
}
limit = x;
currTransform = x;
dimTransform.ra = x;
dimTransform.rb = 0;
dimTransform.ga = x;
dimTransform.gb = 0;
dimTransform.ba = x;
dimTransform.bb = 0;
dimTransform.aa = 100;
dimTransform.ab = 0;
bgColor.setTransform(dimTransform);
}
function dim(x)
{
if(lock)
{
trace("err: Dimmer is locked");
return undefined;
}
if(x % 5 != 0)
{
trace("err: Dim limiter must be a multiple of 5");
return undefined;
}
this.limit = x;
this.dimVal = true;
gotoAndPlay(2);
}
function brighten(x)
{
if(lock)
{
trace("err: Dimmer is locked");
return undefined;
}
if(x % 5 != 0)
{
trace("err: Dim limiter must be a multiple of 5");
return undefined;
}
this.limit = x;
this.dimVal = false;
gotoAndPlay(2);
}
function tr()
{
if(currTransform <= limit && dimVal == true || currTransform >= limit && dimVal == false)
{
gotoAndStop(1);
}
else
{
currTransform = !dimVal ? currTransform + 5 : currTransform - 5;
dimTransform.ra = currTransform;
dimTransform.rb = 0;
dimTransform.ga = currTransform;
dimTransform.gb = 0;
dimTransform.ba = currTransform;
dimTransform.bb = 0;
dimTransform.aa = 100;
dimTransform.ab = 0;
}
bgColor.setTransform(dimTransform);
}
this.onLoad = init();