Uncontrollable Stuttering

Good thought, i'll try if this works and give feedback.
Thanks!
Mhh, I'm torn between simulation errors and some different errors I don't know about. Seems to be a mixture of both. I've completely stripped away the part of the simulation and it looks even worse. All objects on screen are moved 7 pixels, each with its own ENTER_FRAME Event. CPU usage is about 15% for me, and my graphic card shouldn't be the bottleneck either. But this time it seems more like a pure Flash question. I've already checked the coordinates, every frame the objects are moved 7px without any compromise.


---
forgot to attach the swf.
I think it's the graphics.
It really did become worse, and when you click anywhere in the movie it seems to hang for a moment.

What format are you using for the graphics? I, sometimes, had unexpected problems in projects using .png files.
Try running the same code with simple flash drawn rectangles.
Mhh, ich just changed the graphics, but nothing changed, the stuttering isn't as noticible as before, but all in all its persisting.
The most important lines of code are these:
Code:
addChild( new randomObject(this, timer, clip, timeMin, timeVariation, yMax, yVariation, speed, firstTime) );

Code:
package de.mariusheil.bitmap.recurringObjects {
   import flash.display.MovieClip;
   import de.mariusheil.easy._root;

   import flash.display.DisplayObject;
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.events.TimerEvent;
   import flash.utils.Timer;

   /**
    * @author Marius
    */
   public class randomObject extends Sprite{
      public var timeMin:int;
      public var timeVariation:int;
      public var yMax:int;
      public var yVariation:int;
      public var initSpeed:Number;
      public var speed:Number;
      public var lastTime:int;
      public var firstTime:int;
      public var manager:objectManager;
      public var timer:Timer;
      public var ressource:MovieClip;
      
      public var nextTime:int;
      
      public function randomObject(manager:objectManager, timer:Timer, ressource:MovieClip, timeMin:int, timeVariation:int, yMax:Number, yVariation:Number, speed:Number, firstTime:int ) {
         this.timeMin = timeMin;
         this.timeVariation = timeVariation;
         this.yMax = yMax;
         this.yVariation = yVariation;
         this.initSpeed = speed;
         this.lastTime;
         this.firstTime = firstTime;
         this.manager = manager;
         this.timer = timer;
         
         this.nextTime = firstTime;
         
         addChild(ressource); //TODO add as cached bitmap
         this.ressource = ressource;
         
         addEventListener(Event.ADDED_TO_STAGE, added);
      }
      public function added(e:Event):void{
         //this.cacheAsBitmap = true;
         this.visible = false;
         addEventListener(Event.ENTER_FRAME, update);
         ressource.gotoAndStop(1);
         
      }
      public function update(e:Event):void{
         //Calc Speed
         speed = initSpeed * manager.speed;
         //If Object is due to be shown
         if(manager.time > nextTime && !visible){
            nextTime = manager.time + timeMin + timeVariation * Math.random();
            //Place object at the end of the Stage if speed > 0
            if(speed > 0){
               trace(this, 1)
               this.x = stage.stageWidth;
               this.y = yMax - yVariation;
               this.visible = true;
            } else {
               trace(this, 2)
               this.x = -this.width;
               this.y = yMax - yVariation;
               this.visible = true;
            }
         }
         //If Object is shown
         if(visible){
            this.x -= 7;//speed;
         }
         //If Object is out of Stage
         if( (x + width < 0 && speed > 0)  ||  (x > stage.stageWidth && speed < 0) ){
            visible = false;
            ressource.gotoAndStop(Math.floor(ressource.totalFrames * Math.random() + 1));
         }
      }
   }
}

But I don't see something fancy here....
What's "de.mariusheil.easy._root;" ?

Checking your code I don't see you removing these objects after adding them.
Are you adding 2~3 objects and keep moving them for x<0 to x>stageWidth ? And do they immediately come in or do you keep them there?
"de.mariusheil.easy._root;" was just a little trick for me to have access to the main stage out of every class for debugging purpose. I would in my main class set the reference to my timeline and could then out of every class which imports this access _root.myMovieclip,....
I do not want to remove the objects, they are turned invisible as they move out of the stage, then at some given point in time they are repositioned and moved over the stage again.
At the moment they come in nearly immediatly cause the time settings aren't correct, but what I'm trying to achieve is that they slide in at random times but that's not the actual Problem, I got that working quite good. My Problem is that I have not any solution left how I could possibly find out why they aren't moving constantly.
Very odd. But something must be wrong in the code, unless there's some flash ghost haunting your .swf files.
In your first post, how were you checking for their speed? Try this and post the two last traces of x_pos and x_dif.
Code:
// In your var area:
private var x_pos:Array = [stage.stageWidth];
private var x_dif:Array = [0];
// Beginning of update function:
x_pos.push(this.x);
x_dif.push(x_pos[(x_pos.length-1)] - this.x);
trace("x_pos: "+x_pos);
trace("x_dif: "+x_dif);
Just pasted it in my code, same result as mine. x_dif stays 0. I was just outputting coordinates and told excel to calculate the difference 🙂
Code:
x_pos: 2000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,993,986,979,972,965,958,951,944,937,930,923,916,909,902,895,888,881,874,867,860,853,846,839,832,825,818,811,804,797,790,783,776,769,762,755,748,741,734,727,720,713,706,699,692,685,678,671,664,657,650,643,636,629,622,615,608,601,594,587,580,573,566,559,552,545,538,531,524,517,510,503,496,489,482,475,468,461,454,447,440,433,426,419,412,405,398,391,384,377,370,363,356,349,342,335,328,321,314,307,300,293,286,279,272,265,258,251,244,237,230,223,216,209,202,195,188,181,174,167,160,153,146,139,132,125,118,111,104,97,90,83,76,69,62,55,48,41,34,27,20,13,6,-1,-8,-15,-22,-29,-36,-43,-50,-57,-64,-71,-78,-85,-92,-99,-106,-113,-120,-127,-134,-141,-148,-155,-162,-169,-176,-183,-190,-197,-204,-211,-218,-225,-232,-239,-246,-253,-260,-267,-274,-281,-288,-295,-302,-309,-316,-323,-330,-337,-344,-351,-358,-365,-372,-379,-386,-393,-400,-407,-414,-421,-428,-435,-442,-449,-456,-463,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,-470,993,986,979,972,965,958,951,944,937,930,923,916,909,902,895,888,881,874,867,860,853,846,839,832,825,818,811,804,797,790,783,776
x_dif: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0


So the coordinates seem to be fine but I can't grasp how the animation can be so horrible, I've never had this before.
My bad on the x_dif staying 0, should have been:
Code:
x_dif.push(x_pos[(x_pos.length-2)] - this.x);

Well now we know they're moving fine.

Let's try a couple more things 😀
How many objects do you have on stage at the same time?
Try running the movie with only one object.
Try changing your movie's FPS to 1, then test. Yes it's gonna be a pain to wait but you might spot something that's happening.

EDIT: Just found something that sounds similar to your problem:
http://www.actionscript.org/forums/arch ... -1643.html
One of the suggestions was increasing the frame rate, you could try that just to see if it works.
That frame rate thing led me thinking about changing the constant speed from 7 to 10 or 5. I don't really expect this to work, but it doesn't hurt to try right?
The other thread is from 2001, I don't think it has much in common except from the same problem 😀
It were about 3 Objects, but one Object alone does the same.
I already put the framerate at about 60 fps, seems worse to me.
Changing the speed to 10 wouldn't hurt, but if it worked it would hurt very much cause the speed can't be constant. (didn't help)
Changed the framerate to 5 fps, couldn't detect anything.
It seems to be worse every time I compile it, but maybe my eyes are playing tricks on me.

btw: I uploaded the whole source (http://www.funfury.de/up/src.rar) which I stripped to the minimum. The Main class is in questCar.questCarMain. It can be compiled with the test.fla which is also in the zip archive
----
it's freakin me out. The last one I compiled, without doing any changes does work much smoother and very seldomly has glitches....
----
OK, I just did another test in which i calculated the time-difference from frame to frame, here's some log:
Code:
time 17
time 15
time 16
time 16
time 18
time 15
time 18
time 16
time 18
time 15
time 27
time 7
time 14
time 16
time 17
time 15
time 18
time 13
time 18
time 18

No wonder the framerate is jumping as the frames have very different timeslices. One has 27 which the next frame has to redeem. Question! Why??
----
I took a look at the timer I've used to do some calculations, it's timed at 1000/fps. I put a trace statement in the hander function. This is what I got:
Code:
interfering
time 16
time 15
interfering
time 17
interfering
time 13
time 17
interfering
time 16
interfering
time 18
interfering
time 16
interfering

Maybe I've found the little bastard. I'm not shure why I used a timer in the first place but it had its uses back the, I'll swap it for an enter_frame.
----
Bad luck, no change....

Original thread: https://box2d.org/forum/viewtopic.php?t=5139