Parametri scroll

  • Creatore Discussione Creatore Discussione gab379
  • Data di inizio Data di inizio

gab379

Nuovo Utente
16 Apr 2009
7
0
0
-Nelle azioni del movieclip scroll ho questo codice:


onClipEvent (load) {
buttonSize = 0;
viewHeight = _parent.scroll_bg._height;
viewWidth = _parent.scroll_bg._x;
scrollContent = _parent.for_text;
heightCorect = false;
mouseWheelHitTest = true;
wheelStep = 1;
pageStep = 30;
pageStep2 = 10;
pageDelay = 200;
arroyStep = 10;
arroyStep2 = 0.5;
arroyDelay = 3;
speedDec = 0.650000;
scrollStep = _parent.speed;
_x = scrollContent._x+viewWidth;
_y = scrollContent._y;
dragButtonIsDraging = false;
scrollPos = 0;
upButton._y = 0;
pageUpButton._x = 0;
pageDownButton._x = 0;
contentHeight = heightCorect ? (scrollContent.height) : (scrollContent._height);
scrollHeight = viewHeight-buttonSize*2;
dragButtonHeight = viewHeight<contentHeight ? (viewHeight*scrollHeight/contentHeight) : (scrollHeight);
dragButton._yscale = dragButtonHeight;
dragButton._y = buttonSize;
downButton._y = buttonSize+scrollHeight;
blanckDown._y = downButton._y;
blanckUp._x = 0;
blanckUp._y = 0;
blanck._x = 0;
blanck._y = buttonSize;
blanckDown._x = 0;
pageUpButton._y = buttonSize;
blanck._height = scrollHeight;
blanckUp._visible = viewHeight<contentHeight ? (false) : (true);
blanck._visible = viewHeight<contentHeight ? (false) : (true);
blanckDown._visible = viewHeight<contentHeight ? (false) : (true);
upButton._visible = viewHeight<contentHeight ? (true) : (false);
dragButton._visible = viewHeight<contentHeight ? (true) : (false);
downButton._visible = viewHeight<contentHeight ? (true) : (false);
_parent.drag._visible = viewHeight<contentHeight ? (true) : (false);
_parent.down._visible = viewHeight<contentHeight ? (true) : (false);
mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
if (!mouseWheelHitTest || scrollContent.hitTest(_root._xmouse, _root._ymouse, false) || hitTest(_root._xmouse, _root._ymouse, false)) {
dragButton._y = dragButton._y-delta*wheelStep;
if (dragButton._y<buttonSize) {
dragButton._y = buttonSize;
}
if (dragButton._y>buttonSize+scrollHeight-dragButtonHeight) {
dragButton._y = buttonSize+scrollHeight-dragButtonHeight;
}
}
};
Mouse.addListener(mouseListener);
curY = -scrollContent._y;
vY = 0;
mask = scrollContent._parent.createEmptyMovieClip("mask", scrollContent._parent.getNextHighestDepth());
with (mask) {
beginFill(255, 50);
lineStyle(0, 16711935, 100);
moveTo(scrollContent._x, scrollContent._y);
lineTo(scrollContent._x+viewWidth, scrollContent._y);
lineTo(scrollContent._x+viewWidth, scrollContent._y+viewHeight+10);
lineTo(scrollContent._x, scrollContent._y+viewHeight+10);
endFill();
}
scrollContent.setMask(mask);
}
onClipEvent (enterFrame) {
blanckUp._visible = viewHeight<contentHeight ? (false) : (true);
blanck._visible = viewHeight<contentHeight ? (false) : (true);
blanckDown._visible = viewHeight<contentHeight ? (false) : (true);
upButton._visible = viewHeight<contentHeight ? (true) : (false);
dragButton._visible = viewHeight<contentHeight ? (true) : (false);
downButton._visible = viewHeight<contentHeight ? (true) : (false);
_parent.drag._visible = viewHeight<contentHeight ? (true) : (false);
_parent.down._visible = viewHeight<contentHeight ? (true) : (false);
_parent.scroll_bg._visible = viewHeight<contentHeight ? (true) : (false);
if (incDelay<0) {
dragButton._y = dragButton._y-inc;
if (dragButton._y<buttonSize) {
dragButton._y = buttonSize;
}
if (dragButton._y>buttonSize+scrollHeight-dragButtonHeight) {
dragButton._y = buttonSize+scrollHeight-dragButtonHeight;
}
}
incDelay--;
contentHeight = heightCorect ? (scrollContent.height) : (scrollContent._height);
scrollHeight = viewHeight-buttonSize*2;
dragButtonHeight = viewHeight<contentHeight ? (viewHeight*scrollHeight/contentHeight) : (scrollHeight);
dragButton._yscale = dragButtonHeight;
downButton._y = buttonSize+scrollHeight;
pageDownButton._y = dragButton._y+dragButtonHeight;
pageDownButton._yscale = scrollHeight-dragButtonHeight-dragButton._y+buttonSize-scrollPos;
pageUpButton._yscale = dragButton._y-buttonSize;
if (dragButtonIsDraging) {
stopDrag();
startDrag(dragButton, false, 0, buttonSize, 0, buttonSize+scrollHeight-dragButtonHeight+1);
}
if (dragButton._y>buttonSize+scrollHeight-dragButtonHeight) {
dragButton._y = buttonSize+scrollHeight-dragButtonHeight;
}
newY = (dragButton._y-buttonSize)/dragButtonHeight*viewHeight;
vY = vY+(curY-newY)/scrollStep;
vY = vY*speedDec;
curY = curY-vY;
scrollContent._y = Math.floor(-curY+_y);
}

-e poi ho aggiunto step=20 speed=50 in un livello azioni separato.

Volevo sapere quali valori devo modificare per aumentare la lunghezza dello scroll quando si scorre con il mouse (spero si possa fare!)
 
Problema risolto. Fortuna che alla fine trovo sempre la soluzione!
Cmq per chi avesse un problema simile...
Non arrovellatevi con l'actionscript, la soluzione a volte è quella più banale (come nel mio caso). Modifichi la dimensione del box testo direttamente da Flash! 3 ore sull'actionscript prima di trovare questa stupidaggine... come negli scacchi, a volte la mossa più efficace è quella + basilare.
Scusate lo sfogo, aspettando la risposta... questo Flash fa dannare se come me vai a intuito.
 
sempre, che io sappia, lo scroll si adegua automaticamente al testo.
certo le dimensioni iniziali, ma confesso che non avevo capito ti riferissi a quelle, sono definite all'inizio e determinate secondo le necessità, sarebbe un ble problema in caso contrario.....
ogni componente ha infatti la possibilità di essere configurato a piacere per adeguarlo alle esigenze particolari.
comunque, piuttosto che andare ad intuito, se posso darti un consiglio, utilizza l'help che è molto chiaro e questi problemi li risolve, in pratica, tutti.
:D
 

Discussioni simili