Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Frame Counter



is there an action script that dynamically puts the number of the frame into a text field?

really appreciate it if anybody knows this...

many thanks
andy



FlashKit > Flash Help > Flash General Help
Posted on: 10-30-2006, 06:58 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Frame Counter
I want to display the frame number in text form in my movie....and ideas........

thanks in advance

[F8] Frame Counter?
Flash 8 - File attached

I have a frame counter working great in one scene, but when I change
to scene 2 the frame counter adds 100 frames to the overall number. Not
sure how to get the frame counter to only count the actual frame it's on
regardless of scene number.

STUMPED!

Thanks for any help,

--S.

Frame Counter
how do you make a frame counter?!

Frame Rate Counter?
how do I programme one? (im using flash 5 btw)

Using Variable As Counter To Go To A Particular Frame
Hi guys,
Basically in my movie the frames keep going back to frame 1 - which is intentional. However after a certain amount of time I want it to jump to a certain frame - not sure how to control this.
Is it possible to have a separate timer running on frame 1?

What I thought of doing was adding a variable to frame one and when any actions occur they add to this variable. So when variable = 10 the movie jumps to a certain frame. And then comes back - when it reaches 20 it jumps to another frame etc etc. Is this possible?

Any ideas - I've tried this on the first frame:
var firstname = "timer";
timer = 0;

Then this on a button:

on (release)
{
(timer == timer+1);
if (timer == 5) {gotoandstop(10)};

}

Doesn't work though. Basically the idea is hit the button 5 times and yuo jump to frame 10.

How To Set Up A Frame Counter In A Text Box?
I'm trying to do something simple, but because I don't understand the basics, I'm having trouble.

I want to display the current frame number in a text box as the frames progress. I put this in a layer that spans the entire "movie". By the way, is the SWF called a "movie" or something else?

myTextField.text = _currentframe;

Seems simple enough, but it only displays "1" for the entire movie.

So I'm not sure how Flash cycles through code. I assumed that it ran the code each time a frame was loaded, but apparently not. Do I need to loop this:

myTextField.text = _currentframe;

??

or am I not putting the code in properly?

Dumb question, I know.

ULTIMATELY, this will be a "counter" that displays the time on a clock in a timeline that I'm animating. I thought I could use the _currentframe function to calculate the time as the movie progresses. If anyone has a better idea on how to do that, please let me know.

Thanks!

Incrementing A Counter On Each Frame
Hi there,

I'm new to flash and am using it to produce a short animation of a interface I'm designing for university.

Could anyone tell me how I would go about having a dynamic text field that would contain a counter that incremented by (whatever I wanted) on each frame?

eg. say I have a "distance travelled" dynamic text box and wanted to show a speeded up demo of the device, I'd like to have that counter count upwards from 0 incrementing itself by 5 on each frame.

Is this possible?

Thanks in advance

S

Creating Frame Counter
Hello, ppl!
pardon the newbie question, but how can I create a counter using actionscript? the scene is 30 frames long and it's sopposed to get a new value with every frame. something like counter++; example: 70% should turn 71%, 72%.... 100%

I tried it, using the while loop like this in first frame:

while (counter < 100)
{
counter++;
}

but it only shows 100% all the time...
any ideas?
thanks in advance.

Timecode-like Frame Counter
Hey all, trying to figure out how to get a way to count frames and display the result in a text clip.

TIA

Creating Frame Counter
Hello, ppl!
pardon the newbie question, but how can I create a counter using actionscript? the scene is 30 frames long and it's sopposed to get a new value with every frame. something like counter++; example: 70% should turn 71%, 72%.... 100%

I tried it, using the while loop like this in first frame:

while (counter < 100)
{
counter++;
}

but it only shows 100% all the time...
any ideas?
thanks in advance.

How Can I Increment A Counter By X On Each Frame
Hi there,

I'm new to flash and am using it to produce a short animation of a interface I'm designing for university.

Could anyone tell me how I would go about having a dynamic text field that would contain a counter that incremented by (whatever I wanted) on each frame?

eg. say I have a "distance travelled" dynamic text box and wanted to show a speeded up demo of the device, I'd like to have that counter count upwards from 0 incrementing itself by 5 on each frame.

Is this possible?

Thanks in advance

S

How To Add Visible Frame Counter To Animation?
I am trying to create a invisible rollover button in my flash animation that displays the current frame so when my client and I are discussing the animation we can determine which frame to make changes on.

When I set a variable to _currentframe, it stores only the frame on which the action occurs, which makes sense. Is there any simple (and low-bandwidth) way to have that repeat so a variable is constantly loaded with the frame number of the main timeline? Or is there some other way of doing it?

Any input on this would much appreciated.

Thanks!

Actual Frame Rate Counter
Here's the thing:

On a lark I tried to put a framecounter in my flash to see if there was any slowdown. Here's the code:

onClipEvent (load) {
n = 0;
offset = getTimer();
}
onClipEvent (enterFrame) {
n = n+1;
time = getTimer();
this.fpstext = 1/((time-offset)/1000);
this.textfield1 = (time)/1000;
this.textfield2 = n;
offset = time;
}

For some reason, in my 30fps Flash movie, I only get 20 fps. I tried putting into a new blank flash, and I got 10 instead of 12. What gives?

-B

How Do I Make A Frame Rate Counter?
Can anybody advise me how to make a mc that is self-contained (i.e. that can be dropped into any movie being authored) that will trace the frames per second.

The use will be so that I can see if the movie is playing at the correct fps or if its dropping frames...

thx in advance.

Action Script That Gives Me Frame Rate Counter.
I am trying to write action script that gives me frame rate counter.

*This is what I wrote on the button that will reset
it.
onClipEvent (load)
{
offset = 0;
fcount = 1;
}

*Then I created dymnaic text and wrote in var box frate.

*I made movie clip and attached this script
onClipEvent (load)
{
offset = 0;
fcount = 1;
}

onClipEvent(enterFrame)
{
curtime = (getTimer() - offset) / 1000;
frate = Math.ceil(fcount / curtime);
fcount++;
}
*I am not getting anthing into my text box. Do I need an instance name? What should I change or how do I do it.

Create A Time Counter In One Single Frame
hi,

i need to know if somenone can tell me how can i create a time counter just with action scrpting, whithout any others frames or movieClips in the stage.

i want to create a slide show, that i'll get the imgs dynamicaly, and then i make a slideshow with them just by creating a loop that defines something like this..

(get the time when the photo apears)

(the loop starts counting 5 seconds for exemple)

(and then show next image and get the new time that it apears again)..

...and so on until the last image from the array.. then it starts again loading the first image...

THE PROBLEM is that i need this just by scripting...

can you help me please???

Using The Timer Class In AS 3.0 To Emulate Frame Counter
Hello Flash Forum (Action Script 3.0)

I am trying to teach my self AS 3.0 - very slow I might add! I would like to bring in to the stage, 3 movie clips, one after the other, each with a fade (fade in).

I have the clips, and I can add children, and I can set a fadeIn function that will fade in a movie clip. I can even use this code below to get the tween defined and working. textMC represents each movie clip

var fadeIn: Tween;
function addClip(textMC:MovieClip):void
{
fadeIn = new Tween(textMC,"alpha",None.easeIn,0,1,2.5,true);
fadeIn.addEventListener(TweenEvent.MOTION_FINISH, shMsg);
// i remove the listener before loading clip 2, and then 3
}

I have three movie clips using a "class name" for linking; I define them as such:

the "class" of the mc is the name in the linkage props. (i.e. "editDocument)
var text1_mc:MovieClip = new editDocument();
var text2_mc:MovieClip = new editReserve();
var text3_mc:MovieClip = new useVersions();

I am not sure whether I am defining my clips correctly - but it seems to work.

My desire is to load the first text_mc, then when the tween is done, load the second, and then the third.
But... the timing is what I want to handle. I would like text1 to appear at around 4 sec (aka 48 frames at 12fps), and
text2 at about 5 to 6 sec, and then frame 3 at about 8 secs. I have tried turning the timer off and on, etc, but have not quite figured out how to do this correctly. Any tips???

I do not want the preceeding text_mc to "flash" at each timer interval, etc. the sequence is:

wait for about 3 or 4 secs (audio running), load and fade in first clip, tween finish, load second clip at about 6 secs, fade in, and finally the last clip. Stop timer, and display three clips - all visible (lines of text).

Any hints on how to do this right?

thanks,

eholz1

Counter Showing Countdown When Movie Enters Frame
heres the code Ive wtitten I know its ugly and it doesnt work any ideas I have to get this finished fast


onClipEvent (enterFrame) {
mySecs = 15;
min2 = _root.StartTime-_root.tNow/1000;
trace("StartTime="+_root.StartTime);
trace("min2="+min2);
curT = new Number();
curT = getTimer();
trace("curT="+curT);
curT2 = curT/1000;
trace("curT2="+curT2);
if (curT/1000<=_root.tNow/1000) {
mySecs = 15;
mySecs = mySecs+Math.floor(min2-curT2/1000+_root.tNow/1000-curT/1000);
trace("mySecs="+mySecs);
trace("min2="+min2);
race("curT="+curT);
trace("curT2="+curT2);
displaySecs = mySecs-_root.TimeNow;
_root.secs = displaySecs.toString();
} else {
_root.gotoAndStop("calc");
}
}

Ignoring Decimal Points On A Video Frame Counter
Hope you can help I have have imported a swf video clip into a swf and have done a frame counter displaying the number of seconds elapsed.

The video is 12fps so I have done a "currentframe/12" Can anyone tell me how to ignore the decimal points that appear?

Reset Counter - NOT HIT COUNTER
Hi all, I have a counter going to repeat some frames, and then when it reaches the number of times I want it to repeat, I have it go to another frame to play a different movie clip...then at the end of the new movie clip, I want it to start over "fresh"...

Does anyone know the coding for reseting the counter?

Here is my current code:

counter = counter+1;
if (counter == 4) {
play();
} else {
gotoAndPlay("ad");
}


Thanks,

Wendy
Wendy@pixelchix.com

Previous Frame Overlay..... Frame By Frame By Frame By Frame By Frame By.....
Hello there.

I am trying to create a small animation just as a little bit of fun. I would like to do it frame by frame.

I have a simple question to ask about frame by frame animation.

When drawing frame by frame, you would usually have a transparent overlay that you can compare with the next frame. Is there a way to do this in flash without having to copy the previous keyframe into a new keyframe on a new layer?

Thanks Emdiesse

Trying To Make Movie Play Frame X To Frame Y Then Switch To Frame Z..
Hello,

I was hoping someone could help me out with an issue I'm having. I have my flash on multiple scenes, and would like to play an animation when clicking on the navigation button before switching to a different scene.

I'm halfway to accomplishing this.

Here is what i used


Code:
_root.gotoAndPlay("changepage1");
_root.onEnterFrame=function(){
if(this._currentframe=="changepage2"){
gotoAndPlay("Home2",1);
}

}
The above code is on a blank keyframe. Changepage1 is the start of the animation and Changepage2 is the end of the animation.

Upon clicking the navigation button it plays the above scenes.

However it doesn't change scenes to scene "Home2".

Thank you in advance for all your replies.

GotoAndPlay(frame) Messing Up If Frame Is The Current Frame
I have a bug with my buttons and I am trying to figure out how to fix them. I have about 5 different buttons that will take me to different places on my website (http://www.usu.edu/drc)(don't judge me on design, I am not the greatest web designer)

Anyway, if I click on the students button it will load the students swf and take me to that frame in my mc. If I am already in the students frame, it loads the next frame in my mc instead doing nothing, which is what I want it to do. Anybody know why this is?

Now to fix the problem. I am fairly new to AS and was hardcoding my frames, but as I add frames and move things around, I have to go in and change the frame numbers, hello frame labels. Well, I now have the different frames labeled but I need to check if _currentFrame is equal to my frame label. I don't know how to do this.

What I was thinking is something like this:

if(_currentFrame.name == "students"){ don't do anything }

I don't know if this would work or if this is even the right syntax. Anybody have an idea on this one? Thanks for the help.

Jason

Hit Counter
can we create hit counter in flash 5
if yes what will be the coding.
thanks for anyhelp

Counter
How can i make a script which counts down to minutes, when its over, somethings happens????? Help

Counter For _x
Any ideas pls for such thing:

In a panoramic view by Henrik Dahm
http://www.flashkit.com/movies/Effec...60/index.shtml

i added a dynamic text field that checks X coordinates -
meters = xposition;
(rounded)
here:
http://www11.brinkster.com/samsonart/zabor.asp

how can i make it width relative so it returns a number between 0 and 128 starting from left side (e.g. when movie loads it is a middle so should show 64) - without minuses and so it starts again after reaching the end?

Thanks for all who can think of this mathematics

Counter
Does anyone know of a script that I can use that would act like a counter? I may need it to be able to speed up or slow down, also.

At this point I guess it will act almost like a timer. So when it starts it will begin at 0 and then count 1 number at a time until it is stopped.

Thanks

Counter
Is there anyway to make a counter in flash? I don't want to get one of those commercial or free counters that are html script. What would be the script for a counter in flash? What I mean by "counter" is simply the showing of the number of people that visit my site.

Counter
I'm trying to set a variable to act as a counter to record how many times I've dragged and dropped an item.
I'm using the if, else if and else commands, they all seem to work except the counter. What am I doing wrong?

I have set a variable in the first frame.
counter = "0"; (no expression set)

Then, on the button executing the action is:-

on (press) {
_root.app1.startDrag(true);
}
on (release) {
stopDrag ();
if (counter <2 && getProperty("/app1", _droptarget) == "/chip2") {
tellTarget ("_root.upload1") {
gotoAndPlay (2);
counter = "counter +1";
}
} else if (counter >=2) {
tellTarget ("_root.error") {
gotoAndPlay (2);
}
} else {
setProperty ("_root.app1", _x, "200");
setProperty ("_root.app1", _x, "250");
tellTarget ("_root.error") {
gotoAndPlay (2);
}
}
}
What I'm trying to do is drag an item called 'app1' onto a area called 'chip2'. Each time this happens the counter adds 1 and a upload message is called. If the area is not hit then it returns to it's original position and an error message is callled. When there are more than 2 apps on the chip1 then it's rejected and a error message is called. There will be the same code on an item called app2, app3 etc. The above code is only for app1.
Everything works, except I can have as many app1, app2 etc on the chip2 and I never get my error message. It seems to be ignoring the counter!

What am I doing wrong, Please advise.
Any help would be appreciated.....

[Edited by louisehall@4mostinfo.com on 09-03-2001 at 07:02 AM]

Hit Counter?
Can anyone tell me if you can have a hit counter in flash5.
I so, can I download it from somewhere?, thankyou in advance

Counter
Hi,

I've got a counter that counts backwards for every item that has been seen. I use this code in frame one of the main timeline:

counter=7;
if (counter==0){
loadMovieNum ("exit.swf", 0);
}

The counter works, it goes down to 0 but then the exit.swf doesn't load. What I'm I doing wrong?

Thank in advance for your help.
Danielle.

Hit Counter?
Hi

I was wondering if someone could tell me how to do the most basic of hit counters?

Thanks

Hit Counter
how would i make a hit counter. Would i use a varable? Please Help me on this

Hit Counter
Can someone please help me. I need a Flash hit counter to put on my site. Ive tried the ones that are on this site but i dont like them. Is there anyone out there that can point me to a hot flash hit counter.

Thanks so much

PHP Counter
I am trying to get the tutorial for a php counter to work correctly (it is also on http://www.flash-db.com). It keeps increasing the count every 10-20 seconds. I have eliminated the loop, but it still does it.
My movie begins at frame 5 (it loads to 5 from the preloader). So basically I can sit and watch it count up gradually.

Frame 5:
loadVariablesNum ("PHPCounter.php?ran="+random(9999), 0);
Frame 6:
loadVariablesNum ("PHPCounter.txt?ran="+random(9999), 0);

Thanks.

Counter Help
any body know the easiest way to put an accurate hit counter into my flash intro??

i want one that is accurate, small and dosnt rely on a third party just me and my server .

I tried the flash kit tutorial and it dont work!! It is too vague and sketchy and leaves too much to common sense which is something that i dont posess!

cheers tony

Php - Counter
I am currently using php and a text file to run a counter on my main timeline, however, I want to put the counter in a movie clip so it is independent of the main timeline, but when I use the same keyframes and php code it doesn't work. I know clips reside in different levels so do I need to add some code somewhere?

Counter
I need some help creating a counter. I have multiple draggable movie clips that can be released into a target area. I want to create a counter, so that when the value of the MCs equal a certain number no other MC can be dragged into the area and dropped. Problem is, I don't have a clue as how to start building the counter. Can anyone help?

Counter
Hopefully I can explain this so you get the idea.

I have created a drag-n-drop application in which there are multiple target areas for multiple MCs. Each MC has a different number of instances on a given scene. Each MC will have a different value, ex. there are 6 different drawers. One is 3 inches, one is 6" and so on up to 15".

The different target areas (which are MCs) also have different sizes, one is 24" another is 36", up to 60". What I am wanting to do, is create some sort of a counter for each target areas. I want it to count the different values of the MCs (or instances of MCs) that are dropped within the target area and when it reaches a value like 24" it will not allow anything else to be dropped into the target area.

So if 8 instances of the 3 inch drawer were dropped onto target area 1, it would add them up and equal 24. It would then not allow anything else to be dropped onto the target area.

Can anyone help me get started?

PHP Counter
Another issue I have, is that I tried to incorporate a PHP Counter.
On the first frame of my main movie i have this action:

loadMovie ("PHPCounter.swf", "_root.container2");

The PHPCounter.swf has the following actions:

First frame:
loadVariablesNum ("/cgi-bin/PHPCounter.php?ran="+random(999), 0);
Second Frame:
loadVariablesNum ("/cgi-bin/PHPCounter.txt?ran="+random(999), 0);

It is not working and I don't know why.

Oops, here are the scripts:

PHPCounter.php:
#!/usr/local/bin/php

<?

$filename = "PHPCounter.txt";

$fp = fopen( $filename,"r");
$Old = fread($fp, 100);
fclose( $fp );

$Old = split ("=", $Old, 5);

$NewCount = $Old[1] + '1';

$New = "Count=$NewCount";

$fp = fopen( $filename,"w+");
if (flock($fp, 2)) {
fwrite($fp, $New, 100); }
fclose( $fp );

print "Count=$NewCount";

?>

PHPCounter.txt:
Count=1

I have no clue why it is not working.

Can someone help?

Thanks

HELP I NEED A COUNTER
PLEASE HELP ME ANYONE!!!!!!

How do i make a counter????
I have made 3 dynamic texts;

1 = Minutes
2 = Seconds
3 = Miliseconds

I need to make them count for 00:00:00 to 38 minutes.

You might not understand what i am saying but please have a go!

Counter
hello
i have a dynamic text box and two buttons,when i click start button the text box should display numbers from 0 to 100 and if i click the stop button the numbers should not change,and there should be some gap between two numbers so that the number change is visible.

pls help me how to do this

bye
geethanandh

Counter
hello
i have a dynamic text box and two buttons,when i click start button the text box should display numbers from 0 to 100 and if i click the stop button the numbers should not change,and there should be some gap between two numbers so that the number change is visible.

pls help me how to do this

bye
geethanandh

HP Counter
I'm making a game where you smack my network administrator around witha few tools/weapons. The only thing is, he just stands there and takes it. Is there any way I can get him to have a HP meter/counter and show the wear and tear being inflicted on him?

Counter
Is it possible to make a visitor counter in flash, but visitor won't see it, just the webmaster (me) ?

Counter
Hi, I've been trying to install a flash counter and ran into a few problems.
First off my ftp-server (for the site) didn't allow chmodding so I decided to upload just the php to another account I had somewhere that does allow chmodding.
Now I could actually live test it on my pc since both the php and the text that got created needed to be loaded in from an http://... anyway. And it worked just fine, no problems, so I uploaded it and it doesn't work anymore, any idea what might cause this? If it worked fine on my pc, why doesn't it work online?

Anyway here's the counter I used, fine job to the autor btw
http://www.flashkit.com/tutorials/Dy...56/index.shtml

This is the site (it's pretty newbish, but I don't aim high)
http://www.3dactionplanet.com/seriou...hole/site.html

and here's the php and text that should be read by the flash file
http://antichrist.multimania.com/PHPCounter.php
http://antichrist.multimania.com/PHPCounter.txt

Thx for any help I get!

Counter
How do i import a counter on to my flash page?

Counter
I am a newbie in the flash environment. Nevertheless what I am trying to do is create a dynamic text field (or what have you) that counts seconds sequentially either going up or down. I know how to do this in DHTML however is any of you can lend me a hand I would greatly appreciate it!

Help With A Counter
I have built a jigsaw puzzle. Using a variable called count, I keep track of the number of pieces that have been locked into place.
I can't get the movie to go to another scene when all pieces are complete.

What I have is approximately...

onClipEvent (load) {
count = 0;
}

onClipEvent (mouseUp){
...
count++;
}

if(count=24){
gotoAndPlay("win",1);
}
}

Any help, if I have made any sense, would be appreciated!
Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved