Re: [Flashcoders] What's happened to my var?
Thanks Jiri and Hans for your replies both work great though obv Jiris has the shortest syntax. I always trip up not using the Delegate class inside my classes and weird things happen! Thanks again, Ali On 7 Jul 2008, at 17:52, Jiri Heitlager wrote: Or add onCompleteScope:this so you dont need to import Delegate class. TweenFilterLite.to(m, tweenTime, {_y:targetPos, onCompleteScope:this , onComplete:moveShape, onCompleteParams:[_timeline.y1]}); Jiri Ali Drongo wrote: Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class. My problem is that the second time the moveShape method is called the moveAmt variable is undefined. If anyone can suggest what's going on I would be really thankful! Cheers Ali //Main.as import gs.TweenFilterLite; import utils.Numbers; class Main { var minTime:Number = 1; var maxTime:Number = 2; //number of pixels to move shape up or down var moveAmt:Number = 15; var _timeline:MovieClip; function Main(timeline){ _timeline = timeline; moveShape(_timeline.y1); } //moves a shape up or down private function moveShape(m:MovieClip) { trace(moveShape:+m+ up:+m.up); var moveDir:Number = 1; //if movieclip is tagged as moving up if(m.up){ moveDir = -1; m.up= false; }else{ m.up=true; } var targetPos:Number = moveDir*moveAmt; trace(moveDir:+moveDir); trace(moveAmt:+moveAmt); trace(target:+targetPos); var tweenTime:Number = Numbers.randRange(minTime, maxTime); TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]}); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Alistair Colling Interactive Developer FPP Brand Communications (Newcastle upon Tyne) The Courtyard Dinsdale Place Sandyford Newcastle upon Tyne NE2 1BD Telephone: +44 (0)191 261 6662 Fax: +44 (0)191 233 2511 This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender at the e-mail address above. FPP Design Limited. Reg. Office: The Courtyard, Dinsdale Place, Sandyford, Newcastle upon Tyne NE2 1BD. Registered Number 3775564. Registered in England and Wales. Visit our website at http://www.fpp.net/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] What's happened to my var?
Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class. My problem is that the second time the moveShape method is called the moveAmt variable is undefined. If anyone can suggest what's going on I would be really thankful! Cheers Ali //Main.as import gs.TweenFilterLite; import utils.Numbers; class Main { var minTime:Number = 1; var maxTime:Number = 2; //number of pixels to move shape up or down var moveAmt:Number = 15; var _timeline:MovieClip; function Main(timeline){ _timeline = timeline; moveShape(_timeline.y1); } //moves a shape up or down private function moveShape(m:MovieClip) { trace(moveShape:+m+ up:+m.up); var moveDir:Number = 1; //if movieclip is tagged as moving up if(m.up){ moveDir = -1; m.up= false; }else{ m.up=true; } var targetPos:Number = moveDir*moveAmt; trace(moveDir:+moveDir); trace(moveAmt:+moveAmt); trace(target:+targetPos); var tweenTime:Number = Numbers.randRange(minTime, maxTime); TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]}); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] What's happened to my var?
try this: import mx.utils.Delegate; TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:Delegate.create (this, moveShape), onCompleteParams:[_timeline.y1]}); if it works, move the declaration of the delegate into your constructor, so it isn't recreated every time. greetz JC On Mon, Jul 7, 2008 at 4:41 PM, Ali Drongo [EMAIL PROTECTED] wrote: Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class. My problem is that the second time the moveShape method is called the moveAmt variable is undefined. If anyone can suggest what's going on I would be really thankful! Cheers Ali //Main.as import gs.TweenFilterLite; import utils.Numbers; class Main { var minTime:Number = 1; var maxTime:Number = 2; //number of pixels to move shape up or down var moveAmt:Number = 15; var _timeline:MovieClip; function Main(timeline){ _timeline = timeline; moveShape(_timeline.y1); } //moves a shape up or down private function moveShape(m:MovieClip) { trace(moveShape:+m+ up:+m.up); var moveDir:Number = 1; //if movieclip is tagged as moving up if(m.up){ moveDir = -1; m.up= false; }else{ m.up=true; } var targetPos:Number = moveDir*moveAmt; trace(moveDir:+moveDir); trace(moveAmt:+moveAmt); trace(target:+targetPos); var tweenTime:Number = Numbers.randRange(minTime, maxTime); TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]}); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] What's happened to my var?
Or add onCompleteScope:this so you dont need to import Delegate class. TweenFilterLite.to(m, tweenTime, {_y:targetPos, onCompleteScope:this , onComplete:moveShape, onCompleteParams:[_timeline.y1]}); Jiri Ali Drongo wrote: Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class. My problem is that the second time the moveShape method is called the moveAmt variable is undefined. If anyone can suggest what's going on I would be really thankful! Cheers Ali //Main.as import gs.TweenFilterLite; import utils.Numbers; class Main { var minTime:Number = 1; var maxTime:Number = 2; //number of pixels to move shape up or down var moveAmt:Number = 15; var _timeline:MovieClip; function Main(timeline){ _timeline = timeline; moveShape(_timeline.y1); } //moves a shape up or down private function moveShape(m:MovieClip) { trace(moveShape:+m+ up:+m.up); var moveDir:Number = 1; //if movieclip is tagged as moving up if(m.up){ moveDir = -1; m.up= false; }else{ m.up=true; } var targetPos:Number = moveDir*moveAmt; trace(moveDir:+moveDir); trace(moveAmt:+moveAmt); trace(target:+targetPos); var tweenTime:Number = Numbers.randRange(minTime, maxTime); TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]}); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders