Yea, Delegate would probably work (assuming I'm understanding correctly):

import mx.utils.Delegate; // I think that's the right path
// STUFF
var myVariable:Number = 10;

myButton.onRelease = Delegate.create(this, function() { this.myAction(); });

// I think this line would work too, but I'm not certain:
//myButton.onRelease = Delegate.create(this, myAction);

private function myAction()
{
  trace(myVariable)
}

 -Andy

On 1/25/07, Helmut Granda <[EMAIL PROTECTED]> wrote:
Hello all, I was looking for some recomendations into moving functions one
level up. Let me show you a piece of code to explain what I am trying to
accomplish:

//This code is within a Class

var myVariable:Number = 10;

myButton.onRelease = myAction;

private function myAction()
{
    trace(_parent.myVariable)
}


---

Now, I would love to be able to move my code one "level" up so I could do
the following:

var myVariable:Number = 10;

myButton.onRelease = myAction;

private function myAction()
{
    //Notice the change from _root.myVariable to:
    trace(myVariable)
}

Delegeate?

TIA
_______________________________________________
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

_______________________________________________
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