Swap Images – javaScript onmouseover; AS 2.0 swapDepths, array, function
July 8th, 2008
I thought you might get a kick out of this. Through the class
and some on line studies, I was able to create essentially the
very same affect using 4 different coding methods. The first
three are in Flash 2.0 and the last one is using javaScript.
———————————————-
ARRAY:
var clipArray:Array = new Array(one_mc, two_mc, three_mc);
a_mc.onRollOver = function() {
showClip(one_mc);
}
b_mc.onRollOver = function() {
showClip(two_mc);
}
c_mc.onRollOver = function() {
showClip(three_mc);
}
function showClip(l_Clip:Object):Void {
for (i=0; i
{
hideClip(clipArray[i]);
}
l_Clip._visible = true;
}
function hideClip(l_clip):Void {
l_clip._visible = false;
}
———————————————-
FUNCTION:
a_mc.onRollOver = function() {
onShow(one_mc);
}
b_mc.onRollOver = function() {
onShow(two_mc);
}
c_mc.onRollOver = function() {
onShow(three_mc);
}
function onShow(movClip:Object):Void {
onHide();
movClip._visible = true;
}
function onHide():Void {
one_mc._visible = false;
two_mc._visible = false;
three_mc._visible = false;
}
———————————————-
SWAPDEPTHS:
a_mc.onRollOver = function() {
onTop(one_mc);
}
b_mc.onRollOver = function() {
onTop(two_mc);
}
c_mc.onRollOver = function() {
onTop(three_mc);
}
function onTop (movClip:Object):Void {
movClip.swapDepths(0);
}

Entry Filed under: AS2, All, DHTML, JavaScript, Tutorial, actionScript
Leave a Comment
You must be logged in to post a comment.
Trackback this post | Subscribe to the comments via RSS Feed