Estoy utilizando el componente scrollbar y scrollPane de Flas 8
El problema que tengo, es que los elementos que yo estoy colocando dentro del panel es un Mclip, con botones, que te al darle click te van llevando mas adelante o mas atras en la linea de tiempo, y alli coloco distintos contenidos. ( Es medio dificil de explicar )
El problema es que cuando inicia el scroll arranca arriba de todo (perfecto) utilizo el scroll para bajar y poder hacer click en algunos de los botones que estan más abajo y no visibles... ese boton tiene la accion on (release) { gotoAndPlay(25); }
va a ese fotograma, pero como previamente baje para llegar al boton, no veo el contenido que quiero mostrar, porque esta arriba de todo... y en este momento no es visible.
RESUMIENDO : Necesito que ya estando dentro del moviclip donde tengo todos los botones... al darle click a cualquiera de ellos, esten mas arriba o abajo.. al ir al fotograma 25 por ejemplo, el scroll arranque nuevamente desde arriba...
se puede ?
coloco aca el codigo que tiene el panel por si sirve de referencia. Es larguisimo, soy principiante y no logro ver como resolver esto. Recuerden que yo dentro.. esto colocando botones que te mueven en la linea de tiempo dentro de, MC
Código ActionScript :
#initclip 2
// ::: FScrollPaneClass
function FScrollPaneClass()
{
this.init();
this.width = this._width;
this.height = this._height;
this._xscale = this._yscale = 100;
this.contentWidth = this.contentHeight = 0;
if (this.hScroll==undefined) {
this.hScroll=this.vScroll="auto";
this.dragContent = false;
}
this.offset = new Object();
function boolToString(str)
{
if (str=="false") return false;
if (str=="true") return true;
else return str;
}
this.vScroll = boolToString(this.vScroll);
this.hScroll = boolToString(this.hScroll);
this.attachMovie("FScrollBarSymbol", "hScrollBar_mc", 100, {hostStyle:this.styleTable});
this.hScrollBar_mc.setHorizontal(true);
this.hScrollBar_mc.setSmallScroll(5);
this.hScrollBar_mc.setChangeHandler("onScroll", this);
this.attachMovie("FScrollBarSymbol", "vScrollBar_mc", 99, {hostStyle:this.styleTable});
this.vScrollBar_mc.setSmallScroll(5);
this.vScrollBar_mc.setChangeHandler("onScroll", this);
this.setSize(this.width, this.height);
if (this.scrollContent!="") {
this.setScrollContent(this.scrollContent);
}
this.setDragContent(this.dragContent);
}
FScrollPaneClass.prototype = new FUIComponentClass();
Object.registerClass("FScrollPaneSymbol", FScrollPaneClass);
// ::: PUBLIC METHODS
FScrollPaneClass.prototype.getScrollContent = function()
{
return this.content_mc;
}
FScrollPaneClass.prototype.getPaneWidth = function()
{
return this.width;
}
FScrollPaneClass.prototype.getPaneHeight = function()
{
return this.height;
}
FScrollPaneClass.prototype.getScrollPosition = function()
{
var xPos = (this.hScrollBar_mc==undefined) ? 0 : this.hScrollBar_mc.getScrollPosition();
var yPos = (this.vScrollBar_mc==undefined) ? 0 : this.vScrollBar_mc.getScrollPosition();
return {x:xPos, y:yPos};
}
FScrollPaneClass.prototype.setScrollContent = function(target)
{
this.offset.x = 0;
this.offset.y = 0;
// remove or hide the old movie clip
if ( this.content_mc != undefined ) {
if (target!=this.content_mc) {
this.content_mc._visible = false;
this.content_mc.removeMovieClip();
this.content_mc.unloadMovie();
}
}
// create the movie clip
if (typeof(target)=="string") {
this.attachMovie(target, "tmp_mc", 3);
this.content_mc = this.tmp_mc;
} else if (target==undefined) {
this.content_mc.unloadMovie();
} else {
this.content_mc = target;
}
this.localToGlobal(this.offset);
this.content_mc._parent.globalToLocal(this.offset);
this.content_mc._x = this.offset.x;
this.content_mc._y = this.offset.y;
var contentBounds = this.content_mc.getBounds(this);
this.offset.x = -contentBounds.xMin;
this.offset.y = -contentBounds.yMin;
this.localToGlobal(this.offset);
this.content_mc._parent.globalToLocal(this.offset);
this.content_mc._x = this.offset.x;
this.content_mc._y = this.offset.y;
this.contentWidth = this.content_mc._width;
this.contentHeight = this.content_mc._height;
// set up the mask
this.content_mc.setMask(this.mask_mc);
this.setSize(this.width, this.height);
}
FScrollPaneClass.prototype.setSize = function(w, h)
{
if (arguments.length<2 || isNaN(w) || isNaN(h)) return;
super.setSize(w,h);
this.width = Math.max(w, 60);
this.height = Math.max(h, 60);
this.boundingBox_mc._xscale = 100;
this.boundingBox_mc._yscale = 100;
// adjust the border size
this.boundingBox_mc._width = this.width;
this.boundingBox_mc._height = this.height;
this.setHandV();
this.initScrollBars();
// set up the mask
if (this.mask_mc==undefined) {
this.attachMovie("FBoundingBoxSymbol", "mask_mc", 3000);
}
this.mask_mc._xscale = 100;
this.mask_mc._yscale = 100;
this.mask_mc._width = this.hWidth;
this.mask_mc._height = this.vHeight;
this.mask_mc._alpha = 0;
}
FScrollPaneClass.prototype.setScrollPosition = function(x,y)
{
x = Math.max(this.hScrollBar_mc.minPos, x);
x = Math.min(this.hScrollBar_mc.maxPos, x);
y = Math.max(this.vScrollBar_mc.minPos, y);
y = Math.min(this.vScrollBar_mc.maxPos, y);
this.hScrollBar_mc.setScrollPosition(x);
this.vScrollBar_mc.setScrollPosition(y);
}
FScrollPaneClass.prototype.refreshPane = function()
{
this.setScrollContent(this.content_mc);
}
FScrollPaneClass.prototype.loadScrollContent = function(url, handler, location)
{
this.content_mc.removeMovieClip();
this.content_mc.unloadMovie();
this.content_mc._visible = 0;
this.loadContent.duplicateMovieClip("loadTemp", 3);
this.dupeFlag = true;
this.contentLoaded = function()
{
this.loadReady = false;
this.content_mc = this.loadTemp;
this.refreshPane();
this.executeCallBack();
}
this.setChangeHandler(handler, location);
this.loadTemp.loadMovie(url);
}
FScrollPaneClass.prototype.setHScroll = function(prop)
{
this.hScroll = prop;
this.setSize(this.width, this.height);
}
FScrollPaneClass.prototype.setVScroll = function(prop)
{
this.vScroll = prop;
this.setSize(this.width, this.height);
}
FScrollPaneClass.prototype.setDragContent = function(dragFlag)
{
if (dragFlag) {
this.boundingBox_mc.useHandCursor = true;
this.boundingBox_mc.onPress = function()
{
this._parent.startDragLoop();
}
this.boundingBox_mc.tabEnabled = false;
this.boundingBox_mc.onRelease = this.boundingBox_mc.onReleaseOutside = function()
{
this._parent.pressFocus();
this._parent.onMouseMove = null;
}
} else {
delete this.boundingBox_mc.onPress;
this.boundingBox_mc.useHandCursor = false;
}
}
// A secret public method - wasn't documented or tested, but works.
// see the setSmallScroll method of FScrollBar for details.
FScrollPaneClass.prototype.setSmallScroll = function(x,y)
{
this.hScrollBar_mc.setSmallScroll(x);
this.vScrollBar_mc.setSmallScroll(y);
}
// ::: 'PRIVATE' METHODS
FScrollPaneClass.prototype.setHandV = function()
{
if ( (this.contentHeight-this.height>2 && this.vScroll!=false) || this.vScroll==true ) {
this.hWidth = this.width-this.vScrollBar_mc._width;
} else {
this.hWidth = this.width;
}
if ((this.contentWidth-this.width>2 && this.hScroll!=false) || this.hScroll==true ) {
this.vHeight = this.height-this.hScrollBar_mc._height;
} else {
this.vHeight = this.height;
}
}
FScrollPaneClass.prototype.startDragLoop = function()
{
this.tabFocused=false;
this.myOnSetFocus();
this.lastX = this._xmouse;
this.lastY = this._ymouse;
this.onMouseMove = function() {
this.scrollXMove = this.lastX-this._xmouse;
this.scrollYMove = this.lastY-this._ymouse;
this.scrollXMove += this.hScrollBar_mc.getScrollPosition();
this.scrollYMove += this.vScrollBar_mc.getScrollPosition();
this.setScrollPosition(this.scrollXMove, this.scrollYMove);
if (this.scrollXMove< this.hScrollBar_mc.maxPos && this.scrollXMove>this.hScrollBar_mc.minPos) {
this.lastX = this._xmouse;
}
if (this.scrollYMove< this.vScrollBar_mc.maxPos && this.scrollYMove>this.vScrollBar_mc.minPos) {
this.lastY = this._ymouse;
}
this.updateAfterEvent();
}
}
FScrollPaneClass.prototype.initScrollBars = function()
{
this.hScrollBar_mc._y = this.height-this.hScrollBar_mc._height;
this.hScrollBar_mc.setSize(this.hWidth);
this.hScrollBar_mc.setScrollProperties(this.hWidth, 0, this.contentWidth-this.hWidth);
this.vScrollBar_mc._visible = (this.hWidth==this.width) ? false : true;
this.vScrollBar_mc._x = this.width-this.vScrollBar_mc._width;
this.vScrollBar_mc.setSize(this.vHeight);
this.vScrollBar_mc.setScrollProperties(this.vHeight, 0, this.contentHeight-this.vHeight);
this.hScrollBar_mc._visible = (this.vHeight==this.height) ? false : true;
}
FScrollPaneClass.prototype.onScroll = function(component)
{
var pos = component.getScrollPosition();
var XorY = (component._name=="hScrollBar_mc") ? "x" : "y";
if (component._name=="hScrollBar_mc") {
this.content_mc._x = -pos+this.offset.x;
} else {
this.content_mc._y = -pos+this.offset.y;
}
}
FScrollPaneClass.prototype.myOnKeyDown = function()
{
var posX = this.hScrollBar_mc.getScrollPosition();
var posY = this.vScrollBar_mc.getScrollPosition();
if (this.hScrollBar_mc.maxPos > this.hScrollBar_mc.minPos) {
if (Key.isDown(Key.LEFT)) {
this.setScrollPosition(posX-3, posY);
} else if (Key.isDown(Key.RIGHT)) {
this.setScrollPosition(posX+3, posY);
}
}
if (this.vScrollBar_mc.maxPos > this.vScrollBar_mc.minPos) {
if (Key.isDown(Key.UP)) {
this.setScrollPosition(posX, posY-3);
} else if (Key.isDown(Key.DOWN)) {
this.setScrollPosition(posX, posY+3);
} else if (Key.isDown(Key.PGDN)) {
this.setScrollPosition(posX, posY+this.vScrollBar_mc.pageSize);
} else if (Key.isDown(Key.PGUP)) {
this.setScrollPosition(posX, posY-this.vScrollBar_mc.pageSize);
}
}
}
#endinitclip
this.deadPreview._visible = false;
Nuevamente desde ya muchas gracias
