Hi all,
Quickie question. I have a main movie, where I want to load an external movie into, which holds a gallery. However when the external movie successfully loads, the left and right thumbnail scrollers do not work, so I cannot click or view and thumbnails.
I’m guessing the answer is staring right at me, but its been so long I thought I’d plead for some Kirupian help.
Below is the gallery A/S.
/*
set this to the width of the flash movie,
or whatever area you want to be visible.
*/
var stagewidth:Number = 620;
/*
the higher this number is, the slower
the top speed will be. the opposite is
also true, the smaller the number is,
the faster the top speed will be.
*/
var divisions:Number = 30;
/*
This is the padding that you have
between each image in the scrolling
movie clip. this makes it look like
it's looping, because it pads the
side of the movie clip the same as
the real spacing.
*/
var bumper:Number = 10;
/*
This is how fast (in milliseconds)
the movie will check the mouse location.
You shouldn't need to change this,
but if you want to, smaller numbers
check more frequently, and larger
numbers check less frequently. The
smaller the number, the smoother the
animation will look. Trying to make
this number too small may cripple
computers of lesser technology.
*/
var updatespeed:Number = 20;
/*
This just declares the variable so that
it is known throughout all the functions.
You don't need to set this to anything.
If you do, the scrolling clips will
initially move without the user's
interaction. Might be a good way to draw
attention to the clips if using as a
navigation to let the user know how it
works.
*/
var acceleration:Number;
/*
This variable defines the amount of
deceleration you want to see when the
user moves his mouse outside of the
scrolling area. The higher the number,
the less deceleration you will see.
*/
var decelerationmultiplyer:Number = 1.1;
/*
This variable initializes the direction
in which the scroller will move. Setting
this variable to 'Left' or 'Right' is
completely arbitrary. It just needs to
be one of those values.
*/
var moving:String = 'Left';
/*
This set's up the name of the first
movie clip instance on the stage that
we are going to scroll back and forth
*/
var mc_1:MovieClip = _root.clip_1;
/*
This set's up the name of the second
movie clip instance on the stage that
we are going to scroll back and forth
*/
var mc_2:MovieClip = _root.clip_2;
/*
This defines the top of the scrolling
area.
*/
var topscrollboundary:Number = mc_1._y;
/*
This defines the bottom of the
scrolling area.
*/
var bottomscrollboundary:Number = mc_1._y + mc_1._height;
/*
this function positions the clips a
bumper away from each other before
checking to see if they have reached
their limits. this was extracted from
the scroll functions to keep with the
DRY mentality.
*/
function positionClips () {
if (mc_1._x > mc_2._x) {
mc_2._x -= acceleration;
mc_1._x = mc_2._x + mc_2._width + bumper;
} else {
mc_1._x -= acceleration;
mc_2._x = mc_1._x + mc_1._width + bumper;
}
}
/*
this function moves the images to the
left This function gets called when
your cursor is on the right half of
the movie
*/
function scrollLeft () {
positionClips();
if (mc_1._x >= mc_1._width && mc_1._x >= stagewidth)
mc_1._x = mc_2._x - mc_1._width - bumper;
if (mc_2._x >= mc_2._width && mc_2._x >= stagewidth)
mc_2._x = mc_1._x - mc_2._width - bumper;
}
/*
this function moves the images to the
right. This function gets called when
your cursor is on the left half of
the movie
*/
function scrollRight () {
positionClips();
if (mc_1._x + mc_1._width < 0)
mc_1._x = mc_2._x + mc_2._width + bumper;
if (mc_2._x + mc_1._width < 0)
mc_2._x = mc_1._x + mc_1._width + bumper;
}
/*
this function figures out what speed
the images should be moved at in
relation to the mouse location, which
direction the images should be moved
and then moves them.
*/
function updateScroll () {
acceleration = ((_root._xmouse - (stagewidth / 2)) / divisions);
if (_root._xmouse > (stagewidth / 2)) {
moving = 'Right';
scrollRight();
} else {
moving = 'Left';
scrollLeft();
}
}
/*
This function controls the deceleration
of the clips to the left by using the
original scrollLeft() method.
*/
function slowDownLeft()
{
if (Math.abs(acceleration) > 0)
{
_getDeceleration();
scrollLeft();
}
}
/*
This function controls the deceleration
of the clips to the right by using the
original scrollRight() method.
*/
function slowDownRight()
{
if (acceleration > 0)
{
_getDeceleration();
scrollRight();
}
}
/*
Utility function updates the acceleration
variable to account for the deceleration
during slow down.
*/
function _getDeceleration ()
{
tmpaccel = (Math.floor(Math.abs(acceleration) / decelerationmultiplyer) > 0) ? (Math.floor(Math.abs(acceleration) / decelerationmultiplyer)) : 0
if (moving == 'Left') {
acceleration = -tmpaccel;
} else if (moving == 'Right') {
acceleration = tmpaccel;
}
}
/*
This function is repeatedly called via
the mouseupdate interval. It checks if
the mouse is within the target area for
scrolling and then either updates the
scroll positions directly, or begins
the deceleration process
*/
function mouseTracker ()
{
if (_root._ymouse >= topscrollboundary && _root._ymouse <= bottomscrollboundary) {
updateScroll();
} else {
eval('slowDown' + moving).call();
}
}
/*
this bit of code repeatedly calls the updateScroll function
at the specified interval
*/
var mouseupdate = setInterval(mouseTracker, updatespeed);
If anyone can spare a minute to take a look, I’ll buy them a
!