• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

Continuous loop of cross-fading images

Hi,

I am looking for a simple, elegant solution to have one set of images crossfade into another set of images, then that set of images crossfade into a third, then the third set crossfades back to the first, in an endless loop.

I am not sure how to do this -- I do not want to fake it. Just so you can visualize the feel of the crossfading, here are the three sets of images:
http://www.bombftp.com/introflash.html

**Important note**: in this example, the third set fades to white. *I do not want this*. I would like each image in the the third set to crossfade back to each image in the first set, and then the loop starts again, infinitely (or until it reaches Flash MX's looping limit).

Best,
ES

0
ellaspeed
Asked:
ellaspeed
  • 9
  • 6
1 Solution
 
BillystyxCommented:
is this your fla?

it seems almost done...
are you using an array to load ythese images?
maybe you could upload the fla.
billystyx
0
 
ellaspeedAuthor Commented:
Hi Billystyx,

Yes, that is my swf: It is almost done, as a visual rough, except I want the third set to crossfade to the first set, instead of fading to white.

Programming wise, it is not done, because I would like to do it with actionscript, this is plain old timeline animation.

Actionscript wise, would like to do this for each of three images, through all three sets:
fade one image down to alpha zero while other image fades up to alpha 100, simultaneously. Then loop so that the last set fades back into the first set, and so on.

Could anyone get me started?

My idea is that I might have to have the three images stacked on top of each other, and loop through a series of instructions about their alpha values?

Best,
ES
0
 
BillystyxCommented:
yes, thats right:
here is some code, put this on frame1:

myArr = ["img1", "img2", "img3", "img4", "img5", "img6", "img7", "img8", "img9"];//these namesare the linkage identifiers
//of each image in your library
newArr = [];
xPos = 0;
for (i=0; i<myArr.length; i++) {
      dep = _root.getNextHighestDepth();
      attachMovie(myArr[i], myArr[i], dep);
      myArr[i]._y = 200;
      if (i == 0 || i == 3 || i == 6) {//only for 9 images, 3 at a time
            xPos = 0;
            _root[myArr[i]]._x = 200+xPos;
      } else {
            xPos += 100;
            _root[myArr[i]]._x = 200+xPos;
      }
      _root[myArr[i]]._alpha = 0;
      _root[myArr[i]].dir = "up";
}
j = 0;
k=0;
onEnterFrame = function () {
      if (_root[myArr[j]].dir == "up" && _root[myArr[j]]._alpha<100) {
            _root[myArr[j]]._alpha += 30;//speed of alpha
            
      } else if (_root[myArr[j]].dir == "up" && _root[myArr[j]]._alpha>=100) {
            _root[myArr[j]].dir == "down";
            newArr.push(myArr[j]);
            j++;
      }
      if(newArr.length>2 && _root[newArr[0]]._alpha>0){
            _root[newArr[0]]._alpha -=30;//speed of alpha
      }else if(newArr.length>2 &&  _root[newArr[0]]._alpha<=0){
            _root[newArr[0]].dir="up";
            newArr.splice(0,1);
      }
            if(j>8){
                  j=0;
            }
};


Billystyx

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
BillystyxCommented:
http://www.billystyx.co.uk/setups/EE/alpha fading in threes.fla

billystyx
0
 
BillystyxCommented:
0
 
ellaspeedAuthor Commented:
Hi Billy,

I have to go make dinner before I check these out, which I will do tonight. Before I do that could I ask you one question about what you did?

As you see in my example, I have the images stagger in:
First one fades up, then the second fades up, the third...
Then the fourtch crossfades with the first, the fifth crossfades with the second and so on....

Do you think this is possible with what you have done?

Be back after dinner,
ES
0
 
BillystyxCommented:
not sure I understand - I am pretty sure this is what I have done... Can you explain what you want again?
thanks:)

billystyx
0
 
ellaspeedAuthor Commented:
Hi Billy,

I could not open your file because I am on mac, sometimes there are problems with grabbing FLA's on Macs. Tried adjusting MIME type in my settings with no luck.

So, I put your actionscript on Frame 1 of the movie, and I made all of the images into movie clips and named them img1, img2, img3 as per your example. Then I stacked them, one per layer in the first frame and got no results, then the second frame, no results.

Is there some other code I need to add? Should the images not be movie clips, should I just leave them as raw PNG files? What is the next step?

(Wish I could open your FLA! Sometimes if you zip it first it opens better on Mac).

Best,
ES
0
 
ellaspeedAuthor Commented:
p.s. I made the continuous loop "timeline style":
http://www.bombftp.com/introflash.html
0
 
BillystyxCommented:
I will try uploading again in zip (I usually zip it - don't know why I ddn't:)

billystyx
0
 
BillystyxCommented:
http://www.billystyx.co.uk/setups/EE/alphav4.zip

billystyx

let me know if you cant pick it up - I have even put in your images this time - it looks good:)

billystyx
0
 
ellaspeedAuthor Commented:
Hi Billy,

I cannot get it open, this happens a lot on Mac. So I sent it to my friend on a PC, and he even saved it for MX (I have that not MX 2004) and still no love!

But, he said it works great, so I am going to hang onto your file and open it on a PC when I get the chance so I can learn how to do this on my own next time.

Thank you Billy.

Best,
ES
0
 
BillystyxCommented:
no worries - is there any zip programme mac likes better for future reference?
0
 
ellaspeedAuthor Commented:
Billy,

I think there must be, because some zips leave you with a file that is usable, others do not.

When I finish with the project the cross fade movie was for, I am going to research this matter and repost, I would like to be able to share files more easily between platforms.

Best,
ES
0
 
BillystyxCommented:
Did you want the code and an explanation again so you can incorporate it into your project now? Or won't this help?
I am pretty sure code in the final version (with your images) is the same as posted above.

billystyx
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now