2 Replies Latest reply on Jun 3, 2009 3:42 AM by Sreelash

    Dynamic frame rate settings

    Sreelash Level 1


                Actually I am working in an image scroller project. It was working perfectly. But the client asked to do some updations. First of all please download the file that I have atached, which is a screen shot of user control page for image scroller. There is an user control page for image scroller. You can see many options there. In user control, scroller is specified as marquee scroller. There is an option, Speed of scroller, which denotes how quickly the image should scroll. The unit of this field is seconds. Because we are giving seconds in that field. A single image should move out of the stage with in the specified seconds in "speed of scroller" field.

                Before the new updations suggested by Client, we were giving a value of 0-15 in the Speed of scroller field. The calculation used for the scrolling of image is given follow:


                var UnitDistPerSec:Number = Number(TransSpeed)*10;          where "TransSpeed" denotes the speed we are given in the user control page. 
                var FPS = 100;
                var ScrlConst = UnitDistPerSec/FPS;


                this._x+=ScrlConst;     This statement is given inside an onEnterFrame() method.


      But I tried to implement the new suggestion made by Client using the formula (speed = distance / time). Thus a gap is occuring between each images, when speed increases. I don't whether it is possible to implement using this formula. Hope an issue of frame rate will be there while using this idea. Can anybody help to solve this problem. Because of this problem, other updations are also not working properly. Hope, you can understand all these information. If you are not able to understand whats I given in this thread, please tell me. Don't avoid this one. Because  have to implement with in 2 days. I ll give you more details about the project for you, if you have any doubts regarding my thread.



        • 1. Re: Dynamic frame rate settings
          RossRitchey Level 4

          The scroller doesn't load on the page you linked.  I get a moniker "No Image" instead.


          What parts of the code you pasted are original (working) and what parts are from your update?

          • 2. Re: Dynamic frame rate settings
            Sreelash Level 1



                      var UnitDistPerSec:Number = Number(TransSpeed)*10;   where "TransSpeed" (1 -15)  denotes the speed we were given in the user control page
                      var FPS = 100;
                      var ScrlConst = UnitDistPerSec/FPS;




                              I was using the above code just  for the scrolling the loaded images on stage. Since the client suggested to move the images according to the seconds specified, I tried to make some calculations. Thus some gap was existing between images. Since that code was not working properly I removed it. Then I specified some hard coded value for "ScrlConst" variable for each seconds. Eventhough some gap exist for 1,2 and 3 seconds. The value that I hardcoded for ScrlConst is given below:


                      if(TransSpeed >=13 && TransSpeed <=15){
                            ScrlConst = .8;
                        }else if(TransSpeed >=10 && TransSpeed <=12){
                            ScrlConst = 1.5;
                        }else if(TransSpeed >6 && TransSpeed <=9){
                            ScrlConst = 2.4;
                        }else if(TransSpeed ==5 || TransSpeed ==6){
                            ScrlConst = 3.1;
                        }else if(TransSpeed ==4){
                            ScrlConst = 3.4;
                        }else if(TransSpeed >=1 && TransSpeed <=3){
                            ScrlConst = 14.5;
                        }else if(TransSpeed ==0 ){
                            ScrlConst = 0;


            where "TransSpeed" specifies the seconds (1 - 15).


            Hope you understood what I meant.