Cant find flash answer
- Started
- Last post
- 5 Responses
- redant
The following code runs a slideshow of 4 images:
var myTimelineImages:TimelineMax = new TimelineMax();
var clips:Array = [PM, Graphic, Animation, Modules];
for (var i:int = 0; i < clips.length; i++) {
myTimelineImages.insert( TweenLite.to(clips[i], 2, {alpha:1}), i * 6);
myTimelineImages.insert( TweenLite.to(clips[i], 2, {alpha:0}), i * 6 + 6);
}From this is there any way i can know what image is current and then fade it out?
Once a button is pushed by the user i need to fade out whatever image is showing and fade a new one in.
Any hint please. I have tried asking other boards no answer.
- PonyBoy0
I'm curious if you could use the 'onComplete' and 'onCompleteParams' parameters w/Timelinemax (it's greensock... so I'm thinking yes)... use that function and set a variable after each image completes the fade?
myTimelineImages.insert( TweenLite.to(clips[i], 2, {alpha:0}), i * 6 + 6, onComplete:setCurrentImgVar, onCompleteParams: [ i ] );
function setCurrentImgVar ( ) {
currentImage = i ;
}... something like that - you'll have to verify the parameter names (onComplete, onCompleteParams)...
- function setCurrentImgVar ( i ) {
currentImage = i ;
}...forgot the parameter in the function :)PonyBoy
- function setCurrentImgVar ( i ) {
- PonyBoy0
^^don't copy and paste that script either... I'm sure i'm missing a thing or two there - I didn't verify it... but the 'idea' is there. :)
- redant0
ok ill try these thanks.
- redant0
Ponyboy I used that code and looks like it is working thanks. I didn't try the other I'm afraid of loops. Fugh alot to learn.