PDA

View Full Version : alpha and prototype problem


uplateagain
10-12-2005, 12:09 AM
Hi all.

Relatively new to actionscript so please bare with me.
So I've been building a slideshow [groan.. not one of those again] with thumbnails and what I've done is to make each thumbnail a movieclip of a 'Thumb' class where each thumbnail has a sub movieclip called mcThumb.

function Thumb() {
mcThumb = this.createEmptyMovieClip("mcthumb", 2);
mcThumb._alpha = 0;
this.thumbLoaded = false;
thumb_Listner = this.createEmptyMovieClip("mcThumbListner", -1);
thumb_Listner.onLoadComplete = function(success, loaderObj) {
this._parent.onThumbLoaded();
};
thumbLoader.load(mcThumb, gmcMain.xmlThumbs[this.id], thumb_Listner);
}

What I would like to do with these thumbs is have them invisible until they're loaded then do a fancy tween like a burn in to make them appear when the thumbnail image has finished loading. To test I simply chose to set the mcThumb clip's _alpha to 0 then in the function that is called when the image has loaded set it to 100 again.


Thumb.prototype.onThumbLoaded = function() {

mcThumb._alpha = 100;
trace("onThumbLoaded: Thumb alpha: "+mcThumb._alpha);

this.loadImage();
this.onRollOver = this.doRollOver;
this.onRollOut = this.doRollOut;
this.onRelease = this.doClick;
this.thumbLoaded = true;
};

This is where I'm having trouble - it ain't working :confused: . I can trace the alpha value for the mcThumb after I've changed it and it reports back as 100 yet the image hasn't appeared.

No doubt I'm just missing something that my inexperienced eyes aren't seeing. So if any one can help it would be greatly appreciated.
Cheers

Paerez
10-12-2005, 09:00 PM
I believe that it is actually:
thumb_Listner.onLoadInit
onLoadComplete is when it is done downloading, onLoadInit is when it actually exists and starts running script. Give that a shot.

uplateagain
10-16-2005, 07:56 PM
Well went away from the code for a couple of nights and came back with a fresh mind and realised the problem. I was calling mcThumb = this.createEmptyMovieClip("mcthumb", 2); from inside the Thumb function when I should have been calling this.mcThumb = this.createEmptyMovieClip("mcthumb", 2);

It now works.
Thanks anyway. :)