RE: [Flashcoders] Tweening text more smoothly - AS3
Maybe converting the actual time elapsed to a constant rate of motion could help... who knows? stage.align = TL; stage.scaleMode = noScale; function checkWrap ( o:DisplayObject ):void { if ( o.x stage.stageWidth ) o.x = 0; } var speed:Number = 1; var tick:Number = 30; var lastTick2:Number = getTimer(); var lastTick3:Number = getTimer(); var t:Timer = new Timer(tick); var t2:Timer = new Timer(tick); t.addEventListener( TimerEvent.TIMER, onT ); t2.addEventListener( TimerEvent.TIMER, onT2 ); stage.addEventListener( Event.ENTER_FRAME, onT3 ); t.start(); t2.start(); function onT( e:TimerEvent ):void { // timer mc.x += speed; checkWrap ( mc ); } function onT2( e:TimerEvent ):void { // timer + speed mc2.x += (( getTimer() - lastTick2 ) / tick ) * speed; lastTick2 = getTimer(); checkWrap ( mc2 ); } function onT3( e:Event ):void { // enter frame + speed mc3.x += (( getTimer() - lastTick3 ) / tick ) * speed; lastTick3 = getTimer(); checkWrap ( mc3 ); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jonathan howe Sent: Friday, May 23, 2008 3:53 AM To: Flash Coders List Subject: Re: [Flashcoders] Tweening text more smoothly - AS3 Apologies if this has already been mentioned... I discarded some of the original posts. If you are using a timer with a delay that does divide evenly to your frame rate, it stands to reason that some screen updates the item will have traveled more pixels than others. Example: Frame rate 24 fps roughly equals .042 updates per second: Frame 1 (.000) : Timer fires at .02, .04 Frame 2 (.042) : Timer fires at .06, .08 ... Frame 10 (.380) : Timer fires at .38, .40, .42 Frame 11 (.422) : Timer fires at .44, .46 So in this example, every ten frames/screen updates you're jumping an extra pixel. Therefore either keeping framelength % updatedelay = 0, or forcing screen update with updateAfterEvent() might solve the problem. Again, sorry if someone already mentioned this. -jonathan On Fri, May 23, 2008 at 5:59 AM, EECOLOR [EMAIL PROTECTED] wrote: You could create a bitmap using BitmapData.draw. Add that to your display list, set cacheAsBitmap to true and things should run smootly. Not sure if it works, but it is just another suggestion. Greetz Erik On 5/22/08, Vayu Robins [EMAIL PROTECTED] wrote: Hej. I am wondering if there is anything that could be done to improve the panning/scrolling/tweening of the news items at the bottom of the this page: http://flashkompagniet.dk/flash/main.php I am running a timer at 20 milliseconds Timer(20, 0); And the news items are being moved a 1px everytime the timer event is dispatched. I dont think they are runnning very smoothly. Is that just me or does anyone else see that too. Can anything be done? Thanks Vayu ___ 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 -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ 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] Tweening text more smoothly - AS3
Hey Jess, that's interesting, can you explain what's going on there with onT, onT2, onT3 and what is checkWrap ? ty L Jesse Graupmann a écrit : Maybe converting the actual time elapsed to a constant rate of motion could help... who knows? stage.align = TL; stage.scaleMode = noScale; function checkWrap ( o:DisplayObject ):void { if ( o.x stage.stageWidth ) o.x = 0; } var speed:Number = 1; var tick:Number = 30; var lastTick2:Number = getTimer(); var lastTick3:Number = getTimer(); var t:Timer = new Timer(tick); var t2:Timer = new Timer(tick); t.addEventListener( TimerEvent.TIMER, onT ); t2.addEventListener( TimerEvent.TIMER, onT2 ); stage.addEventListener( Event.ENTER_FRAME, onT3 ); t.start(); t2.start(); function onT( e:TimerEvent ):void { // timer mc.x += speed; checkWrap ( mc ); } function onT2( e:TimerEvent ):void { // timer + speed mc2.x += (( getTimer() - lastTick2 ) / tick ) * speed; lastTick2 = getTimer(); checkWrap ( mc2 ); } function onT3( e:Event ):void { // enter frame + speed mc3.x += (( getTimer() - lastTick3 ) / tick ) * speed; lastTick3 = getTimer(); checkWrap ( mc3 ); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jonathan howe Sent: Friday, May 23, 2008 3:53 AM To: Flash Coders List Subject: Re: [Flashcoders] Tweening text more smoothly - AS3 Apologies if this has already been mentioned... I discarded some of the original posts. If you are using a timer with a delay that does divide evenly to your frame rate, it stands to reason that some screen updates the item will have traveled more pixels than others. Example: Frame rate 24 fps roughly equals .042 updates per second: Frame 1 (.000) : Timer fires at .02, .04 Frame 2 (.042) : Timer fires at .06, .08 ... Frame 10 (.380) : Timer fires at .38, .40, .42 Frame 11 (.422) : Timer fires at .44, .46 So in this example, every ten frames/screen updates you're jumping an extra pixel. Therefore either keeping framelength % updatedelay = 0, or forcing screen update with updateAfterEvent() might solve the problem. Again, sorry if someone already mentioned this. -jonathan On Fri, May 23, 2008 at 5:59 AM, EECOLOR [EMAIL PROTECTED] wrote: You could create a bitmap using BitmapData.draw. Add that to your display list, set cacheAsBitmap to true and things should run smootly. Not sure if it works, but it is just another suggestion. Greetz Erik On 5/22/08, Vayu Robins [EMAIL PROTECTED] wrote: Hej. I am wondering if there is anything that could be done to improve the panning/scrolling/tweening of the news items at the bottom of the this page: http://flashkompagniet.dk/flash/main.php I am running a timer at 20 milliseconds Timer(20, 0); And the news items are being moved a 1px everytime the timer event is dispatched. I dont think they are runnning very smoothly. Is that just me or does anyone else see that too. Can anything be done? Thanks Vayu ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Tweening text more smoothly - AS3
:) I just read about wraping using modulus on Grant Skinner's blog: sprite.x = (sprite.x + 5) % stage.stageWidth; And then get where was that checkWrap methods :] Still I'm interested in the onT methods...I don't think I will get them before Grant's next post. the article about using modulus: http://www.gskinner.com/blog/archives/2008/05/core_as3_modulu.html L Jesse Graupmann a écrit : Maybe converting the actual time elapsed to a constant rate of motion could help... who knows? stage.align = TL; stage.scaleMode = noScale; function checkWrap ( o:DisplayObject ):void { if ( o.x stage.stageWidth ) o.x = 0; } var speed:Number = 1; var tick:Number = 30; var lastTick2:Number = getTimer(); var lastTick3:Number = getTimer(); var t:Timer = new Timer(tick); var t2:Timer = new Timer(tick); t.addEventListener( TimerEvent.TIMER, onT ); t2.addEventListener( TimerEvent.TIMER, onT2 ); stage.addEventListener( Event.ENTER_FRAME, onT3 ); t.start(); t2.start(); function onT( e:TimerEvent ):void { // timer mc.x += speed; checkWrap ( mc ); } function onT2( e:TimerEvent ):void { // timer + speed mc2.x += (( getTimer() - lastTick2 ) / tick ) * speed; lastTick2 = getTimer(); checkWrap ( mc2 ); } function onT3( e:Event ):void { // enter frame + speed mc3.x += (( getTimer() - lastTick3 ) / tick ) * speed; lastTick3 = getTimer(); checkWrap ( mc3 ); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jonathan howe Sent: Friday, May 23, 2008 3:53 AM To: Flash Coders List Subject: Re: [Flashcoders] Tweening text more smoothly - AS3 Apologies if this has already been mentioned... I discarded some of the original posts. If you are using a timer with a delay that does divide evenly to your frame rate, it stands to reason that some screen updates the item will have traveled more pixels than others. Example: Frame rate 24 fps roughly equals .042 updates per second: Frame 1 (.000) : Timer fires at .02, .04 Frame 2 (.042) : Timer fires at .06, .08 ... Frame 10 (.380) : Timer fires at .38, .40, .42 Frame 11 (.422) : Timer fires at .44, .46 So in this example, every ten frames/screen updates you're jumping an extra pixel. Therefore either keeping framelength % updatedelay = 0, or forcing screen update with updateAfterEvent() might solve the problem. Again, sorry if someone already mentioned this. -jonathan On Fri, May 23, 2008 at 5:59 AM, EECOLOR [EMAIL PROTECTED] wrote: You could create a bitmap using BitmapData.draw. Add that to your display list, set cacheAsBitmap to true and things should run smootly. Not sure if it works, but it is just another suggestion. Greetz Erik On 5/22/08, Vayu Robins [EMAIL PROTECTED] wrote: Hej. I am wondering if there is anything that could be done to improve the panning/scrolling/tweening of the news items at the bottom of the this page: http://flashkompagniet.dk/flash/main.php I am running a timer at 20 milliseconds Timer(20, 0); And the news items are being moved a 1px everytime the timer event is dispatched. I dont think they are runnning very smoothly. Is that just me or does anyone else see that too. Can anything be done? Thanks Vayu ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Amazon S3 Uploading via Flex
dear list, im trying to find a way ( a class/library ) to BATCH upload from my online FLEX app ( not AIR ) to Amazon S3. is there some code/samples one is kind enough to share that will automatically via Keys - generate and attach 64-based policies, signatures, etc. and would this be easier to do in PHP? if so, why? and how? any advice, direction, and code sharing would be immense. *artur :.* - *www.artur.com* - [EMAIL PROTECTED] - *ph:646.797.3320* ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Tweening text more smoothly - AS3
@Laurent So modulus is great and slow from what I've read. I tend to use it in row/ column calculation rather than wrapping a MovieClip position. var num:int = 6; var cols:int = 3; for ( var i:int = 0; i num; i++ ) { var row:int = Math.floor( i / cols ); var col:int = i % cols; trace ( i: + i + \trow: + row + \tcol: + col ); } i: 0row:0 col:0 i: 1row:0 col:1 i: 2row:0 col:2 i: 3row:1 col:0 i: 4row:1 col:1 i: 5row:1 col:2 In the previous post I'm moving a MovieClip to the right X.X pixels and when its position is off the screen I reset it back to 0. If I used the modulus method, the movement would always be rounded numbers and appear jerkier than this experiment requires. I'm actually hoping to round to the nearest twip. As for the examples themselves #1 onT is a timer tick. So about every 30ms it will move the MovieClip X pixels based on speed. Because Timers are never accurate to what you expect ( they only get as close as they can - see below ) onT will always be dragging behind the other two methods and moving at varied speeds. // Elapsed time from a tick on var t:Timer = new Timer(30); 47,38,36,36,36,36,36,38,36,35,35,36,36,34,36,42,36,35,35,36,35,37,40,36,36,3 6,36,36,54,36,37,35,34,36,38,38,36,36,36,36,69,39,35,36,35,36,36,42,44,36,36 ,35,36,35,63,37,33,36,35,37,40,30,35,34,36,92,55,66,35,36,34,36,46,36,36,36, 36,97,50,34,35,35,36,36,34,33,218,142,49,121,59,110,84,102,65,106,66,58,55,6 5,34,36,35,36,64,33,35,36,35,37,31,48,34,36,35,35,36,77,34,34,36,36,36,70,36 ,35,37,35,37,74,54,35,36,71,65,35,36,36,35,35,73,37,36,36,34,43,66,35,38,36, 35,34,73,36,34,50,59,67,37,36,36,36,56,47,37,36,36,34,36,30,46,35,36,36,36,5 9,46,35,36,36,36,59,45,35,36,36,34,36,32,48,37,37,35,38,56,48,34,36,36,36,58 ,47,34,37,36,36,57,72,45,36,50,55,45,35,35,35,36,61,45,36,35,35,36,66,45,131 ,39,45,33,37,34,37,34,45,51,36,51,49,38,67,35,36,36,34,43,47,38,50,35,34 // Difference from expected 30ms 17,8,6,6,6,6,6,8,6,5,5,6,6,4,6,12,6,5,5,6,5,7,10,6,6,6,6,6,24,6,7,5,4,6,8,8, 6,6,6,6,39,9,5,6,5,6,6,12,14,6,6,5,6,5,33,7,3,6,5,7,10,0,5,4,6,62,25,36,5,6, 4,6,16,6,6,6,6,67,20,4,5,5,6,6,4,3,188,112,19,91,29,80,54,72,35,76,36,28,25, 35,4,6,5,6,34,3,5,6,5,7,1,18,4,6,5,5,6,47,4,4,6,6,6,40,6,5,7,5,7,44,24,5,6,4 1,35,5,6,6,5,5,43,7,6,6,4,13,36,5,8,6,5,4,43,6,4,20,29,37,7,6,6,6,26,17,7,6, 6,4,6,0,16,5,6,6,6,29,16,5,6,6,6,29,15,5,6,6,4,6,2,18,7,7,5,8,26,18,4,6,6,6, 28,17,4,7,6,6,27,42,15,6,20,25,15,5,5,5,6,31,15,6,5,5,6,36,15,101,9,15,3,7,4 ,7,4,15,21,6,21,19,8,37,5,6,6,4,13,17,8,20,5,4 #2 onT2 - To compensate for the difference, I decide that for every 30ms that have passed the MovieClip should increment the correct amount ( 1 pixel ). When the tick occurs, I subtract the stored time (lastTick2) from the current time giving me the most accurate elapsed time. Dividing by the tick time gives me a percentage of my expected elapsed time. Multiplying that value by the speed produces the most accurate change over time. #3 onT3 - Because I can assume speed based on elapsed time is the most accurate, it won't matter when I call the function as long as it happens once per frame. So onT3 just uses the ENTER_FRAME event to calculate speed based on elapsed time using lastTick3. Here is another example that is commented a bit better and should make all this very apparent. stage.align = TL; stage.scaleMode = noScale; stage.addEventListener ( Event.ENTER_FRAME, onFrame ); // for every (stepTime)ms move (stepRate)pixels var stepTime:int = 30; var stepRate:int = 1; var time:int = getTimer(); function onFrame ( e:Event ):void { // time since last frame var elapsedTime:int = getTimer() - time; // store current time for the next check time = getTimer(); // percentage of expected time var timePercentage:Number = elapsedTime / stepTime; // rate compensation var movement:Number = timePercentage * stepRate; // move mc mc.x += movement; // wrap if off the stage if ( mc.x stage.stageWidth ) mc.x = 0; } Hasta! Jesse -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of laurent Sent: Saturday, May 24, 2008 2:13 AM To: Flash Coders List Subject: Re: [Flashcoders] Tweening text more smoothly - AS3 :) I just read about wraping using modulus on Grant Skinner's blog: sprite.x = (sprite.x + 5) % stage.stageWidth; And then get where was that checkWrap methods :] Still I'm interested in the onT methods...I don't think I will get them before Grant's next post. the article about using modulus: http://www.gskinner.com/blog/archives/2008/05/core_as3_modulu.html L Jesse Graupmann a écrit : Maybe converting the actual time elapsed to a constant rate of motion could help... who knows? stage.align = TL; stage.scaleMode = noScale; function checkWrap