Jump to content
Search Community

Fading in an Image on request...

nickybrownell test
Moderator Tag

Recommended Posts

Hi,

 

New to this site, Tweenlite, and Flash in general! SO any help would be greatly appreciated...

 

anyway, I've managed to make the smaller flash selector fetch the image when the correct button is press, however, as it's loading them it just appears... and when you then choice a different button (to load a different image) this also just quickly appears... with a quick flash of white before it does.

 

I was hoping that there was something in Tweenlite that I could use which would fade the images in when the corresponding buttons are click?

 

It's probably easy and I've got close at one point but thought I'd seek some more advised help before wasting yet more time... the actionscript so far is as follows...

 

var myLoader:Loader = new Loader();
 
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.display.DisplayObject;
 
import com.greensock.TweenLite;
import com.greensock.easing.*;
 
import com.greensock.plugins.*;
TweenPlugin.activate([AutoAlphaPlugin]);
 
Cap5.addEventListener(MouseEvent.CLICK, CapLoad1);
Cap2.addEventListener(MouseEvent.CLICK, CapLoad2);  
Cap05.addEventListener(MouseEvent.CLICK, CapLoad3);
 
function CapLoad1(MouseEvent):void {
var myRequest:URLRequest=new URLRequest("Cappuccino 5.jpg");
myLoader.load(myRequest); 
addChild(myLoader); 
setChildIndex(myLoader, 0);
 
}
 
function CapLoad2(MouseEvent):void {
var myRequest:URLRequest=new URLRequest("Cappuccino 2.jpg");
myLoader.load(myRequest); 
addChild(myLoader);  
setChildIndex(myLoader, 0);  
}
 
function CapLoad3(MouseEvent):void {
var myRequest:URLRequest=new URLRequest("Cappuccino 0.5.jpg");
myLoader.load(myRequest); 
addChild(myLoader);  
setChildIndex(myLoader, 0);
}
 
so I'd like to be able to load these images but have them fade in... just a nicer way of doing it.
 
Again, any pointers would be great...
 
Nicky (the n00b)
Link to comment
Share on other sites

Using an AS3 Loader, you would need to listen for an Event.COMPLETE and then call a function that fades in your image from alpha:0.

Here are 2 great tutorials that explain how AS3 loaders work

 

http://www.republicofcode.com/tutorials/flash/as3loader/

http://www.flashandmath.com/howtos/imgload/

 

At GreenSock we have our own suite of loading tools in LoaderMax.

Here is a tutorial that will explain everything you need to know

 

http://www.snorkl.tv/2011/08/loading-images-with-loadermax-load-and-track-the-progress-of-multiple-images/

 

Be sure to watch both videos

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...