# This.onRelease = function()} play(); not working!

**URL:** <https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848>\
**Category:** Uncategorized\
**Created:** [March 30, 2006, 5:41pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848 "2006-03-30T17:41:46Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 5:41pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/1 "2006-03-30T17:41:46Z")

</div>

I am attempting to create this intro so that when the user rolls over the vegtable (mc) and clicks on it, it plays the rest of the timeline within the parent mc. This is the code I put on each mc:

stop();  
this.onEnterFrame = function() {  
if (rewind == true) {  
prevFrame();  
}  
};  
this.onRollOver = function() {  
rewind = false;  
play();  
};  
this.onRollOut = function() {  
rewind = true;  
};  
this.onRelease = function(){  
play();  
};

But when I click, nothing happens! Can someone help? My .fla is here

[http://www.innelladesign.com/manginos.fla](http://www.innelladesign.com/manginos.fla)

you’ll see that what I want to do is make it so that the 2 tomatoes, basil, onion and garlic all serve as buttons to play the rest of the parent mc. Any help would be much appreciated! THANK YOU!!

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 5:43pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/2 "2006-03-30T17:43:05Z")

</div>

have you tried simple tracing?

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 5:46pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/3 "2006-03-30T17:46:51Z")

</div>

> [@Defective](#):
>
> have you tried simple tracing?

Sorry, not sure what that is. I dont really write my own code…still learning.

?? can you explain?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 5:49pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/4 "2006-03-30T17:49:01Z")

</div>

Insert ‘trace(“you just clicked!”)’ into your onRelease handler, like this:

```auto
stop();
this.onEnterFrame = function() {
   if (rewind == true) {
      prevFrame();
   }
};
this.onRollOver = function() {
   rewind = false;
   play();
};
this.onRollOut = function() {
   rewind = true;
};
this.onRelease = function(){
   trace ("You just clicked!");
   play();
};

```

---

<div class="post-metadata">

**Author:** ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)\
**Post date:** [March 30, 2006, 5:49pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/5 "2006-03-30T17:49:29Z")

</div>

defective beat me to it 🙂

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 5:50pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/6 "2006-03-30T17:50:50Z")

</div>

:nat:  
Edit: wow. I didn’t even think of the signifigace between that indian and “you beat me to it” :lol:

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 5:51pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/7 "2006-03-30T17:51:35Z")

</div>

> [@BlueNar](#):
>
> defective beat me to it 🙂

What happens is You got clicked! shows up in the output box. Still not sure what i should do or what that means?? sorry…

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 5:53pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/8 "2006-03-30T17:53:31Z")

</div>

That means that “play();” is your issue.

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 5:57pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/9 "2006-03-30T17:57:14Z")

</div>

> [@Defective](#):
>
> That means that “play();” is your issue.

so i need to get rid of it? how do i get it to play the rest of the timeline then?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 5:58pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/10 "2006-03-30T17:58:50Z")

</div>

Your code doesn’t make much sense, can you explain what you are trying to acheive.

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 6:00pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/11 "2006-03-30T18:00:39Z")

</div>

> [@Defective](#):
>
> Your code doesn’t make much sense, can you explain what you are trying to acheive.

I want the (tomato or other veggie) mc to play so that the graphic moves up a bit, and then when the user releases, I want the rest of the parent mc to play.

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 6:01pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/12 "2006-03-30T18:01:55Z")

</div>

> [@InnellaDesign](#):
>
> I want the (tomato or other veggie) mc to play so that the graphic moves up a bit, and then when the user releases, I want the rest of the parent mc to play.

Or I was thinking to put an invisible button over the mc, but then the problem is, the mc won’t play. aka the tomato won’t bounce up.

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 6:03pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/13 "2006-03-30T18:03:31Z")

</div>

```auto
this.onRelease = function(){
   trace ("You just clicked!");
   this._parent.play();
};

```

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 6:07pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/14 "2006-03-30T18:07:01Z")

</div>

> [@Defective](#):
>
> ```
> ActionScript Code:
> [FONT=Courier New][LEFT][COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000] **function** [/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
> 
> ```
> 
> [COLOR=#0000FF]trace[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#FF0000]“You just clicked!”[/COLOR][COLOR=#000000])[/COLOR];  
> [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]\_parent[/COLOR].[COLOR=#0000FF]play[/COLOR]COLOR=#000000[/COLOR];  
> [COLOR=#000000]}[/COLOR];  
> [/LEFT]  
> [/FONT]

THANKS FOR SAVING THE DAY!!! works perfect. 'preciate it…

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 30, 2006, 6:10pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/15 "2006-03-30T18:10:16Z")

</div>

no problem, just remeber targeting. You were referring to “this” with the on handler, anything within that handler will happen to “this” item(a.k.a: the button).

Also you could also use “\_root.play();”, but this may create issues if you load this movie in another movie. So try to stick with relative targetting, like “this.\_parent.” then your always cool.

---

<div class="post-metadata">

**Author:** ![InnellaDesign](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InnellaDesign](https://forum.kirupa.com/u/InnellaDesign)\
**Post date:** [March 30, 2006, 6:36pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/16 "2006-03-30T18:36:34Z")

</div>

> [@Defective](#):
>
> no problem, just remeber targeting. You were referring to “this” with the on handler, anything within that handler will happen to “this” item(a.k.a: the button).
> 
> Also you could also use “\_root.play();”, but this may create issues if you load this movie in another movie. So try to stick with relative targetting, like “this.\_parent.” then your always cool.

ah. ok I see what you’re saying. I didnt realize that. Thanks for the lesson. :pleased:

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [March 30, 2006, 8:57pm UTC](https://forum.kirupa.com/t/this-onrelease-function-play-not-working/183848/17 "2006-03-30T20:57:45Z")

</div>

[http://www.n99creations.com/?pID=tutorials&col=Blue&tut=basics\_of\_actionscript\_for\_flash&p=2&l=Flash\_MX\_04](http://www.n99creations.com/?pID=tutorials&col=Blue&tut=basics_of_actionscript_for_flash&p=2&l=Flash_MX_04) :thumb:
