PDA

View Full Version : vertical scroller


aolba
11-16-2006, 07:58 PM
I'm trying to adapt a code form www.gotoandlearn.com (scrolling thumbs)
the problem is the example is horizontal, I need it to make a vertical version.

But I think I'm missing someting.

this is the original code

panel.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = stroke.getBounds(_root);
function scrollPanel() {
if(_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
if(panel._x >= 89) {
panel._x = 89;
}
if(panel._x <= -751) {
panel._x = -751;
}
var xdist = _xmouse - 250;
panel._x += Math.round(-xdist / 7);
}

the movie is 500x200

this is my code

theGallery.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = stroke.getBounds(_root);

function scrollPanel() {
if(_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
if(theGallery._y >= 12) {
trace(theGallery._y);
theGallery._y = 12;
}
if(theGallery._y <= -getProperty(theGallery,_height)-420) {
trace(theGallery._y);
theGallery._y = -getProperty(theGallery,_height)-420;
}
var ydist = _ymouse - 206;
theGallery._y += Math.round(-ydist / 7);
}


my movie is 760x420

but is didn't stop when is going up...
what should I change?

neilmmm
11-17-2006, 12:33 AM
have yopu got commas that should be fullstops (periods)?

if(theGallery._y <= -getProperty(theGallery,_height)-420) {
trace(theGallery._y);
theGallery._y = -getProperty(theGallery,_height)-420;

should

be

if(theGallery._y <= -getProperty(theGallery._height)-420) {
trace(theGallery._y);
theGallery._y = -getProperty(theGallery._height)-420;

?

aolba
11-17-2006, 12:54 AM
Hmmm you make me hesitate....but no is comma
this is what I get from help in flash:

getProperty(my_mc:Object, property:Object) : Object


I try with period, but I get errorīs.

Anyway I solve part of the problem:

theGallery.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = stroke.getBounds(_root);

function scrollPanel() {
if(_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
altura = getProperty(theGallery,_height)-416;
var ydist = _ymouse - Stage.height/2;
theGallery._y += -ydist / 7;

if(theGallery._y >= 32) {
trace(theGallery._y);
theGallery._y = 32;
}
if(theGallery._y <= -altura) {
trace(theGallery._y);
theGallery._y = -altura;
}

}


I place the highlight line before the last 2 "IF" sentences, and I think that solve my problem...

kool-Aid
11-17-2006, 03:33 PM
I did the same scrolling menu. I a,s orry to say i dont know how to make it vertical, but did you figure out how to script your thumbs in the scrolling panel to actually perform functions. I TRIED EVERYTHING, to try to get the friggin things to load an image in an empty movie clip or navigate to another frame, to no avail. I think it has something to do with the thumbs being nested within the panel object itself, does anyone know how to fix this? Like the delete this.onRollover in the 4 th line of code allows the buttons rollover proerties.

aolba
11-17-2006, 05:25 PM
well I can't say I have an answer, becouse the object I'm scrolling is attached dynamically to the stage...The other problem I encounter was to make a dynamic mask for tho scrolling clip...but I solved that too...

kool-Aid
11-17-2006, 09:33 PM
So if i attach mine dynamically with an onLoadInit command i could script the objects within the scrolling panel? What are your thumbnails functions?

I couldn't get the buttons with in the movie clip to work because i wasn't telling flash their proper name. For example. if i have a menu that is a movie clip with movie clips inside of it i need to tell flash what to do like this.

menu_name.buttonname.onRelease=function()
{
whtever i want it to do here
}

aolba
11-18-2006, 04:26 PM
well I can't tell you about that, becouse that part of code is generated by a component. But I can tell you the component generate the thumbnail list in a MC with the instance name "theGallery" and that's the way I could modiffy the original scrolling code.