somebody help me please with flash
- aplusads21
-
aplusads21
- Member since: Feb. 4, 2009
- Offline.
-
- Forum Stats
- Member
- Level 01
- Blank Slate
Hi,
i don't what is the best forum to get help with coding questions for FLash.
Please somebody post some forum names for flash.
anyway this is my first question
i am following this simple timer tutorial from newgrounds
http://www.newgrounds.com/portal/view/47 4693 (pls view it)
what it does is set a var named clock
then creates a movie clip with 24 frames . after every 24th frame it adds 1 to the variable clock.
so every second the clock updates ++
GOod ?
ok
Now here is my question
i can use if statement to check
if the clock timer is = certain value
if the click timer is < certain value
if the clock timer is > certain value
But
Question
How do i make something happen every 5 second or 10 second or 30 second etc.
something like on every 5 second
do something.
Hope you understood the question
- Batteau
-
Batteau
- Member since: Jul. 18, 2006
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
just a thought but cant you make a variable which does something like this
var second:Number = 0;
every time you go one second further
second++;
and then build in a checker with
this.onEnterFrame = function () {
if (second ==5) {
trace (second);
}if (second ==10) {
trace ((second ) ;
}
}
its a not realy pratical but mayby it gives you idea's
- TutorialPoo
-
TutorialPoo
- Member since: Dec. 29, 2008
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
At 2/9/09 08:32 AM, Batteau wrote: just a thought but cant you make a variable which does something like this
var second:Number = 0;
every time you go one second further
second++;
and then build in a checker with
this.onEnterFrame = function () {
if (second ==5) {
trace (second);
}if (second ==10) {
trace ((second ) ;
}
}
its a not realy pratical but mayby it gives you idea's
Definitely not practical.
- ReNaeNae
-
ReNaeNae
- Member since: Sep. 1, 2004
- Offline.
-
- Forum Stats
- Supporter
- Level 29
- Blank Slate
Please keep your questions in ONE thread. Thanks
- aplusads21
-
aplusads21
- Member since: Feb. 4, 2009
- Offline.
-
- Forum Stats
- Member
- Level 01
- Blank Slate
both of you missed my question
But
Question
How do i make something happen every 5 second or 10 second or 30 second etc.
the timer clock variable is already updating every second to +1 or ++
But how do i check
on every 5 second
do something
- aplusads21
-
aplusads21
- Member since: Feb. 4, 2009
- Offline.
-
- Forum Stats
- Member
- Level 01
- Blank Slate
At 2/9/09 08:42 AM, ReNaeNae wrote: Please keep your questions in ONE thread. Thanks
All questions are different..
it will be hard to relate them. and people will mix things up..
- aplusads21
-
aplusads21
- Member since: Feb. 4, 2009
- Offline.
-
- Forum Stats
- Member
- Level 01
- Blank Slate
bloody hell some body deleted all my questions..
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
You can check for regular events, ie. every 5 seconds, by comparing the time/5 with int(time/5)
New fla, code on main timeline frame 1:
time=0; //TIME
div=5; //DIVISOR TO CHECK
cnt=0; //FRAME COUNTER
fps=24; //FRAMES PER SECOND
onEnterFrame=function(){ //ENTERFRAME
cnt++; //INCREMENT COUNTER
if(cnt>fps){ //HAS REACHED ONE SECOND
time++;cnt=0; //ADD A SECOND TO TIME, RESET COUNTER
trace(time); //TRACE
if(time/div==int(time/div)){ //IS DIVISIBLE BY div (IE, 5)
DOSOMETHING(); //TRIGGER EVENT
} //
} //
} //
function DOSOMETHING(){ //TRIGGERED FUNCTION
inte=div+"x"+time/div; //UPDATE OTHER TEXTFIELD
trace(inte); //
} //
- Kwing
-
Kwing
- Member since: Jul. 24, 2007
- Offline.
-
- Forum Stats
- Member
- Level 45
- Game Developer
If you're trying to make it hard for us to understand you, you're doing a good job.
Simply put this on frame (FPS*Second Delay) within a Movie Clip:
if(_root.clock>setvalue){
if(_root.clock<setvalue){
if(_root.clock==setvalue){ If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)


