for (var n:Number = 0; n<4; n++) {
            riferimento.createEmptyMovieCl
>
> ip("svolta_"+n,1000+n);
>             riferimento["svolta_"+n]._x = posizione["x_"+n];
>             riferimento["svolta_"+n]._y = posizione["y_"+n];
>             riferimento["svolta_"+n].moveTo(0, 0);


---------------------

            riferimento["svolta_"+n]["m"] = n;
 ---------------------------

            riferimento["svolta_"+n].beginFill(0xFF9933, 100);
>             riferimento["svolta_"+n].lineTo(dimensione, 0);
>             riferimento["svolta_"+n].lineTo(dimensione, dimensione);
>             riferimento["svolta_"+n].lineTo(0, dimensione);
>             riferimento["svolta_"+n].lineTo(0, 0);
>             riferimento["svolta_"+n].endFill();
>             riferimento["svolta_"+n].onRollOver = function () {


-----------------------

                trace ("svolta_"+ this.m);


--------------------------------------------------

            }
> }



On 11/26/05, maurizio piacenza [red cat] <[EMAIL PROTECTED]>
wrote:
>
> First of all, sorry for the Italian names of variables used in my code,
> but I think names are not so important to understand the problem.
> Here my code:
>
> for (var n:Number = 0; n<4; n++) {
>             riferimento.createEmptyMovieClip("svolta_"+n,1000+n);
>             riferimento["svolta_"+n]._x = posizione["x_"+n];
>             riferimento["svolta_"+n]._y = posizione["y_"+n];
>             riferimento["svolta_"+n].moveTo(0, 0);
>             riferimento["svolta_"+n].beginFill(0xFF9933, 100);
>             riferimento["svolta_"+n].lineTo(dimensione, 0);
>             riferimento["svolta_"+n].lineTo(dimensione, dimensione);
>             riferimento["svolta_"+n].lineTo(0, dimensione);
>             riferimento["svolta_"+n].lineTo(0, 0);
>             riferimento["svolta_"+n].endFill();
>             riferimento["svolta_"+n].onRollOver = function () {
>                 trace ("svolta_"+n);
>             }
> }
>
> The trace function is only an example, the real code will have other
> contents.
> What I need is to use a variable inside onRollOver functions defined for
> the 4 MovieClips. And I need 4 different values.
> If I use the code above, trace always traces "svolta_4" and this is ok.
> Well, this is not what I want, but I know that n value is assigned when
> onRollOver function is called, so every time n is 4 (the last value
> after iteration is completed).
> In AS1 I would have used something like this:
>
> riferimento["svolta_"+n].m = n; // and so the number is fixed at this
> time and will never change
> riferimento["svolta_"+n].onRollOver = function () {
>                 trace ("svolta_"+this.m);
> }
>
> But I think that now there is a problem due to strict typing of classes
> in AS2. I use a MovieClip that is dynamic, so I could use this method to
> solve my problem, but what if I would have the same problem with a class
> that is not dynamic?
>
> Thanks in advance!
> red cat
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



--
j:pn
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to