# Play

**URL:** <https://forum.kirupa.com/t/play/96702>\
**Category:** Uncategorized\
**Created:** [December 12, 2003, 2:36pm UTC](https://forum.kirupa.com/t/play/96702 "2003-12-12T14:36:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![luster](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@luster](https://forum.kirupa.com/u/luster)\
**Post date:** [December 12, 2003, 2:36pm UTC](https://forum.kirupa.com/t/play/96702/1 "2003-12-12T14:36:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2003, 2:40pm UTC](https://forum.kirupa.com/t/play/96702/2 "2003-12-12T14:40:46Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2003, 2:44pm UTC](https://forum.kirupa.com/t/play/96702/3 "2003-12-12T14:44:08Z")

</div>

? 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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2003, 2:57pm UTC](https://forum.kirupa.com/t/play/96702/4 "2003-12-12T14:57:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2003, 3:12pm UTC](https://forum.kirupa.com/t/play/96702/5 "2003-12-12T15:12:33Z")

</div>

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

}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2003, 3:27pm UTC](https://forum.kirupa.com/t/play/96702/6 "2003-12-12T15:27:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2003, 4:41pm UTC](https://forum.kirupa.com/t/play/96702/7 "2003-12-12T16:41:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 17, 2003, 2:01pm UTC](https://forum.kirupa.com/t/play/96702/8 "2003-12-17T14:01:30Z")

</div>

Where in the AS menus can you find that code?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 17, 2003, 2:54pm UTC](https://forum.kirupa.com/t/play/96702/9 "2003-12-17T14:54:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 17, 2003, 4:09pm UTC](https://forum.kirupa.com/t/play/96702/10 "2003-12-17T16:09:00Z")

</div>

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:

```auto

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

```
