mardi 14 juin 2016

AS3, clarification on the 'this' pointer

I am writing a program in flex, and I am having an issue with the this pointer.

I have a function call inside of a function and I am wondering which event my this pointer is passing.

private function funcA(someArgument)
{
    newDialog.show("Title", "Body", funcB, this) // the 'this' is the argument for funcB
}

private function funcB(CloseEvent:event)
{
   if(event == Event.CANCEL)
      doStuff;
   if(event == Event.COMPLETE)
      doOtherStuff;
}

To clarify, my question is, when I pass the this pointer into the function in the newDialog, am I passing my newly created Dialogue or am I passing in funcA. I'm thinking and hoping its the former.

I would just test this manually but the system is really large and currently tied in with other events so its difficult for me to just instantiate objects to test them.

Aucun commentaire:

Enregistrer un commentaire