Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/03/2008, 10:42
Avatar de ceaped
ceaped
 
Fecha de Ingreso: febrero-2004
Mensajes: 2.185
Antigüedad: 20 años, 2 meses
Puntos: 9
Pregunta pasar Scroll a MX 8

Buenos días.

Hace tiempos me descargue un scroll que está en Flash 5 (no recuerdo de que stio, no es de mi creación).
Lo deseo implementar en MX 8 pero cuando lo pongo en una posición el texto queda justificado en el escenario en la parte superior y no me funciona tampoco al deslizar.
Este el el Código:

mc slider:
Cita:
// Initialize variables for scroll actions.
onClipEvent (load) {
diff_y = _root.bound_box._height-this._height;
bounds = _root.bound_box.getBounds(_root);
top = bounds.yMin+(this._height/2);
bottom = bounds.yMax-(this._height/2);
slide_y = top;
ratio = .3;
}
// Scroll the content movie clip depending where this movie clips is located. It is very important to have the content in the content movie clip aligned to zero.
onClipEvent (enterFrame) {
_root.content._y = -(((this._y-top)/diff_y)*(_root.content._height-_root.bound_box._height));
}
// Initialize friction variables.
onClipEvent (load) {
friction = "0.98";
speed = 1;
size = getProperty(this, _height)/2;
}
// Get timer when mouse is pressed.
onClipEvent (mouseDown) {
o_time = getTimer()/1000;
}
// Get timer again when mouse is released.
onClipEvent (mouseUp) {
n_time = getTimer()/1000;
}
// Friction actions.
onClipEvent (enterFrame) {
time = o_time-n_time;
speed = speed*1.1;
o_y_pos = y_pos;
y_pos = this._y;
if (drag == "true" & slide != "true") {
y_velocity = (y_pos-o_y_pos)*time;
} else {
y_pos = y_pos+(y_velocity/speed);
if (y_pos-size<=bounds.yMin) {
y_pos = bounds.yMin+size;
y_velocity = -y_velocity*friction;
} else if (y_pos+size>=bounds.yMax) {
y_pos = bounds.yMax-size;
y_velocity = -y_velocity*friction;
}
setProperty(this, _y, y_pos);
}
// Movement Actions
if (slide == "true" & drag != "true") {
this._y = slide_y;
slide_y = slide_y-(n_slide_y*ratio);
n_slide_y = slide_y-o_slide_y;
}
}
mc para desplazar manualmente:
Cita:
on (release) {
bounds = _root.bound_box.getBounds(_root);
slide_amount = 50;
if (_root._ymouse>_root.slider._y & _root.slider._y + _root.slider._height/2 < bounds.yMax - slide_amount) {
_root.slider.o_slide_y = _root.slider._y+slide_amount;
_root.slider.slide = "true";
} else if (_root._ymouse<_root.slider._y & _root.slider._y - _root.slider._height/2 > bounds.yMin + slide_amount) {
_root.slider.o_slide_y = _root.slider._y-slide_amount;
_root.slider.slide = "true";
} else if (_root._ymouse>_root.slider._y & _root.slider._y + _root.slider._height/2 > bounds.yMax - slide_amount) {
_root.slider.o_slide_y = bounds.yMax - _root.slider._height/2;
_root.slider.slide = "true";
} else if (_root._ymouse<_root.slider._y & _root.slider._y - _root.slider._height/2 < bounds.yMin + slide_amount) {
_root.slider.o_slide_y = bounds.yMin + _root.slider._height/2;
_root.slider.slide = "true";
}
}
Y se crea otro mc con nombre de instancia "content" que sería el testo.
__________________
Diseñador Gráfico publicitario