Flash

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized Forums2D GraphicsFlash

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old June 6th, 2011, 04:12 PM
mona-5 mona-5 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 1 mona-5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 57 sec
Reputation Power: 0
Counter animation

Hi,

Can anyone help me with editing a counter animation? I know only the Flash basics and not so mutch about action Script.


The counter counts only once and stops at 12345. What do I have to change if I want the counter to run a second and a third time after 5 second? The numbers for the second run must stop at 88888 and for the third time at 99999. Numbers are only examples.
By the way the counter is a MovieClip. Copingying the MC doesn't work.


I hope anyone can help!

Here is the complete script wich runs the counter:



// Load Animation functions
#include "mc_tween2.as"

number = (_root.num!=undefined) ? _root.num.toString() : '12345';

function runCounter(o,myNum) {
// SPEEDS - milliseconds: higher number = slower
rollSpeed = 30; // speed of number rolls - default = 30
stopInterval = 300; // time between stopping numbers - default = 300
initialPause = 500; // pause before stopping numbers - default = 500

myNum = substring(myNum,0,7); // restrict to 7 characters

// pad out number with zeros if less than 7
while (length(myNum)<7) {
myNum = "0"+myNum;
}

len = length(myNum);

for (i=0; i<=7; i++) {
n = (i<parseInt(len)) ? myNum.charAt((parseInt(len) - 1) - parseInt(i)) : 0;
if(o["d"+(i+1)]) {
_root.runSequence(o["d"+(i+1)].digit,i,n);
}
setTimeout(_root.setNumer,(((parseInt(len) - 1) - parseInt(i))*_root.stopInterval)+_root.initialPaus e,o["d"+(i+1)].digit,n);
}
}

function setNumer(o,n) {
o.stop = true;
clearInterval(o.timer);
if(o.timer) { clearInterval(o.timer); } // backup in case the above fails
o.timer = null;
o.txt.text = n;
o.yBlurTo(0,2);
}

function inc(o,n) {
if(o.stop) {
// backup stop command in case of failure
clearInterval(o.timer);
o.timer = null;
o.txt.text = n;
o.yBlurTo(0,2);
} else {
if(o.timer==undefined) {
o.timer = setInterval(inc,_root.rollSpeed,o);
o.yBlurTo(15,2);
}
o.txt.text = (parseInt(o.txt.text)<9) ? parseInt(o.txt.text)+1 : 0;
}
}

function runSequence(o,delay) {
o.stop = false;
o.timer1 = setTimeout(inc,_root.rollSpeed+(delay*_root.rollSp eed),o,n);
}

runCounter(counter,number);

Reply With Quote
Reply

Viewing: Tutorialized Forums2D GraphicsFlash > Counter animation


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap