|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
time-need help
I am very new to Flash and programming. I am playing around with some things just to learn. I created one little project that displays the time. I wanted to create another that displays the time when you click on a button. I can get the time to display when I click the button, but the time stops. I can advance it by clicking the button again, but I want the time to continue counting on its own. All the script is in the button and it is the same code that I used for the first one that does continue to count. What am I doing wrong?
Thanks mfulper |
|
#2
|
||||
|
||||
|
Your actionscript to generate the time should be located on a movie clip instead of inside a button. The dynamic text field should be located within this movie clip. The actionscript on the movie clip will be set to enterFrame so that the text field can easily update itself. The most important thing to do is to put this actionscript within a function, so that you can call it at anytime from your button.
This actionscript goes in the movie clip's actions panel. Code:
onClipEvent (enterFrame) {
function time() {
// The actionscript to generate the time goes here.
}
}
This is for your button to call the function. Code:
on (release) {
time();
}
Last edited by jmichels : February 13th, 2004 at 07:33 PM. |
|
#3
|
||||
|
||||
|
I would use the first project you had that displays the time and include this actionscript:
Code:
time._visible = false; and on the button put this actionscript: Code:
on(press){
if(_root.time._visible = true){
_root.time._visible = false;
)
else
_root.time._visible = true;
}(
That way you can toggle it on and off.
__________________
No problem is so complex that it cannot be resolved with the proper use of explosives. |
|
#4
|
||||
|
||||
|
But if he does that, the time will keep stopping and he'll have to keep pushing the button. this.onEnterFrame or having the actionscript located on the movie clip will update the clock without him having to push the button over and over.
|
|
#5
|
||||
|
||||
|
I am assuming that his first project was working and that updating function was already working within it, but yes if that is not the case you are correct jmichels.
|
|
#6
|
|||
|
|||
|
time-need help
Sorry for such a delay, but I wanted to thank you for your suggestions. I have tired both and still don't have it working but I think you have me heading in the right direction. I need to play aorund with it, which is how I learn best. I will be back if I can't make it work.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > time-need help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|