This is a discussion on Scope Trouble while calling Functions within the Flash Actionscript Programming forums, part of the Web Development category; Hi all, A bit of scope trouble. I have a class file that takes an onRelease event and then creates ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all, A bit of scope trouble. I have a class file that takes an onRelease event and then creates movement from the Tween class. nTween = new mx.transitions.Tween(this, "_x",mx.transitions.easing.Elastic.easeOut, _x, 500, 2, true); Simple enough. Now when the motion completes (via onMotionFinished event) I need to call a function in the class. nTween.onMotionFinished = function(){ myClassFunction(); } The issue is that the scope is not typical to the event model. Meaning that using evt.target comes up undefined to try and reference the calling object. A trace of 'this' returns [Tween] in the Output. A trace of this._parent returns undefined. Anyone know how to get around this? With Regards. aramesh |
| Sponsored Links |
| |||
| Hi, Do it like this instead: import mx.transitions.Tween; import mx.transitions.easing.*; var myTween:Tween = new Tween (this, "_x", Elastic.easeOut, _x, 500, 2, true); myTween.addListener (this); function onMotionFinished (pTween:Tween):Void { trace (this); trace (pTween); }
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trouble getting movieclips to play at random | aramesh | Flash Actionscript Programming | 5 | 02-19-2008 06:48 AM |
| scope variable | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 11-13-2007 12:29 AM |
| Calling Winrunner functions in QTP | crusader | Testing Tools | 0 | 09-07-2007 01:19 AM |
| calling exe | bluesky | Database Support | 6 | 08-09-2007 05:41 AM |
| Calling WinRunner Functions in QTP | senthilkannan | Testing Tools | 0 | 07-19-2007 01:14 AM |