>> >> myTween.onMotionChanged = function() { >> >> if ( (myTween.time > .2) && playOnce == true) { >> >> Delegate.create(scope, resetWin3);
Because that's not how delegate works exactly :) - there is no scope address to resetWin3 inside of the tween.onMotionChanged event. Instead you should do it like this: myTween.onMotionChanged = Delegate.create(scope, resetWin3) If you want to pass an argument to the function then that's easy enough: var myDel:Object = myTween.onMotionChanged = Delegate.create(scope, resetWin3) myDel.myArgument = "hello" then in the resetWin3 function: function resetWin3():Void { myVar = arguments.caller.myArgument } Jason Merrill Bank of America GT&O Learning & Leadership Development eTools & Multimedia Team >>-----Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On Behalf >>Of Helmut Granda >>Sent: Tuesday, April 03, 2007 10:07 AM >>To: flashcoders@chattyfig.figleaf.com >>Subject: Re: [Flashcoders] Delegate Class Scoping self instantiated >> >>You are correct, and it all seems clear now and working as >>expected, the only guy that I cant understand is the Tween >>class and the way i can pass a refrence of the main class inside it. >> >>I have learend that this works >> >>myTween.onMotionFinished = Delegate.create(this, myNextFunction); >> >>but I am triggering other functions in the middle of the Tween >> >>//code sample >> var playOnce:Boolean = true; >> >> myTween.onMotionChanged = function() { >> >> if ( (myTween.time > .2) && playOnce == true) { >> >> Delegate.create(scope, resetWin3); >> playOnce = false; >> } >> } >> >>//end of sample >> >>Which of course doesnt want to cooperate, I have tried to >>pass a reference of the class into the Tween but still it >>wants to use itself as a reference rather than the refence >>passed into it. Any Ideas? I will keep googling in the mean time... >> >>On 4/3/07, Merrill, Jason <[EMAIL PROTECTED]> wrote: >>> >>> If class has it's own variables, just use them inside the >>class- but >>> if you want to Extend movieClip and expect it to know about >>variables >>> outside it's scope, well, that's breaking OOP AFAIK, >>classes only know >>> about themselves. Instead, you will want to use a central >>composition >>> class and refer to movie clip instances instead of subclassing >>> movieClip. At least as I see it - others may have some >>different ideas. >>> >>> To make a movie clip animate itself, using myClass extends >>MovieClip, >>> you can just use "this" which is an instance of the movieClip. i.e. >>> this._x += 10; >>> >>> >>> Jason Merrill >>> Bank of America >>> GT&O Learning & Leadership Development eTools & Multimedia Team >>> >>> >>> >>> >>> >>-----Original Message----- >>> >>From: [EMAIL PROTECTED] >>> >>[mailto:[EMAIL PROTECTED] On Behalf >>> >>Of Helmut Granda >>> >>Sent: Tuesday, April 03, 2007 9:30 AM >>> >>To: flashcoders@chattyfig.figleaf.com >>> >>Subject: Re: [Flashcoders] Delegate Class Scoping self >>instantiated >>> >> >>> >>Oh, and I forgot an important point, the reson why I want to >>> >>find the scope of the class is because inside the class there >>> >>are variables that talk to each other and I can have them >>> >>talk back and forth like this >>> >> >>> >>_level0.instance1.myVariable = "blah"; >>> >> >>> >>but this of course wont work when the movie is loaded into a >>> >>new movie because the reference will be lost and changes to >>> >> >>> >>_level0.movieHolder.instance1.myVariable = "blah"; >>> >> >>> >>and of course it breaks the app. >>> >> >>> >>Thanks again, >>> >>-h >>> >> >>> >>On 4/3/07, Merrill, Jason <[EMAIL PROTECTED]> wrote: >>> >>> >>> >>> Classes don't know their own scope, they are oblivious >>to anything >>> >>> outside of them, (unless of course you import some other >>> >>class - then >>> >>> they know what the other class does, but still don't >>have any scope >>> >>> reference). What are you trying to do? >>> >>> >>> >>> Jason Merrill >>> >>> Bank of America >>> >>> GT&O Learning & Leadership Development eTools & Multimedia Team >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>-----Original Message----- >>> >>> >>From: [EMAIL PROTECTED] >>> >>> >>[mailto:[EMAIL PROTECTED] On Behalf >>> >>> >>Of Helmut Granda >>> >>> >>Sent: Tuesday, April 03, 2007 9:05 AM >>> >>> >>To: Flashcoders mailing list >>> >>> >>Subject: [Flashcoders] Delegate Class Scoping self >>instantiated >>> >>> >> >>> >>> >> I understand that when instantiating a class you can set the >>> >>> >>scope where the instance is going to run, but how about when >>> >>> >>we dont actually instantiate the class on the timeline but we >>> >>> >>just link the class directly to the items on the stage, how >>> >>> >>is the scope treated in this case? I assume the class has to >>> >>> >>be instantiated on itself or do we need a separate class to >>> >>> >>keep track of this item? >>> >>> >> >>> >>> >>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 >>> >>> >>> >>_______________________________________________ >>> >>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