stretchriri
11-29-2005, 01:21 PM
hi,
I'm trying to do a v2 component with his class. It's a slideshow component which will display picture with automatic border and a legend.
I have some problem with the use of var in a class file, for exemple I have this function that draw the border:
function drawBorders() {
//Creation of a listener to check if the image is completely loaded
//the currentImageClip has no width and height before the image is fully loaded and initialized
var loaderListener:Object = new Object();
//Create the border clip and give __imgWidth and _imgHeight the _width and _height of the current clip
loaderListener.onLoadInit = function(currentImageClip) {
currentImageClip.createEmptyMovieClip("border_mc", clipDepth + 1);
imgWidth = currentImageClip._width;
imgHeight = currentImageClip._height;
//Draw the border of the clip
currentImageClip.border_mc.lineStyle(1,0x000000);//probleme d'init de la bordure et de la couleur
currentImageClip.border_mc.moveTo (0,0);
currentImageClip.border_mc.lineTo (imgWidth,0);
currentImageClip.border_mc.lineTo (imgWidth,imgHeight);
currentImageClip.border_mc.lineTo (0,imgHeight);
currentImageClip.border_mc.lineTo (0,0);
}
//Add the listener to the MovieClipLoader used to display the image
myImageLoader.addListener(loaderListener);
}
Now I want to use the dimension of the image (imgWidth and imgHeight) in other functions of the class, but no way I can't find a solution to call those variables in an other function.
Anybody could help me?
thanks
I'm trying to do a v2 component with his class. It's a slideshow component which will display picture with automatic border and a legend.
I have some problem with the use of var in a class file, for exemple I have this function that draw the border:
function drawBorders() {
//Creation of a listener to check if the image is completely loaded
//the currentImageClip has no width and height before the image is fully loaded and initialized
var loaderListener:Object = new Object();
//Create the border clip and give __imgWidth and _imgHeight the _width and _height of the current clip
loaderListener.onLoadInit = function(currentImageClip) {
currentImageClip.createEmptyMovieClip("border_mc", clipDepth + 1);
imgWidth = currentImageClip._width;
imgHeight = currentImageClip._height;
//Draw the border of the clip
currentImageClip.border_mc.lineStyle(1,0x000000);//probleme d'init de la bordure et de la couleur
currentImageClip.border_mc.moveTo (0,0);
currentImageClip.border_mc.lineTo (imgWidth,0);
currentImageClip.border_mc.lineTo (imgWidth,imgHeight);
currentImageClip.border_mc.lineTo (0,imgHeight);
currentImageClip.border_mc.lineTo (0,0);
}
//Add the listener to the MovieClipLoader used to display the image
myImageLoader.addListener(loaderListener);
}
Now I want to use the dimension of the image (imgWidth and imgHeight) in other functions of the class, but no way I can't find a solution to call those variables in an other function.
Anybody could help me?
thanks