# Movieclip click and textfield problem

**URL:** <https://forum.kirupa.com/t/movieclip-click-and-textfield-problem/260849>\
**Category:** flash\
**Created:** [May 20, 2008, 2:16pm UTC](https://forum.kirupa.com/t/movieclip-click-and-textfield-problem/260849 "2008-05-20T14:16:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sindarin](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Sindarin](https://forum.kirupa.com/u/Sindarin)\
**Post date:** [May 20, 2008, 2:16pm UTC](https://forum.kirupa.com/t/movieclip-click-and-textfield-problem/260849/1 "2008-05-20T14:16:59Z")

</div>

Hello, I have a movieclip that I need to click on so that a variable gets changed.

the code of the movie clip is:

> onClipEvent(mouseDown)  
> {  
> //if (\_global.ccc=1)  
> //{  
> //\_global.ccc=0  
> //}  
> //else  
> //{  
> \_global.ccc=\_global.ccc+1  
> trace(ccc)  
> //}  
> }  
> onClipEvent(load)  
> {  
> \_global.ccc=0  
> }  
> problems:

1. It is supposed that in each click the \_global.ccc variable is increased by 1. According to the trace, it does. But in the dynamic textbox doesn’t update.

2. The value is increased every time I click on the entire movie not the movieclip. How can I fix this?

---

<div class="post-metadata">

**Author:** ![tapioca](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tapioca](https://forum.kirupa.com/u/tapioca)\
**Post date:** [May 20, 2008, 2:44pm UTC](https://forum.kirupa.com/t/movieclip-click-and-textfield-problem/260849/2 "2008-05-20T14:44:08Z")

</div>

i think that mouseDown triggers whenever anywhere is clicked. try onPress instead. also maybe put ‘textboxname.text = \_global.ccc’ in whenever you change it.

```auto

onClipEvent(load)
{
  _global.ccc=0;
  onPress = function() {
    _global.ccc=_global.ccc+1;
          trace(ccc);
     [textboxname].text = _global.ccc;
  }
}

```
