How to do this animation in AS 2?

  • buherseyicin
  • Born
  • Born
  • buherseyicin
  • Posts: 2

Post 3+ Months Ago

Hello friends, can anybody do this animaion in AS 2? Its made in Timeline. how can i do it in AS2?

http://www.haf.com.tr/1/animasyon.rar

Thank alot.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

link not working
  • buherseyicin
  • Born
  • Born
  • buherseyicin
  • Posts: 2

Post 3+ Months Ago

Yes, the link is active now.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

create black squares dynamically (one prototype movie clip in the library, attach it how many times you need it (in your case 25 times). Keep the fade out for the movie clip in the library.
Next thing, randomly fade out the movie clips (only not the same twice :D), untill all of them are faded out.
that's the basic u need.
code ... maybe needs fixes, but the idea is ok. Also is not random, but to make it random is easy.
Code: [ Select ]
createEmptyMovieClip("mcSquares", 100);
var mcCurrentSquare;
var xSquare = 0;
for (i=0; i<25; i++)
{
  mcCurrentSquare = mcSquares.attachMovie("blackSquare", ""blackSquare"+i, i);
  mcCurrentSquare._x = x;
  mcCurrentSquare._x = y;
  x+= 50; xCount ++;
  if (xCount >= 5)
  {
    x = 0;
    y += 50;
    xCount = 0;
  }
}

var nCount = 0;
var endAnimation = false;
var iSquare = 0;
var squareRolledOut = false;
var squareRolledOver = false;
onEnterFrame = function()
{
 nCount ++;
 if (nCount > 10)
 {
 // next, on rollOver that little square
  if (squareRolledOver)
  {
    mcCurrentSquare = mcSquares["blackSquare"+iSquare];
    mcCurrentSquare.gotoAndPlay(2); // wherever starts the fade out
    iSquare++;
    if (iSquare >= 25)
    {
      iSquare = 0;
      endAnimation = true;
      squareRolledOver = false;
    }
  }

  if (squareRolledOut)
  {
    mcCurrentSquare = mcSquares["blackSquare"+iSquare];
    mcCurrentSquare.gotoAndPlay(12); // wherever starts the fade in
    iSquare++;
    if (iSquare >= 25)
    {
      iSquare = 0;
      endAnimation = true;
      squareRolledOut = false;
    }
  }
  nCount = 0;
}
}

square.onRollOver = function()
{
  if (endAnimation)
  {
    squareRolledOver = true;
   endAnimation = false;
  }
}

square.onRollOut = function()
{
  if (endAnimation)
  {
  squareRolledOut = true;
   endAnimation = false;
  }
}

stop();
  1. createEmptyMovieClip("mcSquares", 100);
  2. var mcCurrentSquare;
  3. var xSquare = 0;
  4. for (i=0; i<25; i++)
  5. {
  6.   mcCurrentSquare = mcSquares.attachMovie("blackSquare", ""blackSquare"+i, i);
  7.   mcCurrentSquare._x = x;
  8.   mcCurrentSquare._x = y;
  9.   x+= 50; xCount ++;
  10.   if (xCount >= 5)
  11.   {
  12.     x = 0;
  13.     y += 50;
  14.     xCount = 0;
  15.   }
  16. }
  17. var nCount = 0;
  18. var endAnimation = false;
  19. var iSquare = 0;
  20. var squareRolledOut = false;
  21. var squareRolledOver = false;
  22. onEnterFrame = function()
  23. {
  24.  nCount ++;
  25.  if (nCount > 10)
  26.  {
  27.  // next, on rollOver that little square
  28.   if (squareRolledOver)
  29.   {
  30.     mcCurrentSquare = mcSquares["blackSquare"+iSquare];
  31.     mcCurrentSquare.gotoAndPlay(2); // wherever starts the fade out
  32.     iSquare++;
  33.     if (iSquare >= 25)
  34.     {
  35.       iSquare = 0;
  36.       endAnimation = true;
  37.       squareRolledOver = false;
  38.     }
  39.   }
  40.   if (squareRolledOut)
  41.   {
  42.     mcCurrentSquare = mcSquares["blackSquare"+iSquare];
  43.     mcCurrentSquare.gotoAndPlay(12); // wherever starts the fade in
  44.     iSquare++;
  45.     if (iSquare >= 25)
  46.     {
  47.       iSquare = 0;
  48.       endAnimation = true;
  49.       squareRolledOut = false;
  50.     }
  51.   }
  52.   nCount = 0;
  53. }
  54. }
  55. square.onRollOver = function()
  56. {
  57.   if (endAnimation)
  58.   {
  59.     squareRolledOver = true;
  60.    endAnimation = false;
  61.   }
  62. }
  63. square.onRollOut = function()
  64. {
  65.   if (endAnimation)
  66.   {
  67.   squareRolledOut = true;
  68.    endAnimation = false;
  69.   }
  70. }
  71. stop();


you could also use setInterval of a random number for each movieclip and so you get rid of the onEnterFrame.
something like, onRollOver ->
arrIntervals[movieID] = setInterval(startFade, random(2000), movieID), and
function startFade(movieID) {
mcSquares["blackSquare"+movieID].gotoAndPlay(2);
clearInterval(arrIntervals[movieID]);
}

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 14 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.