Ah. thanks Ian :)

I presumed as I had given the scope the method would be called in that object. Thanks for spotting the typo too, it's not in my actual class as I retyped the relevant bits. I would be dangerous if I could spell :)

Ali



On 21 Aug 2008, at 15:11, Ian Thomas wrote:

On Thu, Aug 21, 2008 at 3:01 PM, Ali Drongo <[EMAIL PROTECTED]> wrote:
Hi there, I'm using the Delegate class and can't figure out how to call
methods of another class.

 Delegate.create(thermo, allowInteraction)

should become

 Delegate.create(thermo, thermo.allowInteraction)

And this line:
var therno:Thermometer

should probably be:
var thermo:Thermometer

HTH,
 Ian


I think there is an easy answer to this, any suggestions whole- heartedly
appreciated.
Thanks,
Ali


Here is the syntax I'm using:

import Thermometer

class Animator{

      var therno:Thermometer

      function Animator(){
              thermo = _global.timeline.thermometer;
      }

      private function startNextQ():Void {
Delegate.create(thermo, allowInteraction) // error: There is
no property with the name 'allowInteraction'.
              thermo.allowInteraction(true); //doesn't work }
      }
}

///////

btw I don't know if you guys are already aware of this but I came across a
neat way to pass vars using Delegate from this blog
http://animateinexile.blogspot.com/2008/01/i-delegate-class-caller.html


//import the Delegate class
import mx.utils.Delegate;

//add a variable to pass to your handler
something.onPress = Delegate.create(this, someHandler);
something.onPress.myVariable = "pass me";

//now to access that variable use caller
function someHandler(){
var passedVar= arguments.caller.myVariable;
trace(passedVar);
}

thanks to luftbuefel for that!



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to