Re: [Flashcoders] Delegate Scope Class Issues
On 4/2/07, Helmut Granda [EMAIL PROTECTED] wrote: This myTween.onMotionFinished = function() { Delegate.create(this, record); } Should be: myTween.onMotionFinished = Delegate.create(this, record); -- T. Michael Keesey Director of Technology Exopolis, Inc. 2894 Rowena Avenue Ste. B Los Angeles, California 90039 -- The Dinosauricon: http://dino.lm.com Parry Carney: http://parryandcarney.com ISPN Forum: http://www.phylonames.org/forum/ ___ 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
RE: [Flashcoders] Delegate Scope Class Issues
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
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
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
RE: [Flashcoders] Delegate Scope Class Issues
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
Re: [Flashcoders] Delegate Scope Class Issues
Thanks David, I believe all is clear now, I was having difficulties in referencing objects on the stage but I figured out that I needed to insert my objects in the mc that the Class was being instantiated at. but if I wanted to reference to the items on the Stage I just had to do: var myClass:MyClass = new MyClass(this) // stage scope Thanks again, I really appreciate it .. next stop Classes talking to each other with EventDispatcher :) On 4/2/07, David Ngo [EMAIL PROTECTED] wrote: 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