PDA

View Full Version : I guess it's BASIC's in variables but....



Manare
September 3rd, 2003, 08:20 AM
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:

if (_parent._parent.MC1.DynT1.maxscroll<=1)
....
_root.MC1.DynT1.scroll = percentScrolled*(_root.MC1.DynT1.maxscroll*0.01000 0);
....
_root.MC1.DynT1.scroll = _root.MC1.DynT1.maxscroll;
....
_parent.MC1.DynT1.scroll = percentScrolled*(_parent.MC1.DynT1.maxscroll*0.010 000);


And by doing such change I have..

if (_parent._parent.var1.var2.maxscroll<=1)
....
_root.var1.var2.scroll = percentScrolled*(_root.var1.var2.maxscroll*0.01000 0);
....
_root.var1.var2.scroll = _root.var1.var2.maxscroll;
....
_parent.var1.var2.scroll = percentScrolled*(_parent.var1.var2.maxscroll*0.010 000);

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.

eki
September 3rd, 2003, 09:37 AM
Hi,


//Frame X
var1=_root.MC1;
var2=var1.DynT1;

//Frame X+1
var1=_root.MC2;
var2=var1.DynT2;


Either that or:


var fieldToScroll = eval(_root+"."+
var1+"."+var2);
...............................................
_root.var1.var2.scroll = percentScrolled*(fieldToScroll.maxscroll*0.010000) ;


SHO

Manare
September 3rd, 2003, 11:46 AM
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+:

eki
September 3rd, 2003, 12:48 PM
HI,

Sorry man



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



should be:

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

SHO

Manare
September 3rd, 2003, 01:11 PM
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

eki
September 3rd, 2003, 01:17 PM
I've got to go now , I'll have a look at it tomorrow, ok?