View Full Version : updateAfterEvent
Gauge
August 27th, 2003, 10:16 PM
ok, i made a form and i want to count how many characters you can type so i got this far...
mlength = message.length;
charsleft = 466-mlength+" characters left";
that works except when i made the movie 2 frames and looped it back the form wont work
so i tried
on (keyPress) {
updateAfterEvent();
}
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?
lostinbeta
August 27th, 2003, 10:39 PM
Hmm, I was covering something similiar just a minute ago...
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.
comicGeek
August 27th, 2003, 10:52 PM
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)
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:
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:
lostinbeta
August 27th, 2003, 11:07 PM
comicgeek, you don't need to use an listener for onChanged in a textfield ;)
Gauge
August 27th, 2003, 11:14 PM
ok, can you do it without putting it into a movie clip,
like
message.onChanged = function() {
mlength = message.length;
charsleft = 466-mlength+" characters left";
}
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...
lostinbeta
August 27th, 2003, 11:15 PM
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.
Gauge
August 27th, 2003, 11:23 PM
so then
message.onChanged = function() {
mlength = message.length;
charsleft = 466-mlength+" characters left";
}
should work?
lostinbeta
August 27th, 2003, 11:28 PM
Should
Gauge
August 27th, 2003, 11:50 PM
cool, thanks for the help....
on an unrelated note, im just wondering if you can see the picture in my signature?
lostinbeta
August 28th, 2003, 12:01 AM
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.geocities.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.
Gauge
August 28th, 2003, 09:08 AM
really?
ok cool, thanks again...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.