Forum Topic: AS Problem

(214 views • 14 replies)

This topic is 1 page long.

<< < > >>
None

wodahs

Reply To Post Reply & Quote

Posted at: 9/6/05 05:08 PM

wodahs NEUTRAL LEVEL 06

Sign-Up: 05/26/05

Posts: 97

for (var i = 1; i < 10; i++)
{
if("cash" + i.hitTest(wheel1)){
"cash" + i.removeMovieClip();
_root.cash = _root.cash + 500;
}
}

Ok so i am trying to check if cash1, cash2, cash3, cash4 etc is being hit by wheel1. If i switch the code around it won't work. What am i doing wrong?! Thanks


None

T-H

Reply To Post Reply & Quote

Posted at: 9/6/05 05:10 PM

T-H LIGHT LEVEL 38

Sign-Up: 01/07/04

Posts: 4,903

for (var i = 1; i < 10; i++)
{
if(["cash" + i].hitTest(wheel1)){
["cash" + i].removeMovieClip();
_root.cash = _root.cash + 500;
}
}

Use square brackets to treat the expression "cash" + i as an object.


None

Denvish

Reply To Post Reply & Quote

Posted at: 9/6/05 05:10 PM

Denvish DARK LEVEL 42

Sign-Up: 04/25/03

Posts: 15,933

At 9/6/05 05:08 PM, wodahs wrote: Ok so i am trying to check if cash1, cash2, cash3, cash4 etc is being hit by wheel1. If i switch the code around it won't work. What am i doing wrong?! Thanks

Everything.

if(_root["cash" + i].hitTest(wheel1)){

If that doesn't work, try _root.wheel1

- - Flash - Music - Report Abuse - -
Not around any more, see last news post.

BBS Signature

None

Diglet

Reply To Post Reply & Quote

Posted at: 9/6/05 05:10 PM

Diglet FAB LEVEL 08

Sign-Up: 07/24/05

Posts: 459

YOU NEED TO FIX TYOUR PROTAL

AS Problem

Best thread ever. Please bump it :(


None

Denvish

Reply To Post Reply & Quote

Posted at: 9/6/05 05:11 PM

Denvish DARK LEVEL 42

Sign-Up: 04/25/03

Posts: 15,933

At 9/6/05 05:10 PM, nightcrawlerclock wrote: YOU NEED TO FIX TYOUR PROTAL

OK, time to chill out now. Use D7's tension-release thread for that stuff.

- - Flash - Music - Report Abuse - -
Not around any more, see last news post.

BBS Signature

None

Diglet

Reply To Post Reply & Quote

Posted at: 9/6/05 05:12 PM

Diglet FAB LEVEL 08

Sign-Up: 07/24/05

Posts: 459

rofl

Best thread ever. Please bump it :(


None

T-H

Reply To Post Reply & Quote

Posted at: 9/6/05 05:13 PM

T-H LIGHT LEVEL 38

Sign-Up: 01/07/04

Posts: 4,903

At 9/6/05 05:10 PM, nightcrawlerclock wrote: YOU NEED TO FIX TYOUR PROTAL

At least repeat spam a decent picture instead of that crap.


None

wodahs

Reply To Post Reply & Quote

Posted at: 9/6/05 05:42 PM

wodahs NEUTRAL LEVEL 06

Sign-Up: 05/26/05

Posts: 97

I had to change the code to comply with something and i need it to be in the ground movie clip

for (var i = 1; i < 10; i++)
{
if(ground["greencash" + i].hitTest(wheel1)){
(ground["greencash" + i]).removeMovieClip();
_root.cash = _root.cash + 500;
}
}
}

So i wack that in, so it will refer to ground.cash1 etc and this won't work. I used the trace identifier so i could check if it is actually being hit, and it is. But the movie clip is not being deleted. Anyone know why? Thanks


None

T-H

Reply To Post Reply & Quote

Posted at: 9/6/05 05:44 PM

T-H LIGHT LEVEL 38

Sign-Up: 01/07/04

Posts: 4,903

Just to check, it is in an enterFrame handler or interval isnt it?


None

wodahs

Reply To Post Reply & Quote

Posted at: 9/6/05 05:50 PM

wodahs NEUTRAL LEVEL 06

Sign-Up: 05/26/05

Posts: 97

No it isn't, i tried sticking it in the ground.onEnterFrame function and a number of exciting and weird things and stupid things happened when i did lol. Do you know what could be stopping it to delete?


None

T-H

Reply To Post Reply & Quote

Posted at: 9/6/05 05:52 PM

T-H LIGHT LEVEL 38

Sign-Up: 01/07/04

Posts: 4,903

_root.onEnterFrame = function(){
for (var i = 1; i < 10; i++)
{
if(ground["greencash" + i].hitTest(wheel1)){
(ground["greencash" + i]).removeMovieClip();
_root.cash = _root.cash + 500;
}
}
}
}


None

wodahs

Reply To Post Reply & Quote

Posted at: 9/6/05 05:54 PM

wodahs NEUTRAL LEVEL 06

Sign-Up: 05/26/05

Posts: 97

Its not in the _root directory either. Sorry for being a pain in the arse lol.


None

T-H

Reply To Post Reply & Quote

Posted at: 9/6/05 06:09 PM

T-H LIGHT LEVEL 38

Sign-Up: 01/07/04

Posts: 4,903

Well my last guess will be that you might not have specified the full destination of wheel1.

Do you need to use ground.wheel1?
If it is outside the ground clip, hitTesting it with something inside the ground clip may result in the 2 objexts having co ordinates in relation to different points.


None

wodahs

Reply To Post Reply & Quote

Posted at: 9/6/05 06:14 PM

wodahs NEUTRAL LEVEL 06

Sign-Up: 05/26/05

Posts: 97

Ok, the full game is in a movie clip called "easy"

After that, there are symbols and stuff, for wheel1 and 2. Then there is the chassis of the car, after that there is a background pciture. There is a ground movie clip with an instance name of ground.

The symbols that i want to delete are in there. so technically, ground is at _root.easy.ground

Then in ground, there is the ground (oddly enough) and on the top most layer there is all the symbols in different places going from 1 - 9. I know that the code works because it is adding to the _root.cash. So, i need to delete the corresponding cash movie clip in the ground movie clip.


None

Denvish

Reply To Post Reply & Quote

Posted at: 9/6/05 06:24 PM

Denvish DARK LEVEL 42

Sign-Up: 04/25/03

Posts: 15,933

At 9/6/05 06:14 PM, wodahs wrote: Then in ground, there is the ground (oddly enough) and on the top most layer there is all the symbols in different places going from 1 - 9. I know that the code works because it is adding to the _root.cash. So, i need to delete the corresponding cash movie clip in the ground movie clip.

Try specifying the full path

_root.onEnterFrame = function(){
for (var i = 1; i < 10; i++){
if(_root.easy.ground["greencash" + i].hitTest(_root.easy.ground.wheel1)){
_root.easy.ground["greencash" + i].removeMovieClip();
_root.cash = _root.cash + 500;
}
}
}

- - Flash - Music - Report Abuse - -
Not around any more, see last news post.

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 11:18 AM

<< 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!