PDA

View Full Version : Tool Tip on movie clip



schweez
June 30th, 2006, 10:56 AM
Sorry if this has been covered someplace else, but I have been searching and have found nothing so far.
I am making a photo gallery that loads pictures from a xml file. I have an empty movieclip on the stage that the photos are loaded into. I want a tool tip to pop up when the mouse is on the picture. I have all the code for the tool tip working(it works fine on any of my buttons or text boxes) but not on the movie clip. If I trace the height and width of the movie clip, it says undefined, so I tried adding content to the clip so that is it the same size as the pictures, but still did not work.

picture.onRollOver = function() {

captionFN(true, description[p], this);

this.onRollOut = function() {


captionFN(false);

};
};
picture is my movieclip. captionFN is just the function that turns the tool tip on and off. Any help would be greatly appreciated!

tfoston
July 1st, 2006, 05:19 AM
Could it be that you have a rollout function nested in a rollover function?

Im myself am making a photo gallery from an xml file and i'm currently having problem getting my movieclip loader object to load my xml node value (the picture). When I use the loadmovie() it works just fine, but if i try the MyMcl.loadclip(xmlstuff), I always get undefined. are you having the same?

schweez
July 1st, 2006, 10:09 AM
No, the rollover and rollout work fine if I replace picture, with one of my buttons. It works exactly how I want it to on my button. Here is my code that loads the xml file:

xmlNode = this.firstChild;
image = [];
picTitle = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
picTitle[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
}

picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = picTitle[p];
Hope that helps

tfoston
July 2nd, 2006, 03:56 AM
I would use the MovieCliploader Class to load the pic. When you do, you can invoke the loadInit event which allows you to interact with the movieclip and you'll be able to find the width, height, and just about anything. Hope the code below will help


var myMcl:MovieClipLoader = new MovieClipLoader() //creation of my mcl object
var myList:Object = new Object() //new Object
myMcl.addListener(MyList) //registers MyList to recieve and invoke events
myList.onLoadInit = function(){ //once the load is finished you can interact with it
trace(picture._width) // so you can see that the width isnt 0
picture.onRollOver = function(){
captionFN(true, description[p], this);
this.onRollOut = function(){
captionFN(false)
}//end of onLoadInit
MyMcl.loadclip(image[i], picture)


Let me know if that helps tfostonyahoo.com