Your code came in without returns, but i'll make a wild guess and say that using the alternate form of setInterval will work for you-

setInterval(object_containing_function,"function_name_as_string", milliseconds [, params])

-where you pass in the function as a parent object, string pair; so if you wanted to call a function called test() on the root, you would call

setInterval(_root,"test", 100)


On Mar 25, 2006, at 11:57 PM, Stephen Ford wrote:

Hi All - I am new to AS2 and OOP at large, but getting there (sort- of).

Can anyone please advise as to why, in the following code, the trace statement in the function tweenColors in returning 'undefined' ?

Why can't the tweenColors function (which is called with setInterval from another function) see the _oTransform object ?

Also, feel free to comment if you can see anything I am doing wrong generally speaking from an AS2 point of view
(as I said, I'm new to this and my head is still swimming).

---------------------------------------------------------------------- ------------------------
class MenuPainter extends MovieClip {      // Variables
private var _mcTarget:MovieClip; private var _cColor:Color; private var _oTransform:Object = {}; private var _nReds:Number = 255; private var _nGreens:Number = 153; private var _nBlues:Number = 0; private var _nInterval:Number; // Constructor public function MenuPainter(mcTarget:MovieClip) { _mcTarget = mcTarget; initColor(); } // Initialise first color of menu private function initColor():Void { _cColor = new Color(_mcTarget); _oTransform.rb = _nReds; _oTransform.gb = _nGreens; _oTransform.bb = _nBlues; _cColor.setTransform (_oTransform); } // Color menu function called from buttons within menu movie itself public function colorMenu (nReds:Number, nGreens:Number, nBlues:Number):Void { trace ("MenuPainter.colorMenu public function called, with arguments: "+nReds+" : "+nGreens+" : "+nBlues); _nReds = nReds; _nGreens = nGreens; _nBlues = nBlues; _nInterval = setInterval(tweenColors, 50); } public function tweenColors():Void { trace (_oTransform); }} ---------------------------------------------------------------------- ------------------------
Thanks,
Stephen Ford.

 _______________________________________________
[email protected]
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

_______________________________________________
[email protected]
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

Reply via email to