# Another question about how variables work

**URL:** <https://forum.kirupa.com/t/another-question-about-how-variables-work/38144>\
**Category:** Uncategorized\
**Created:** [December 18, 2003, 7:57pm UTC](https://forum.kirupa.com/t/another-question-about-how-variables-work/38144 "2003-12-18T19:57:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [December 18, 2003, 7:57pm UTC](https://forum.kirupa.com/t/another-question-about-how-variables-work/38144/1 "2003-12-18T19:57:00Z")

</div>

Norie if you read this don’t yell at me . . . 😃

I have yet another question about how variables work.

I am using this code to communicate with an easing function:

[AS]  
onClipEvent (enterFrame) {\_root.gek = false;  
for (var i = 0; i\<18; i++) {  
if (\_root.timeline[“copy”+i].hitTest(\_root.\_xmouse, \_root.\_ymouse)) { //set gek variable to true when mouse hits timeline  
\_root.gek = true;  
}}  
[/AS]

if “gek” is true then the easing function works and my little “easebar” moves to the mouse.

Now, I want to be able to capture what i is when the mouse moves over it so that I can load an mc depending on where the easebar is.

I thought I could declare a global variable (\_global.j = 0) at the root and then set i to j and use j somewhere else. But i doesn’t exist outside of the onClipEvent!

Obviously I am very confused. How can I capture the value of i? :h:
