Sorry, that should be: var myClass:MyClass = new MyClass(target)
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Ngo Sent: Monday, April 02, 2007 6:52 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Delegate Scope Class Issues You're going to get an infinite loop out of that because you're instantiating a new instance of itself upon instantiation. What you need to do is pass a reference of the MovieClip to whatever class you're using it in: // timeline code var target:MovieClip = this.createEmptyMovieClip("target", this.getNextHighestDepth()); var mover:Mover = new Mover(target); // class class MyClass { private var mc:MovieClip public function MyClass(target:MovieClip) { mc = target; } } -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Helmut Granda Sent: Monday, April 02, 2007 6:31 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Delegate Scope Class Issues Thanks guys, I really appreciate it. No wonder for the life of me I couldn't get this to work. One more question since we are in scoping issues. As you can tell by my class I am refering to the button on the timeline directly. such as _level0.button_btn. But again this won't help me when the application changes levels, so I was thinking of making a reference of the instantiated class in the class and then reference to it but it get a bad result. So my class is as follows: class Timer { var button_btn : MovieClip; var mc : Timer; function Timer() { // mc created to transport focus... mc = new Timer(); //...rest of the function And I get this on the output window. 256 levels of recursion were exceeded Thanks again for your help. On 4/2/07, David Ngo <[EMAIL PROTECTED]> wrote: > > You're calling it incorrectly. Delegate returns a Function that is invoked > on the object you specify. Here's the correct syntax: > > class Mover > { > > var button_btn : MovieClip; > > function Mover() { > _level0.button_btn._alpha = 0; > init(); > } > > function init() { > > var myTween:Tween = new Tween(_level0.button_btn, "_alpha", > mx.transitions.easing.Elastic.easeOut,0, 100, 3, true); > > myTween.onMotionFinished = Delegate.create(this, record); > > } > > function record() { > trace("recordReached"); > } > > > } > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Helmut > Granda > Sent: Monday, April 02, 2007 5:52 PM > To: Flashcoders mailing list > Subject: [Flashcoders] Delegate Scope Class Issues > > Hi All, > > I have a little bit of a dilemma here. I have some Tweens that Im > scripting > and when they are done I want to trigger something else. but for some > reasons I cant get the Delegate class to talk directly to the rest of the > app. > > I can talk to the rest of the class directly such as > _level0.instance1."nextfunction" but of course in terms of portability > this > is not acceptable. > > Any pointers are really appreciated. > > class Mover > { > > var button_btn : MovieClip; > > function Mover() { > _level0.button_btn._alpha = 0; > init(); > } > > function init() { > > var myTween:Tween = new Tween(_level0.button_btn, "_alpha", > mx.transitions.easing.Elastic.easeOut,0, 100, 3, true); > > myTween.onMotionFinished = function() { > Delegate.create(this, record); > } > > } > > function record() { > trace("recordReached"); > } > > > } > _______________________________________________ > 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 > _______________________________________________ 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 _______________________________________________ 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