# I guess it's BASIC's in variables but

**URL:** <https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051>\
**Category:** Uncategorized\
**Created:** [September 3, 2003, 12:20pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051 "2003-09-03T12:20:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manare](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@Manare](https://forum.kirupa.com/u/Manare)\
**Post date:** [September 3, 2003, 12:20pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051/1 "2003-09-03T12:20:18Z")

</div>

Hi,  
I have a MovieClip instance called: MC1  
I have a Dynamic textfield called: DynT1

I’m doing a page which includes a dynamic text scroller.  
This text scroller uses both elements: the dynamic textfield and the MovieClip in which this dynamic textfield is contained.

The scroller engine (a MovieClip) contains AS with several calls to both elements, so if I want to use this scroller in other pages belonging to the same site I have 2 options:

1- Duplicate the scroller MC as many times as I need (and change those instance names for every specific scroller)  
2- Assign these instance names a variable name in the same frame the scroller is, resulting in the following:

Frame X  
var1=“MC1”;  
var2=“DynT1”;

Frame X+1  
var1=“MC2”;  
var2=“DynT2”;

…and so on. This way I can use the same scroller MC for ALL the pages I need it in…At least this is the theory.

What I have in the scroller engine are instructions such as:  
[AS]  
if (\_parent.\_parent.MC1.DynT1.maxscroll\<=1)  
…  
\_root.MC1.DynT1.scroll = percentScrolled\*(\_root.MC1.DynT1.maxscroll_0.010000);  
…  
\_root.MC1.DynT1.scroll = \_root.MC1.DynT1.maxscroll;  
…  
\_parent.MC1.DynT1.scroll = percentScrolled_(\_parent.MC1.DynT1.maxscroll\*0.010000);  
[/AS]

And by doing such change I have…  
[AS]  
if (\_parent.\_parent.var1.var2.maxscroll\<=1)  
…  
\_root.var1.var2.scroll = percentScrolled\*(\_root.var1.var2.maxscroll_0.010000);  
…  
\_root.var1.var2.scroll = \_root.var1.var2.maxscroll;  
…  
\_parent.var1.var2.scroll = percentScrolled_(\_parent.var1.var2.maxscroll\*0.010000);  
[/AS]  
Fine…it does not work… Why?  
I guess it must be something really stupid. I’ve tried  
var1=“MC1”;  
var2=“DynT1”;  
and  
var1=MC1;  
var2=DynT1;  
and other changes without success.

Could anybody give a hand with this?  
Thank you.

---

<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:** [September 3, 2003, 1:37pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051/2 "2003-09-03T13:37:05Z")

</div>

Hi,

[AS]  
//Frame X  
var1=\_root.MC1;  
var2=var1.DynT1;

//Frame X+1  
var1=\_root.MC2;  
var2=var1.DynT2;  
[/AS]

Either that or:

[AS]  
var fieldToScroll = eval(\_root+"."+  
var1+"."+var2);  
…  
\_root.var1.var2.scroll = percentScrolled\*(fieldToScroll.maxscroll\*0.010000);  
[/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:** [September 3, 2003, 3:46pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051/3 "2003-09-03T15:46:56Z")

</div>

Hi eki.  
Thanks for your help. However, I’'ve tried your both sytems but it’s still not working. I have no-idea what can be wrong with it…

I’m desperately open to more ideas ! :A+:

---

<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:** [September 3, 2003, 4:48pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051/4 "2003-09-03T16:48:28Z")

</div>

HI,

Sorry man

> 

\_root.var1.var2.scroll = percentScrolled\*(fieldToScroll.maxscroll\*0.010000);

should be:

fieldToScroll.scroll = percentScrolled\*(fieldToScroll.maxscroll\*0.010000);

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:** [September 3, 2003, 5:11pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051/5 "2003-09-03T17:11:31Z")

</div>

Hi eki.

I had already seen that lil “lapsus”. However this is still not working…It’s really getting on my nerves the amount of hours I’m spending with such a simple thing (in theory).  
I’ve made a very simple [EXAMPLE (6 Kb)](http://www.webpersonal.net/Wonderstuff/scroller_with_dyntext.zip) showing how it works.  
Perhaps this way it’s easier to see what’s wrong.

In this example everything’s fine for that is the version prior to the “var” changes I explained above.

Thank you very much for your interest.  
Manare

---

<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:** [September 3, 2003, 5:17pm UTC](https://forum.kirupa.com/t/i-guess-its-basics-in-variables-but/30051/6 "2003-09-03T17:17:01Z")

</div>

I’ve got to go now , I’ll have a look at it tomorrow, ok?
