ActionScript 3.0 :: Flex An EnterFrame-Timer?
Feb 7, 2010
I'm in the final stages of a project, and I am in trouble for not having bigger tests on lower end computers. It's a game, and frame rate may vary for low end computers on certain intensive parts. This creates a de-sync with the Timer class as it counts real seconds, unrelated to the fps.The frame rate is 30. Bugs start to occur on anything <20, specifics don't matter, but I should have expected that. And now I should fix that.
What would you suggest? I could write an enterframe timer class (counts frames, won't go desyncd). This means I'll have many enterframes events (opposing many Timers right now) - is this significant, cpu-wise? How is it in comparison?Btw this occurred to me as I tried the application on my N900, didn't really expect it to run properly but the device's a beast and it did. Everything worked, slowly but worked, except the fact things got out of sync.
View 1 Replies
Similar Posts:
Jan 8, 2011
I have been developing a game using Flex, and used the Timer class to keep the main loop going. However, when I tried using the enterFrame event to do the main loop, there were a few problems. First of all, physics simulation seemed way too fast. Is the enterFrame event called more than once per frame? I set the application's global frame rate to 24, so shouldn't the application set off the event every 1/24 of a second? And the second problem is that when the game runs like this, some MXML components that are added are not shown.
View 2 Replies
Apr 15, 2010
I have a hitTest on an enterFrame event that adds a movieClip.I then want the movie clip to be on a timer that changes it to another movieClip.As you can imagine, there is a conflict because the hitTest always finds the original Mc an so over-rides the timer.I know this is a logic problem but I cant seem to figure it out.I am pretty sure I am thinking about this the wrong way.here is some of the code:
//this is the hitTest
this.addEventListener(Event.ENTER_FRAME,leftPillarHit);
function leftPillarHit(ev:Event):void {
[code].....
View 1 Replies
Dec 3, 2009
Is it true that the timer class uses an enterframe handler to check it's delay?
View 1 Replies
May 23, 2009
I created an full flash template website loading external swf.Lately, I managed to add a fake3D rotation with AS3 and CS4 to this global template with an enterFrame.some of my external swf use a vertical scroller also using an enterframe function base on the x / y position of the mouse, the scroller dont work anymore.Can't an enterframe swf loads another swf with enterframe function?
View 4 Replies
Oct 23, 2009
I have been making a simple aplication and i have a problem i cannot find the solution (neither why it is happening) The thing i want to do is to dynamically add a canvas containing a button to the application and then i want the canvas to be moved from the left side of screen to the right. So i have made the following code
[Code]....
View 1 Replies
Feb 16, 2012
I am working on a very simple game in Flash. I want to make all the animations framerate agnostic, so that I can change the framerate without affecting the flow and speed of the game.I read somewhere that if you want to do that, you simply create a Timer object and attach an event listener to this timer.
What if I have many objects that have to listen to the same timer? See the code to understand what I am trying to do. At this stage nothing breaks, but the event does not fire.Here is the Main class, the one that runs on swf execution:
public class Main extends MovieClip {
private static var _stage:Stage;
private static var _timer:Timer;
[code]....
View 1 Replies
Aug 27, 2008
What is the difference between Timer.stop() and Timer.reset() functions because it seems that the 2 functions do the same thing? I image Timer.stop() to stop the timer and when Timer.start() is called the timer starts from where it stopped. For example, if I have a 3 sec. timer (3000 ms). If I stop the timer after 2.5 sec. and start the timer again, I would expect the timer to expire/trip within .5 sec.
View 1 Replies
Nov 29, 2011
I have a ActionScript 3.0 project and I have a timer that is running on 1000 millisecond intervals. I would like to delay this timer for 1500 milliseconds perform an action and start the timer again after the delay. I thought I could do this easily, but I'm having trouble, would it be better to stop the timer and perform the action and then listen for the action to be completed to start the timer again?
View 1 Replies
Mar 6, 2012
In my case, the timer I make doesn't reduce its time whenever a function is called. What code will I change or add in order to reduce the time in my timer? [code]At this point the timer.start(); is placed on a frame so that the timer starts as it enters the frame.
View 1 Replies
Jul 20, 2011
I have an object in flex - which i want to appear upon a button clicked, disappear after 10 seconds or if the object is closed, and reappear if that same button pressed.[code]
View 1 Replies
Feb 4, 2010
I have a timer event that updates certain things in my app (from a PHP Service) every 5 seconds. Every time this timer ticks, it makes the cursor blink to a clock and then back to the arrow. Since this is happening every 5 seconds, it gets pretty annoying. Is there a way for me to prevent the cursor from changing when the timer ticks?UPDATE: I've figured out a work-around by setting a custom cursor with high priority (I just made a .png with a cursor in it).
View 1 Replies
Jun 28, 2010
I just have a one quick question on Timer and TimerEvent (flash.events.TimerEvent & flash.utils.Timer) of Adobe Flex.I am currently working on a project wherein I need to occasionally change speed, stop and play an swf animation (loaded to a loader and instantiated as a ByteArray).Example, I have a moving car (swf animation) running at 40kph. Then I have a button which will change the speed by increments of 40kph. SO basically, whenever I hit the button, the playing car should change speed by the increment. The difficult part is, I already had this working in Adobe Flex but it doesn't change the speed yet. I mean, it only moves by the keyframe interval I set when I created the swf file on flash (which is, to say, 30 frame interval per keyframe).
So in short, I just need to make the speed change depending on how many increments I asked it to change. A colleague told me to use Timer and TimeEvent of Flex but I can't seem to quite get the hang of it since I'm still new to the ActionScript world.
View 1 Replies
Nov 18, 2010
I have a rollOver event on a pop-up button in flex. I want that the menu is opened on rollover. But if the user accidentally goes with the mouse over the component the menu should not be displayed. So on rollOver I want to start a timer (wait for half second) and than check if the user is still on the pop-up button (rollOut was not fired).
My example code so far:
private function rollOverMenu(event:Event){
rollOutNow = false;
var shortDelay:Timer = new Timer(3000);
[code]...
The Alert "time is up" is never shown, any ideas why my timer event does not work?
View 2 Replies
May 20, 2011
How do I correctly remove/stop a timer in actionscript? do it like in this piece of code but timer has been set to fire frame1SoundTimerHandler in 200 seconds later :
playingScreenFramesObj.myTimer2.stop();
playingScreenFramesObj.myTimer2.removeEventListener(TimerEvent.TIMER, frame1SoundTimerHandler);
[code].....
View 2 Replies
Jan 12, 2012
var timer:Timer = new Timer(x);
basically x is an array...
when timer.start() is invoked
it runs, the first count is 1000 ms, then the second 800 ms, and the third 6200 ms and so on. In other words, it's a dynamic change in the delay and not a continuous delay of x ms.
View 2 Replies
Mar 26, 2011
The document doesn't mention anything about this:[URL]..
View 1 Replies
Jun 18, 2009
I'm in the process of making a game (a shmup) and I've started to question the accuracy of the timers in ActionScript. Sure, they're accurate enough when you want to time things on the order of a few seconds or deciseconds, but it seems to perform pretty poorly when you get to finer ranges. This makes it pretty tough to do things like have a spaceship firing a hundred lasers per second.
In the following sample, I tested how long (on average) the intervals were between 1000 timer ticks intended for 30ms. Time and time again, the results are ~35-36ms. Decreasing the time, I found the floor on the timer delay to be ~16-17ms. This gives me a max fps of ~60, which is great visually but also means I can't possibly fire more than 60 lasers per second :-(. I ran this test a few times at 100 and 1000 loops, but for both the 30ms test and the 1ms test the results didn't change. I print to a textField at the end because using trace() and launching the swf in debug mode seems to negatively affect the test. So what I'm wondering is:
Is this test a decent measure of the Timer class's performance, or are my results questionable? Will these results change dramatically on other machines? I understand this is dependent on the getTimer() method's accuracy, but the discussions I find on this topic usually center around getTimer()'s accuracy on larger intervals.
[CODE]...
View 5 Replies
Aug 20, 2009
Is there any way to scroll Datagrid on timer basis.Let say there are plenty of records which can not be shown in one screen. And the screen is showing the first 10 records. An auto scroll should start after 5 seconds and bring up the next 10 records. Then again after 5 seconds the other 10 records and so on. A kind slide show effect.
View 1 Replies
Sep 27, 2010
Can we use 2 timer events in a single application. I'm trying to use 2 timer events in a single application but the 2nd timer event is not working.... any one have an idea??? how to use 2 timer events in a single application.
View 1 Replies
Mar 23, 2012
I want to change the text in the Alert on timer tick, but nothing changes, see example below:
private var alert:Alert;
private var timer:Timer = new Timer(1000, 0);
private funtion init(){
[code]........
View 2 Replies
Sep 28, 2010
I have programmed a little screensaver for trade event monitors to display throughou t the program.
I will be outputting this as a stand alone flash application, so am not worried about browsers etc. Essentially, all I need is when you click the application, it goes fullscreen automatically
View 1 Replies
Aug 31, 2010
i am moving from AS3 and Java to Expression Blend/WPF, but cant seem to figure out how to replicate EnterFrame event in C#, is there a update() or frameUpdate() function.
View 2 Replies
Jan 26, 2012
I have some stars in my flash file. I want them to dissappear when i get to the final frame. Can I delete the enterFrame? Then how do I make it re appear again?
[Code]...
View 4 Replies
Oct 29, 2009
I have an application in which when i click on a particular tab an HTTPService having id="service" is sent. This service calls a php file which in turn extracts data from a table and return as xml string to Flex. Flex then use DataGrid's dataprovider attribute to show the data in the dataGrid.Can i have a functionality of a timer which will call the HTTPService again and again after each 5 minutes?
View 1 Replies
Nov 22, 2010
private function openAllNodes(event:TimerEvent):void {
//Alert.show(event.target.currentCount);
var index:int =event.target.currentCount - 1;
[Code]....
In my project I want to show the video like growing flex tree. So I tried flex timer based to expand node one by one. But if I open the first node then automatically close second time. If there is any other way to expand nodes one by one then let me know.
View 1 Replies
Mar 5, 2011
Just a quick question about the Timer class of Flex 4. I have a timer object with a set repeatCount. At the end of the set number of cycles, the TIMER_COMPLETE event is triggered and the timer.running changes to false. Now I can call the timer.start() function again. My question is that at this stage, does it also set the repeatCount property back to zero. Or does one have to explicitly call the timer.reset() function.
View 1 Replies
May 20, 2011
How do I access timer.running from inside event handler?
View 1 Replies
Nov 15, 2007
I am working on an eLearning course whereas client requied the course to be keyboard accessible. He wants all the shortcuts with Alt key combination.I can trap the Alt key with the use of enterframe but that makes my course processing heavy so I tried to trap Alt key with keylistener event but unfortunately keylistener event doesn't listen Alt key .how to trap Alt key without using enterframe or interval?
View 1 Replies
May 11, 2011
I coludnt stop the function after n=>5 . I tried removeeventlistener. it didnt work. the code is giving error each time it enters a new frame.[code]...
View 3 Replies