Forum Topic: M.C Problem

(76 views • 7 replies)

This topic is 1 page long.

<< < > >>
None

bartymany

Reply To Post Reply & Quote

Posted at: 11/3/09 11:27 AM

bartymany DARK LEVEL 08

Sign-Up: 04/15/08

Posts: 242

Okay, I have a variable of health, and i want to make it so the movieclip goes to frame 2 when health is 50, but when i put the code in the movieclip it doesnt work, do i have to put a duplicate variable in the movieclip also or something?


None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/3/09 11:43 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,840

What code ?

Just do

function onEnterFrame(){
if(Health<50){
MC.gotoAndStop(2)
}}

Thats AS2 of course but most of it its virtually identical to AS3

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 11/3/09 11:51 AM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,436

At 11/3/09 11:43 AM, hdxmike wrote: function onEnterFrame(){
if(Health<50){
MC.gotoAndStop(2)
}}

That will not go to frame 2 if Health is 50.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

None

bartymany

Reply To Post Reply & Quote

Posted at: 11/3/09 11:53 AM

bartymany DARK LEVEL 08

Sign-Up: 04/15/08

Posts: 242

At 11/3/09 11:43 AM, hdxmike wrote: What code ?

Just do

function onEnterFrame(){
if(Health<50){
MC.gotoAndStop(2)
}}

Thats AS2 of course but most of it its virtually identical to AS3

Oh so thats what i was doing wrong, thanks, im using as2 anyways


None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/3/09 12:03 PM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,840

At 11/3/09 11:51 AM, K-Guare wrote:
At 11/3/09 11:43 AM, hdxmike wrote: function onEnterFrame(){
if(Health<50){
MC.gotoAndStop(2)
}}
That will not go to frame 2 if Health is 50.

I made an assumption , sue me

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 11/3/09 12:26 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,436

At 11/3/09 12:03 PM, hdxmike wrote: I made an assumption , sue me

It had nothing to do with that it was in AS2, you just need to use your brain.
When Health is 50, Health is not less than 50.

onEnterFrame = function(){
	if(Health == 50){
		MC.gotoAndStop(2)
	}
}

That's what you meant to put.
Greater than or equal to, or less than or equal to would also work.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/3/09 02:02 PM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,840

At 11/3/09 12:26 PM, K-Guare wrote:
At 11/3/09 12:03 PM, hdxmike wrote: I made an assumption , sue me
It had nothing to do with that it was in AS2.

That wasnt the assumption, most of the time when someone needs code like that its because they want the charcters face to change when his health gets lower. under 100 is happy face , under 50 is sad, under 25 is beaten up etc so i thought he was looking for something with less than , unless he had 100 different states :P but yes <= would have been better but honestly how often do you need health to = an exact number ?

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 11/3/09 03:59 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,436

At 11/3/09 02:02 PM, hdxmike wrote:

Fantastic; glad you got that all set up.
Next time, though, just give him what he asks for.
It's up to him to describe what exactly he needs.

He didn't say what his intentions were with it, so don't assume.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 02:38 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!