Groups | Blog | Home
all groups > flash actionscript > november 2005 >

flash actionscript : list rollover syntax


timdiacon
11/18/2005 9:07:59 PM
Hello,

I have a bunch of images which are each contained within their own movie clip
named thumb1, thumb2 etc

They are all set to alpha=0 and when I rollover my list component I want the
thumb relavent to the index of the list item rolled over to become visible. At
the moment I have:

// list rollover function
var listListener:Object = new Object();
listListener.itemRollOver = function(evt_obj) {
rolled_index = (evt_obj.index);
thumb[artist_box.getItemAt(rolled_index).data]._alpha = 100;
//thumb0._alpha = 100; // if I use this line it works so I am sure it is just
the syntax in the line above which is wrong
};
artist_box.addEventListener("itemRollOver", listListener);
// roll out function
listListener.itemRollOut = function() {
thumb[artist_box.getItemAt(rolled_index).data]._alpha = 0; // again this one
needs fixing
};
// Add listener.
artist_box.addEventListener("itemRollOut", listListener);

Any help appreciated :-)
juankpro
11/18/2005 9:35:10 PM
Change this:

thumb[artist_box.getItemAt(rolled_index).data]._alpha = 100;

With this:

_root["thumb" + artist_box.getItemAt(rolled_index).data]._alpha = 100;

Note that I used root supposing you have your objects in the main timeline but
if it is not the case replace _root for the path of your movie clip.
juankpro
11/18/2005 9:36:34 PM
You can do this too. Put this as the first line of code (before the first line):

myClip = this;

AddThis Social Bookmark Button