Play

Hi,

I’ve added a stop AS to a frame, and then a if…play…
Now, the weird thing is, it doesnt work!
And the weirdest stuff has yet to come.
If I add another action inside the if, for example making an MC invisible, it does that action, but it still doesnt play!!!
Does anybody know what the problem is?

Luster

I had that kind of problem before with multiple duplicatedMovieClips.

I did a quick fix by putting a play action on frame 2. Although it did fix the problem its not really a solution.

Sorry:smirk:

? I don’t really get what you mean.
This code was added to the frame itself, not to an MC. But to test it, I added _root.MC._visible =false; so I know the if statement is being runned.

can you show the code? It doesnt help much when we dont know what it is.

stop();
if (_root.balk.hitTest(_root.blok)) {
play();

}

Here’s my .fla…
It has to play frame4 when the 3 green ones hit the 3 blue ones…removed code cause it didn’t work… any ideas???

EDIT:sorry,it’s too big

Correct me if I’m wrong but don’t you have to tell it WHAT to play? (or where to play?).

As in: gotoAndPlay(4); or whatever.

stop(); simply stops anything that is currently going on but I didn’t think that play(); works the same way.

Where in the AS menus can you find that code?

I think your problem it’s actually the opposite of what Voetsjoeba
says. when the hitTest happens it keeps asking flash to play and play and play and as result of this it never actually plays as it’s trying to play (confusing, eh?).
what you need it’s to make sure you only call it once .

I would use something like this:

[AS]
if (_root.balk.hitTest(_root.blok)) {
if(!doneIt){
_root.gotoAndPlay(4);
doneIt=1;
}
}else{
doneIt=0;
}

[/AS]

SHO

eki – You do need an onEnterFrame handler, but not a static one. You need a dynamic onEnterFrame handler, so you can delete it when calling the gotoAndPlay action:


anymovieclip.onEnterFrame = function(){
if (_root.balk.hitTest(_root.blok)) {
                _root.gotoAndPlay(4);
delete this.onEnterFrame
}
}