Fade Image script flickers after 11th image

  • cranky
  • Born
  • Born
  • cranky
  • Posts: 2

Post 3+ Months Ago

I have found (thanks IceCold) and modified this actionscript to suit my needs, which is just fading 14 images (clips) in and out and repeating.
All works fine until mcImage11 rolls around, then it flickers quickly the next 3 (mcImage11, mcImage12 & mcImage13) rather than fades. Once it loops around to mcImage0 again it's all fine until mcImage11 is reached again.
If I remove the last 3 clips it works fine. Is there a limit to the number of items this will work with? I have tried all mc's piled on each other on one layer with Alpha set @ 0, and also splitting them over 2 layers but made no difference.
My 14 mc's are named mcImage0 - mcImage13 and contain a static jpeg each.

I'm a script beginner so if it's real obvious be easy on me...
Using MX2004 Professional.

Running notes:
Have found that if I set 'var maxImgCount = 11;' the 11 images fade OK but if I set to 'var maxImgCount = 12;' or higher the last few mc's flicker.


Code: [ Select ]
import mx.transitions.Tween;
import mx.transitions.easing.*;

function GetNextID(crtID, maxCount)
{
crtID++;
if (crtID >= maxCount)
{
     crtID = 0;
}
return crtID;
}

function SetFade()
{
mcFadeOutImg = this["mcImage"+crtImgID];
crtImgID = GetNextID(crtImgID, maxImgCount);
mcFadeInImg = this["mcImage"+crtImgID];
trace(mcFadeOutImg+":in:"+mcFadeInImg);
tFadeOut = new Tween(mcFadeOutImg, "_alpha", None.easeOut, 100 , 0, 15);
tFadeIn = new Tween(mcFadeInImg, "_alpha", None.easeOut, 0 , 100, 15);
tFadeIn.stop();

}
var tFadeOut:Tween;
var tFadeIn:Tween;
var crtImgID = 0;
var maxImgCount = 14;
var bFadeIn = false;
SetFade();

onEnterFrame = function()
{
if (tFadeOut.position < 60 && !bFadeIn)
{
     tFadeIn.start();
     bFadeIn = true;
}
if (tFadeIn.position == 100)
{
     delete tFadeOut;
     delete tFadeIn;
     bFadeIn = false;
     SetFade();
}
}
stop();
  1. import mx.transitions.Tween;
  2. import mx.transitions.easing.*;
  3. function GetNextID(crtID, maxCount)
  4. {
  5. crtID++;
  6. if (crtID >= maxCount)
  7. {
  8.      crtID = 0;
  9. }
  10. return crtID;
  11. }
  12. function SetFade()
  13. {
  14. mcFadeOutImg = this["mcImage"+crtImgID];
  15. crtImgID = GetNextID(crtImgID, maxImgCount);
  16. mcFadeInImg = this["mcImage"+crtImgID];
  17. trace(mcFadeOutImg+":in:"+mcFadeInImg);
  18. tFadeOut = new Tween(mcFadeOutImg, "_alpha", None.easeOut, 100 , 0, 15);
  19. tFadeIn = new Tween(mcFadeInImg, "_alpha", None.easeOut, 0 , 100, 15);
  20. tFadeIn.stop();
  21. }
  22. var tFadeOut:Tween;
  23. var tFadeIn:Tween;
  24. var crtImgID = 0;
  25. var maxImgCount = 14;
  26. var bFadeIn = false;
  27. SetFade();
  28. onEnterFrame = function()
  29. {
  30. if (tFadeOut.position < 60 && !bFadeIn)
  31. {
  32.      tFadeIn.start();
  33.      bFadeIn = true;
  34. }
  35. if (tFadeIn.position == 100)
  36. {
  37.      delete tFadeOut;
  38.      delete tFadeIn;
  39.      bFadeIn = false;
  40.      SetFade();
  41. }
  42. }
  43. stop();
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.