Hi, a question.

I'm talking about AS 2.





Inside a method of a class I've:





btnCollection.onRollOver = function() {


                    // here "this" is the button


                    var t = Number(this._name.substr(1, 1));


                    //


                    Mouse.hide();


                    //


                    cRef.cursor._visible = true;


                    startDrag(cRef.cursor, true);


                    //


                    cRef.setRotation(cRef.curPos[t]);


                };





btnCollection is previously created (in the same method), this way:





for (i=0; i<btns; i++) {


            var btnCollection = targetLevel['c'+i+'_btn'];


}





cRef is previously created this way:


var cRef = this; // it stores a reference to the class.




The var t registers a number contained in a button name (I use that
number to perform various tasks).





This is perfectly working, but now I want to use the Delegate class.





So, I did the following:





btnCollection.onRollOver = Delegate.create(this,
btnRollOver(btnCollection));





after having built this method:





private function btnRollOver(whichBtn) {


        var t = Number(whichBtn._name.substr(1, 1));


        //


        Mouse.hide();


        //


        cursor._visible = true;


        startDrag(cursor, true);


        //


        setRotation(curPos[t]);


    }





nothing works like before. 


That is: I probably easily get the class reference but I've lost the
reference to the single button...




I even tried (with no results):

1. btnCollection.onRollOver = Delegate.create(this,
btnRollOver, btnCollection);

2. changing btnCollection to be a class variable (not a local one);




Please, can you help me better understand this issue? What am I doing wrong?





Thanks!





        
                
___________________________________ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to