|
1.
Select the left side scroll button (facing towards left)
2. Choose Window > Actions.
3. In the Object Actions panel type the following action:
|
on
(press)
{ |
|
|
tellTarget
("left") { |
|
|
|
gotoAndPlay
(2); |
|
|
} |
|
| |
} |
| |
on
(release)
{ |
| |
|
tellTarget
("left") { |
| |
|
|
gotoAndStop
(1); |
| |
|
} |
|
| |
} |
|
//
|
on
(press)
{ |
|
|
tellTarget
("left") { |
|
|
|
gotoAndPlay
(2); |
|
|
} |
|
|
} |
On
pressing the left scroll button,actionscript will enter in
the left scroll movie clip (instance name 'left') and will
jump to the second frame of that movie clip. There it will
process the action given on that frame so that the scroll
can work.
| // |
on
(release)
{ |
|
|
tellTarget
("left") { |
|
|
|
gotoAndStop
(1); |
|
|
} |
|
|
} |
On
releasing the left scroll button,actionscript will jump back
to the first frame in the left scroll movie clip. Due to 'stop'
action given on the first frame in the left scorll movie clip,
the actionscript will do nothing and the scroll will stop
working.
4.
Select the right side scroll button (facing towards right)
5. Choose Window > Actions.
6. In the Object Actions panel type the following action:
|
on
(press)
{ |
|
|
tellTarget
("right") { |
|
|
|
gotoAndPlay
(2); |
|
|
} |
|
|
} |
|
on
(release)
{ |
|
|
tellTarget
("right") { |
|
|
|
gotoAndStop
(1); |
|
|
} |
|
| |
} |
|
//
|
on
(press)
{ |
|
|
tellTarget
("right") { |
|
|
|
gotoAndPlay
(2); |
|
|
} |
|
|
} |
On
pressing the right scroll button,actionscript will enter in
the right scroll movie clip (instance name 'right') and will
jump to the second frame of that movie clip. There it will
process the action given on that frame so that the scroll
can work.
| // |
on
(release)
{ |
|
|
tellTarget
("right") { |
|
|
|
gotoAndStop
(1); |
|
|
} |
|
|
} |
On
releasing the right scroll button,actionscript will jump back
to the first frame in the right scroll movie clip. Due to
'stop' action given on the first frame in the right scorll
movie clip, the actionscript will do nothing and the scroll
will stop working.
To
give a final finishing touch to the thumbnail scroll we have
put a panel image over the thumbnail scroll.
1.
Insert a new layer above Scroll Movie Clip layer.(Choose
Insert > Layer)
2. Rename the layer as 'Mask'.
3. Draw a rectangle patch so that it can cover the 3 thumbnail
buttons under it.
4.
Choose Modify > Layer.
5. In the Layer Properties panel click the radio button
for mask.
6.
Select the Scroll Movie Clip layer.
7. Choose Modify > Layer
8. In the Layer Properties panel click the radio button
for masked.
Now
our thumbnails scroll is ready to scroll.
Choose
Control > Test Movie
Click the scroll butttons to see how the thumbnail scroll
works.
Another
method of scrolling the thumbnails is with the help of keyboard
toggle keys.
To
make the thumbnail scroll work through the toggle keys , follow
the steps given below.
1.
Select the scroll movie clip on the stage.
2. Chooose Window > Actions.
3. In the Object Actions panel type the following action:
|
onClipEvent
(load)
{ |
|
|
movespeed
= 5; |
|
} |
|
onClipEvent
(enterFrame)
{ |
|
| |
if
(Key.isDown(Key.RIGHT))
{ |
|
|
|
this._x
-= movespeed; |
|
|
if
(this._x<=-521.4)
{ |
|
|
|
setProperty
("_root.scroll",
_x,
-521.4); |
|
}
|
|
|
|
}
|
else
if (Key.isDown(Key.LEFT))
{ |
|
|
|
this._x
+= movespeed; |
|
|
if
(this._x>=97)
{ |
|
|
|
setProperty
("_root.scroll", _x,
97); |
|
}
|
|
|
}
|
|
|
} |
|
| // |
onClipEvent
(load)
{ |
|
|
movespeed
= 5; |
|
} |
With
the help of onClipEvent(load) action,the 'movespeed' variable
value determines the moving speed of the scoll movie clip
as we have done it earlier.
| // |
onClipEvent
(enterFrame)
{ |
|
| |
if
(Key.isDown(Key.RIGHT))
{ |
|
With
the help of onClipEvent (enterFrame) action,the actionscript
will check the scroll key pressed on the keyboard.Here the
actionscript checks whether the Right scroll key is pressed.If
the Right scroll key is pressed then actionscript will move
further on to the next line.
//
this._x
-= movespeed;
If the Right scroll key is pressed then this action will make
decrement in the x position value of the scroll movie clip
according to movespeed.
| // |
|
if
(this._x<=-521.4)
{ |
|
|
|
setProperty
("_root.scroll",
_x,
-521.4); |
|
}
|
|
These
lines will check whether the x position of the scroll movie
clip is less than or equal to -521.4 . If this condition satisfies
then the setProperty method will fix the x position of the
scroll movie clip to -521.4
// else
if (Key.isDown(Key.LEFT))
{
With the help of onClipEvent (enterFrame)
action,the actionscript will check the scroll key pressed
on the keyboard. Here the actionscript checks whether the
Left scroll key is pressed.If the Left scroll key is pressed
then actionscript will move further on to the next line.
//
this._x
+= movespeed;
If the Left scroll key is pressed then
this action will make increment in the x position value of
the scroll movie clip according to movespeed.
| // |
|
if
(this._x>=97)
{ |
|
|
|
setProperty
("_root.scroll",
_x,
97); |
|
}
|
|
These
lines will check whether the x position of the scroll movie
clip is greater than or equal to 97. If this condition satisfies
then the setProperty method will fix the x position of the
scroll movie clip to 97.
Choose Control > Test Movie
Press
the keyboard toggle keys to see how the thumbnail scroll works.
Now
our thumbnail scroll is done.and it's working very nicely.
We
have to create a screen movie clip to load the main images
into it.
|