display current frame number [AS3]
I feel like such an idiot but after trying endlessly I still haven't managed to come up with a way to display the current frame number of nested movie clip ("ecke1") (in a dynamically created text field).
The problem really is that I don't know how to have flash keep updating the variable.
Here's my latest attempt:
Code:
var frame:int = 0;
addEventListener(Event.ENTER_FRAME,updateframe,false,0,true);
function updateframe(e:Event):void{
if (frame < ecke1.currentFrame)
frame += 1;
}
var txt2:String = String(frame);
var textfeld:TextField = new TextField();
textfeld.text = txt2;
addChild(textfeld);
display current frame number [AS3]
i know this is late, but i just saw this post.
here is code i use to put the frame number of a movieclip (instance name "box2" ) which is nested inside another movieclip (instance name "box1") into a dynamic text box ( instance name "textBox" )
Code:
textBox.addEventListener(Event.ENTER_FRAME, frameNumberText);
function frameNumberText(evt:Event):void
{ textBox.text=box1.box2.currentFrame; }
that should help, or at least give you new ideas!
display current frame help
Quote:
Originally Posted by
tdemetri
i know this is late, but i just saw this post.
Code:
textBox.addEventListener(Event.ENTER_FRAME, frameNumberText);
function frameNumberText(evt:Event):void
{ textBox.text=box1.box2.currentFrame; }
You seem to be the only person out there that has done what I am trying to do. I have this code:
Code:
textBox.addEventListener(Event.ENTER_FRAME, frameNumberText);
function frameNumberText(evt:Event):void {
textBox.text = this.currentFrame;
}
But I get this error:
Line 1067: Implicit coercion of a value of type into to an unrelated type String
Could you have me any help?
Thanks in advance!
display current frame with other textboxes
I see that the latest reply was in 2009 but i give it a go.
After searching much without results I found this topic and I got it to work. I have a button going to a random frame and a dynamic textbox showing the current frame, like below
stop();
import flash.events.MouseEvent;
function onClick(event:MouseEvent):void
{
// generate a random number from 1 to 3
var nRandom = 1 + Math.floor(Math.random() * 65);
// tell timeline to goto and play the random number 'nRandom'
gotoAndStop(nRandom);
}
proceed.addEventListener(MouseEvent.CLICK, onClick);
function frameNumberText(event:Event):void
{
var frames:Number;
frames=currentFrame;
textBox.text = (String(frames));
}
textBox.addEventListener(Event.ENTER_FRAME, frameNumberText);
My problem is: If I add another textbox to my scene, the textbox, here called textBox, showing the current frame,
dissappeares/doesn't show. I can add object as rectangels or ovals or convert the textbox to a bitmap with decreased quality. But I can't convert it to a symbol, maintaining the quality.
How can I solve this? I'm a novice at flash and have been using it for a couple of days, googeling the actions above.
Know some flash from my youth.
Thanks for all help!!