Hi Dwayne,

You're right it won't be the same. You need to store the value in each button, for retrieval when the functions are executed. Try something like this instead:

for (var j = 0; j<5; j++) {
   trace("j is"+j);
   this["clip"+j]["button"+j].nbrID = j;
   this["clip"+j]["button"+j].onRollOver = onClipRollOver;
   this["clip"+j]["button"+j].onRollOut = onClipRollOut;
}

onClipRollOver = function() {
Tweener.addTween(this._parent,{_xscale:100, _yscale:100, delay:0, time:2}); Tweener.addTween(_root["text"+ this.nbrID],{_alpha:100, delay:0, time:2});
   _root.touchedButton = true
   trace("nbrID: "+this.nbrID);
};
onClipRollOut = function() {
Tweener.addTween(this._parent,{_xscale:50, _yscale:50, delay:0, time:2});
   Tweener.addTween(_root["text"+this.nbrID],{_alpha:0, delay:0, time:2});
   _root.touchedButton = false
   trace("nbrID: "+this.nbrID);
};

hth,
Bob

Dwayne Neckles wrote:
Gang here is a stumper for you..

When in the first trace statement j is 0 through 4 but in the second trace 
statement j is 4, 4 times...

ive been playing with this for days.. so i guess the j value is not the same inside a nested function.. what can i do to make it the same?


for (var j = 0; j<5; j++) {
trace("j is"+j);
    this["clip"+j]["button"+j].onRollOver = function() {
Tweener.addTween(this._parent,{_xscale:100, _yscale:100, delay:0, time:2});
        Tweener.addTween(_root["text"+ j],{_alpha:100, delay:0, time:2});
_root.touchedButton = true
trace("j is"+j);
    };

    this["clip"+j]["button"+j].onRollOut = function() {

        Tweener.addTween(this._parent,{_xscale:50, _yscale:50, delay:0, 
time:2});
        Tweener.addTween(_root["text"+j],{_alpha:0, delay:0, time:2});
_root.touchedButton = false

    };



}


_________________________________________________________________
Helping your favorite cause is as easy as instant messaging. You IM, we give.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




--
Thanks,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bob Leisle Headsprout Software & Engineering
http://www.headsprout.com
Where kids learn to read!
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to