Groups | Blog | Home
all groups > flash actionscript > september 2004 >

flash actionscript : scrolling gallery


blood divine
9/15/2004 10:04:37 PM
Hello again! more trouble...

I am using sction script to make a movie clip scroll up or down when the mouse
is in a certain area of the screen. i.e. over a button. It works except after
the gallery has scrolled about 2 times, it stops!? i am duplicating the movie
clip so that the scroll is seamless. The code i'm using to duplicate and scroll
works without a hitch when it doesnt have to think about where the mouse is.
I've used 'IF' loops to find the mouse location and then run the code, would a
'while' or 'do while' be better? The result im looking for is to move the mouse
over an arrow and the gallery scrolls in the respective direction untill the
mouse is removed from the arrow. Can anyone help me with this?
_jrh_
9/15/2004 10:12:45 PM
On the arrow, use a set interval to call your scroll function:

on (rollOver) {
scrollingInt = setInterval(scrollFunc,10);
}
on (rollOut) {
clearInterval(scrollingInt);
}

Where scrollFunc is your scrolling function and 10 is adjusted for speed.
blood divine
9/18/2004 1:00:53 PM
No luck... The gallery still stops. When the code is executed in a
onclipEvent(enterFrame), it will work fine, but if it has to meet a condition
before the code can run, it has problems. What seems to happen is the
duplicated clip scrolls in following the original and then stops.

I'm using the following code to make the gallery scroll....

onClipEvent (load) {
percent_increment = .025;
addstrip2 = false;
}
onClipEvent (enterFrame) {
this._y += (200-300)*percent_increment;

if (this._y<=0 && this._y>=-this._height) {
if (addstrip2 == false) {
this.duplicateMovieClip("strip2", 1);
addstrip = true;
}

_root.welcome.galpad.gallery.strip2._y = this._y+this._height+50;
_root.welcome.galpad.gallery.strip2._x = this._x;
}

if (this._y<=-this._height) {
this._y =
_root.welcome.galpad.gallery.strip2._y+this._height+50;
}
}
_jrh_
9/18/2004 3:16:10 PM
blood divine
9/18/2004 3:24:32 PM
problem solved!
The code i used before was borrowed and adapted for my site. As it didn't do
exectly what i wanted i re-wrote it and now works fine. Thank you for your help.

onClipEvent(load)
{
repostop=this._y-this._height;
reposbottom=this._y;
addstrip=true;

function scrollup()
{
this._y+=(200-300)*0.025;
if(addstrip == true){
this.duplicateMovieClip("strip2",1);
addstrip=false;}
//_root.welcome.galpad.gallery.strip2._alpha=25;
_root.welcome.galpad.gallery.strip2._y=this._y+this._height+10;
_root.welcome.galpad.gallery.strip2._x=this._x;

if(_root.welcome.galpad.gallery.strip2._y<=reposbottom){
this._y=_root.welcome.galpad.gallery.strip2._y;}
}

function scrolldown()
{
this._y-=(200-300)*0.025;
if(addstrip == true){
this.duplicateMovieClip("strip2",1);
addstrip=false;}
//_root.welcome.galpad.gallery.strip2._alpha=25;
_root.welcome.galpad.gallery.strip2._y=this._y+this._height+10;
_root.welcome.galpad.gallery.strip2._x=this._x;

if(this._y>=reposbottom){
_root.welcome.galpad.gallery.strip2._y=this._y;
this._y=repostop-10;}
}
}
AddThis Social Bookmark Button