# updateAfterEvent

**URL:** <https://forum.kirupa.com/t/updateafterevent/29545>\
**Category:** flash\
**Created:** [August 28, 2003, 2:16am UTC](https://forum.kirupa.com/t/updateafterevent/29545 "2003-08-28T02:16:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gauge](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@Gauge](https://forum.kirupa.com/u/Gauge)\
**Post date:** [August 28, 2003, 2:16am UTC](https://forum.kirupa.com/t/updateafterevent/29545/1 "2003-08-28T02:16:12Z")

</div>

ok, i made a form and i want to count how many characters you can type so i got this far…

[AS]  
mlength = message.length;  
charsleft = 466-mlength+" characters left";  
[/AS]

that works except when i made the movie 2 frames and looped it back the form wont work

so i tried

[AS]  
on (keyPress) {  
updateAfterEvent();  
}  
[/AS]

but im not quite sure how to use the updateAfterEvent, i tried a few different was like putting it on a movie clip and put the dyanmic text box to show the characters left on it but still nothing?

any help how to use it, or another way to refresh the dynamic text box without having more than 1 frame looped?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 2:39am UTC](https://forum.kirupa.com/t/updateafterevent/29545/2 "2003-08-28T02:39:00Z")

</div>

Hmm, I was covering something similiar just a minute ago…

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=32837](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=32837)

updateAfterEvent() is used after a codeblock so that Flash will update the new values outside of the framerate speed.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 2:52am UTC](https://forum.kirupa.com/t/updateafterevent/29545/3 "2003-08-28T02:52:25Z")

</div>

Hi,

That can be done usig the keyDown eventhandler. You don’t need to use the function updateAfterEvent(); for this. The function updateAfterEvent(); is only used to kind of refresh the Flash player after an event has happened.

First convert your form into a movie clip if your form is not yet a movie clip. Also note that this works on an INPUT textfield. Then place this script: (I assume that you are using Flash 5)

```auto

onClipEvent (keyDown) {
mlength = message.length;
charsleft = 466-mlength+" characters left";
trace(charsleft);
}

```

if you are using Flash MX use this code and place it on a frame in the same timeline as your textfield:

```auto

charCount = new Object();
charCount.onChanged = function(){
//here the textfield should have an instance name
//(not a variable name) of message.
charsleft = 466-message.length+" characters left";
trace(charsleft);
}
message.addListener(charCount);

```

Goodluck! :thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 3:07am UTC](https://forum.kirupa.com/t/updateafterevent/29545/4 "2003-08-28T03:07:50Z")

</div>

comicgeek, you don’t need to use an listener for onChanged in a textfield 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 3:14am UTC](https://forum.kirupa.com/t/updateafterevent/29545/5 "2003-08-28T03:14:10Z")

</div>

ok, can you do it without putting it into a movie clip,  
like

[AS]  
message.onChanged = function() {  
mlength = message.length;  
charsleft = 466-mlength+" characters left";  
}  
[/AS]

but i need to update outside of the frame rate because the movie is stopped on frame 1 then when i click submit it goes to frame 2 and thats it…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 3:15am UTC](https://forum.kirupa.com/t/updateafterevent/29545/6 "2003-08-28T03:15:52Z")

</div>

with onChanged framerate doesn’t matter, it will update the information when the textbox is changed. That is what the onChanged() handler is for. It basically says…

If them message textbox value is changed run these actions to update the information.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 3:23am UTC](https://forum.kirupa.com/t/updateafterevent/29545/7 "2003-08-28T03:23:44Z")

</div>

so then  
[AS]  
message.onChanged = function() {  
mlength = message.length;  
charsleft = 466-mlength+" characters left";  
}  
[/AS]

should work?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 3:28am UTC](https://forum.kirupa.com/t/updateafterevent/29545/8 "2003-08-28T03:28:55Z")

</div>

Should

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 3:50am UTC](https://forum.kirupa.com/t/updateafterevent/29545/9 "2003-08-28T03:50:44Z")

</div>

cool, thanks for the help…

on an unrelated note, im just wondering if you can see the picture in my signature?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 4:01am UTC](https://forum.kirupa.com/t/updateafterevent/29545/10 "2003-08-28T04:01:09Z")

</div>

No I cannot…

Tip: Change the extension of your image on your server to .txt instead of .jpg. Then when you link to it use…

[http://www.geoc](http://www.geoc)\*\*[ities.com/mentoflav/footer.txt](http://ities.com/mentoflav/footer.txt)

It is a little geocities cheat trick… but for the record, this DOES break the hotlinking rules you agree to when you sign up, so this is not a method I would support, but it does work if you want to do it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 1:08pm UTC](https://forum.kirupa.com/t/updateafterevent/29545/11 "2003-08-28T13:08:18Z")

</div>

really?  
ok cool, thanks again…
