Be a Supporter!

somebody help me please with flash

  • 318 Views
  • 8 Replies
New Topic Respond to this Topic
aplusads21
aplusads21
  • Member since: Feb. 4, 2009
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
somebody help me please with flash 2009-02-09 08:12:43 Reply

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
Response to somebody help me please with flash 2009-02-09 08:32:09 Reply

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
Response to somebody help me please with flash 2009-02-09 08:34:59 Reply

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.

Nice little tutorial for AS2.

ReNaeNae
ReNaeNae
  • Member since: Sep. 1, 2004
  • Offline.
Forum Stats
Supporter
Level 29
Blank Slate
Response to somebody help me please with flash 2009-02-09 08:42:16 Reply

Please keep your questions in ONE thread. Thanks

aplusads21
aplusads21
  • Member since: Feb. 4, 2009
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to somebody help me please with flash 2009-02-09 08:44:46 Reply

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
Response to somebody help me please with flash 2009-02-09 08:48:29 Reply

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
Response to somebody help me please with flash 2009-02-09 10:50:24 Reply

bloody hell some body deleted all my questions..

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to somebody help me please with flash 2009-02-09 12:07:16 Reply

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);									//
}														//

Sample fla file


- - Flash - Music - Images - -

BBS Signature
Kwing
Kwing
  • Member since: Jul. 24, 2007
  • Offline.
Forum Stats
Member
Level 45
Game Developer
Response to somebody help me please with flash 2009-02-09 14:29:22 Reply

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)