all groups > flash actionscript > may 2005 >
You're in the

flash actionscript

group:

Fade In with ActionScript


Fade In with ActionScript Jules
5/16/2005 12:20:44 PM
flash actionscript:
I know there are a lot of threads out there related to this topic, but
I was hoping someone could help me figure out what is wrong with my
code. I'm working on a little flash piece for a site. What I want is
for pictures to be pulled dynamically from an images folder and fade in
one at a time (first picture disappears, next image fades in, etc...).
Everything seems to work except that everything appears at once. I
know that I don't have any code in there to have the pictures
disappear, but they don't even fade in one at a time. instead, all the
pictures show up at once (hopefully this is making some sense...)

Here is my code:

var tiltRight:Boolean = true; //controls whether the image tilts right
or left
var picNum:Number = 0; //image1 - 5 that is beind displayed
var picVar:String = "";
var regPoint:Object; //registration point the image is loaded to
var rotation:Number = 0; //degree of rotation on the image

//determines if the image rotates right or left and which of two
registration
//points it loads to

function setVars(){
for(picNum = 1; picNum < 6; picNum++){
if(tiltRight == true){
regPoint = mc_reg1;
rotation = 10;
}else{
regPoint = mc_reg2;
rotation = -10;
}
loadPics(regPoint, rotation)
}

}

//loads the image to the registration point

function loadPics(regPoint:Object, rotation:Number) {
picVar = "/images/" + picNum + ".jpg";
trace(picVar);
trace(regPoint);
loadMovie(picVar, regPoint);
_root.regPoint._xscale = 30;
_root.regPoint._yscale = 26;
_root.regPoint._rotation = rotation;
_root.regPoint._alpha = 0;
fadeIn(regPoint);
//unloadMovie(regPoint);
if(tiltRight == true){
tiltRight = false;
}else{
tiltRight = true;
}
}

//fades the image in

function fadeIn(regPoint:Object){
for(i=0;i<100;i=i+10){
_root.regPoint._alpha = i;
}
}

setVars();
stop();

Thanks for taking a look!
Jules
Re: Fade In with ActionScript Jules
5/16/2005 12:56:44 PM
Okay, I figured out some of what i was doing wrong... I've got the
images displaying one at a time now, I just can't get the fade to work.
AddThis Social Bookmark Button