home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 108
/
jogo-disk-108.iso
/
Games
/
goal_2.swf
/
scripts
/
DefineSprite_349
/
frame_1
/
DoAction.as
Wrap
Text File
|
2010-05-15
|
5KB
|
172 lines
function set_scroll_bar(c_content_height)
{
function drager_release()
{
start_drage = false;
}
function up_release()
{
d_out = true;
}
function down_release()
{
u_out = true;
}
function drage_drager()
{
drager_pos.current = drager_mc._y - drager_pos.strat;
target = drager_pos.current / axis_bar.height * axis_track.height;
mc._y -= (mc._y - target) / fiction;
}
function drager_down()
{
if(d_out)
{
scrolll_speed *= btn_scroll_fiction;
}
if(drager_mc._y > drager_pos.strat)
{
if(scrolll_speed > 0.001)
{
drager_mc._y -= scrolll_speed;
}
}
}
function drager_up()
{
if(u_out)
{
scrolll_speed *= btn_scroll_fiction;
}
if(drager_mc._y < axis_bar.local_y)
{
if(scrolll_speed > 0.001)
{
drager_mc._y += scrolll_speed;
}
}
}
function barBg_mc_hit()
{
if(drager_mc._y >= drager_pos.strat and drager_mc._y <= axis_bar.local_y)
{
drager_mc._y -= (drager_mc._y - mouse_target) / fiction;
}
if(drager_mc._y > axis_bar.local_y)
{
drager_mc._y = axis_bar.local_y;
}
if(drager_mc._y < drager_pos.strat)
{
drager_mc._y = drager_pos.strat;
}
}
function hide_scroll_bar()
{
up_btn._alpha = drager_mc._alpha = down_btn._alpha = barBg_mc._alpha = 0;
up_btn.enabled = drager_mc.enabled = down_btn.enabled = barBg_mc.enabled = false;
}
function show_scroll_bar()
{
up_btn._alpha = drager_mc._alpha = down_btn._alpha = barBg_mc._alpha = 100;
up_btn.enabled = drager_mc.enabled = down_btn.enabled = barBg_mc.enabled = true;
}
function clea_up(_this)
{
removeMovieClip(_this.timer_1);
removeMovieClip(drager_mc.timer);
}
clea_up(this);
myspeed = 1;
fiction = 10;
btn_scroll_fiction = 0.9;
mc._y = mask._y = 0;
drager_mc._y = barBg_mc._y;
drager_mc._x = barBg_mc._x;
scrolll_speed = myspeed;
if(!c_content_height)
{
content_height = mc._height;
}
else
{
content_height = c_content_height;
}
if(content_height < mask._height)
{
hide_scroll_bar();
}
else
{
show_scroll_bar();
}
mc.setMask(mask);
mc_pos = {strat:mask._y,current:0};
axis_track = {height:mask._y - content_height + this.mask._height};
drager_pos = {strat:barBg_mc._y,current:0};
axis_bar = {height:barBg_mc._height - drager_mc._height,local_y:barBg_mc._y + barBg_mc._height - drager_mc._height};
drager_mc.onPress = function()
{
var different;
removeMovieClip(this._parent.timer_1);
start_drage = true;
this.createEmptyMovieClip("timer",0);
different = _ymouse - drager_mc._y;
this.timer.onEnterFrame = function()
{
drage_drager();
if(start_drage)
{
if(drager_mc._y >= drager_pos.strat and drager_mc._y <= axis_bar.local_y)
{
drager_mc._y = _ymouse - different;
}
if(drager_mc._y < drager_pos.strat)
{
drager_mc._y = drager_pos.strat;
}
if(drager_mc._y > axis_bar.local_y)
{
drager_mc._y = axis_bar.local_y;
}
}
};
};
drager_mc.onRelease = drager_mc.onReleaseOutside = drager_release;
up_btn.onPress = function()
{
d_out = false;
scrolll_speed = myspeed;
this._parent.createEmptyMovieClip("timer_1",1);
this._parent.timer_1.onEnterFrame = function()
{
drager_down();
drage_drager();
};
};
down_btn.onPress = function()
{
u_out = false;
scrolll_speed = myspeed;
this._parent.createEmptyMovieClip("timer_1",1);
this._parent.timer_1.onEnterFrame = function()
{
drager_up();
drage_drager();
};
};
up_btn.onRelease = up_btn.onReleaseOutside = up_release;
down_btn.onRelease = down_btn.onReleaseOutside = down_release;
barBg_mc.onPress = function()
{
mouse_target = _ymouse;
this._parent.createEmptyMovieClip("timer_1",1);
this._parent.timer_1.onEnterFrame = function()
{
barBg_mc_hit();
drage_drager();
};
};
}
set_scroll_bar(c_content_height);