[Tweener] from TweenLite to Tweener

Adrien realeon at hotmail.com
Wed May 26 01:51:13 PDT 2010


the app is a background fullsreen image crossfade with xml and loading  
bitmap
the glitch is, after the crossfade we see the image slightly change size

a bit of code :

/*here we both draw our bitmap to our offscreen MC and handle the  
cross fading in and out -
First we load our bitmap into our temp mc which is set to alpha 0,  
then we resize and fade our
temp mc in so that we achieve the cross fading effect. When the temp  
MC is at 100% alpha we
attach our bitmap object to our smoothed background MC and then  
quickly fade out and remove the temp MC.*/

bitlistener.onLoadInit = function(target:MovieClip):Void  {
/*clear the timer interval each time. We do this so that each new  
iteration of the timer
starts from when the bitmap is loaded, this stops us from trying to  
fade images etc that have not loaded
and ensures that each bitmap is displayed for the required amount of  
time on screen. Essentially it negates
download time*/
	clearInterval(bitmapFadeInterval);

	//create the bitmap object, each time this is reset, keeping memory  
footprint fairly low..
	var bitmap:BitmapData = new BitmapData(target._width, target._height,  
true);
	//draw the bitmap
	bitmap.draw(target);
	//we are starting to fade, so set our var to false and let the temp  
resize functions run
	fadingComplete = false;
	//resize the temp bitmap to match the size of the bg bitmap
	this.resizeTemp = function() {
		if (Stage.height/Stage.width>target._height/target._width) {
			img_propa = target._width/target._height;
			target._height = Stage.height;
			target._width = Stage.height*img_propa;
			target._y = 0;
			target._x = 0;
		} else {
			img_propa = target._height/target._width;
			target._width = Stage.width;
			target._height = Stage.width*img_propa;
			target._y = 0;
			target._x = 0;
		}
	}
	this.resizeTemp();
	//fade in the temp bitmap
	TweenLite.to(target,crossFadeTime,{_alpha:100, onComplete:fadedIn,  
onCompleteParams:[this], onUpdate:this.resizeTemp});
	function fadedIn(ref):Void {
		ref.resizeTemp
		//attach our loaded bitmap to our background mc when the temp  
totally obscures it
		//this is the smoothed bitmap
		bgHolder_mc.bg_mc.attachBitmap(bitmap,0,"auto",true);
		//make the bg resize
		fullScreenBg();//This is  abit of a hack to catch user resizes
		TweenLite.to(target,.1,{_alpha:0, onComplete:cleanUpTemp});
		function cleanUpTemp():Void {
			//remove the temp mc
			removeMovieClip(bgHolder_mc.bg_loader);
			//we are done fading..
			fadingComplete = true;
		}
		//reset the timer
		bgHolder_mc.bg_mc.attachBitmap(bitmap,0,"auto",true);
		
		//////// je creer une pause en appuyant sur le bouton video
		if(mp._currentframe == 2){
		//clearInterval(bitmapFadeInterval);
		bitmapFadeInterval = null;
		trace("pause")
		}
		else if (mp._currentframe == 1){
		bitmapFadeInterval = setInterval(_root, "loadRandomBitmap",  
imageTime);
		trace(p)
		}
		//resize the bg image
		fullScreenBg();
		//add the stage listener, which fixes an issue with the image being  
scaled out to
		//some crazy size if a user is resizing as the image loads in for  
the first time.
		if (firstRun) {
			Stage.addListener(catchStage);//stage resize listener, added here  
after first image load.
			firstRun = false;
		}
	}
};




Le 26 mai 10 à 04:17, Zeh Fernando a écrit :

> It's correct. What glitch are you seeing?
>
> On Tue, May 25, 2010 at 7:14 PM, Adrien <realeon at hotmail.com> wrote:
> Hello,
>
> I'm I doing good if I change this:
>
> import gs.TweenLite;
> TweenLite.to(target,crossFadeTime,{_alpha:100, onComplete:fadedIn,  
> onCompleteParams:[this], onUpdate:this.resizeTemp});
>
> into this:
>
> import caurina.transitions.Tweener;
> Tweener.addTween (target, {_alpha:100, time:crossFadeTime,  
> onComplete:fadedIn, onCompleteParams:[this],  
> onUpdate:this.resizeTemp});
>
> [as2]
>
> I don't know, but when I run it there seems to be like a little  
> glitch...
>
> Regards
> Adrian
> _______________________________________________
> Tweener mailing list
> Tweener at lists.caurinauebi.com
> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
>
> _______________________________________________
> Tweener mailing list
> Tweener at lists.caurinauebi.com
> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.caurinauebi.com/pipermail/tweener-caurinauebi.com/attachments/20100526/abaa4052/attachment.htm>


More information about the Tweener mailing list