As I understand, getTimer() is very inaccurate - on my own machine it always returns a value which is a product of ~16. (16, 33, 50, etc.) Is there a simple and efficient way to more accurately measure the time difference (delta) between two separate calls in my program?
I have looked everywhere for an example or tutorial on a delta time game loop in AS3. I found many fixed time step examples but very little helpful information on delta time game loops and how it works. I have seen examples that do the calculations in a timer and also seen examples that do the calculations inside the enter_frame event. All the examples I have seen are also incomplete and only provided me with bits and pieces.
I have a simple silverlight page for for finding available domain names. This problem is equaly valid for a flash control as well.
I use Google Analytics for monitoring the traffic. I would like to find out how long it take for users to download and render the Silverlight control.
Once the java script on a page is loaded there should be a way to start a timer and then stop the timer once the Silverlight/flash control is loaded. Key points I would like to measure are:
Time it takes to download the silverlight/flash control Time it takes to initialize the control
I have a sound clip running in flash and I want to jump to the next frame after a certain amount of time. Unfortunately it is not always the same time span. How can I measure the elapsed time and call a function accordingly? For example: after 17 second go to frame x, then after 25 seconds go to frame y, etc. until the end of the sound clip (2 min 50 sec.) Each frame holds an individual animation that is related to the current sound.
I am having some trouble with MOUSE_WHEEL delta values. It seems like the event doesn't fire unless I REALLY spin the dammed wheel. Which makes sense because the only values I get range from 3-30. I was hoping to catch 1-3 as well because if I just spin a few notches, nothing triggers and the app feels sluggish.FYI every other program on my machine feels those 1-notch spins just fine so it's not the mouse.Will AS3 not fire if the delta is less than 3?Here is the code
private function handleMouseWheel(e:MouseEvent):void { trace(e.delta); // Output is always more/less than +/- 3 [code].....
I have a container with masked bitmap in it. The scale and rotation of this container changes at runtime, and I need to draw the masked bitmap but cannot figure out the appropriate matrix calculations to do so.My code works correctly to reflect position, scale, offset for centering without rotation. When rotated, the angle is correct but the positioning is incorrect - I believe because the dimensions change when the rectangle is rotated.how to compensate for this in the positioning - here is some code:
// Adjust the transformation matrix to account for the position of the container var tMatrix:Matrix = _imgContainer.transform.matrix; //Offset for container
I have a textarea where I measure the textWidth and textHeight to make sure the user cannot enter more text than can fit in the text area. I also extended the textArea with a textHeightNow and textWidthNow that measure the textField's dimensions since they update w/out requiring validation. Now this works great for 90% of the embedded fonts I'm using but any fonts that have giant serifs are not measured properly, for instance look at the 'f's in this text area:You can see they get cut off on both sides because textWidth and textWidthNow both return an incorrect size not taking into account the massive serifs.
I have an embedable widget. For each impression, I would like to track the referrer (the page where the widget is embedded onto). Right now I am using ExternalInterface to use javascript to check window.location.href when its available, however, I am finding that most of the time I am unable to set the referrer.
I not using javascript correctly to get the referrer?
How to match substrings accurately?eg: I wanted to search whether any pronouns like he, she etc are present in a string say input.Where is he?Here I wanted to find whether the pronoun 'he' is present. But since the where contains the substring 'he' I can't get the result properly.I tried with RegExp and arrays and strings; using match(), search() indexOf(). They all do it the same way.My RegExp pattern is as below:
Code: var pronouns:RegExp = /(i)|(me)|(us)|(he)|(him)|(she)|(her)|(it)|(they)|(them)|(that)/;
I wanted to find for eg, strings like
He is alright Where is he She is there Who is it I know them
In the above sentences I wanted to get the position of where the pronouns 'he' 'she' 'it' 'them' etc occurs.Why because if it occurs I wanted it to replace them with another words.
I'm using mx.rpc.http.HTTPService to retrieve data from a web service. On the initial call to "loadWsData", HTTPService accurately retrieves all the data. However, on any and all subsequent calls HTTPService does not accurately retrieve the data; rather it some how always retrieves the first data set. I've confirmed that the web service is providing accurate data, both from web browsers and a ruby ws client script. If I terminate the flex app and restart it, it will retrieve the accurate data.
ActionScript Code: private function loadWsData():void{ var webService:HTTPService = new HTTPService(); webService.url = serviceUrl; webService.method = "GET"; webService.addEventListener(ResultEvent.RESULT, function(event:ResultEvent):void{ var rawData:String = String(event.result); var user:Object = JSON.decode(rawData).user;}); webService.send();}
I'm learning AS3 as I modernize the VCR controls for our e-learning topics. The way we used to do it was load the wav into the timeline and keyframe to the audio. We have a little tracker bar you can click on to jump around, a tracker icon you can drag, play/pause and FF/RW buttons. In AS2, since the wav was in the timeline, I just had to worry about frame numbers.
It seems like the modern way to do it is to load the audio as an MP3 externally. How accurate will this be as far as sync'ing the audio to the animation when using the tracker bar and jumping around? I'll basically be mathematically slicing the bar graphic into pieces and using that to tell the animation what frame to start on, and converting that to a time for the audio to start.
As a test, I'm loading images (or references to images, more accurately) from an external XML file into Flash, each image representing where a thumbnail might appear in a portfolio, for example. I can get that to work fine. I have a couple of problems with the way the images appear, though. For one thing, when the 95 px X 95 px images are brought into the dynamically created 100 px X 100 px movieclips I have set for them, the JPGs stretch to fit... is this because I'm using the loadMovie method? The main difficulty I have, though, is my inability to get these individual movieclips containing JPG images to exhibit rollover and rollout behavior dynamically... without disturbing the image contained within.
Here's the code I have right now; my lame attempt at a dynamic rollover behavior is the for.. loop at the bottom, which is non-functional, by the way. Code: function loadXML(loaded) { if (loaded) { //according to "content2.xml," this would set the parser at "<projects>". xmlNode = this.firstChild; var thumbs:Array = new Array; var description:Array = new Array; [Code] .....
how to measure the actual size of the container just like the Flex components. I wanna create some containers with my own layout arithmatic, so I must know the size of every child, but sometimes I don't know what's the size which DisplayObject or DisplayObjectContainer that I will add to the container actually is, how can I do?
I was woundering is it possible to measure the length of lines that are drawn with scripts such as these? The ones where you can draw with the mouse? [URL]
I have two artworks on stage which have a common shape within the artwork. I need to make the one I have just added to stage fit the prior one by getting that common shape the same size for both. In Freehand I would drag the junction of the two rulers out onto stage to the left edge of the item, to create a zero point from which to take a measurement. I would drag a guide out to the right edge and read from the info panel an x value, thats my width, or double click the guide to get a reading from the guides palette. Repeat that for the other artwork then get a calculator and divide one measurement by the other to work out the scaling factor I need.
How in CS5 Flash does one place a ruler zero point on stage ? I can drag guides out, but how do I make the left hand guide to be zero ?
I have a function that is made up of two main parts (I'll call them A and B). Part B needs to run when part A is fully done with its layout changes. However, there is no "part A is done" signal, and thus I've been calling a validateNow() before part B runs. This works but seems awfully inefficient - was wondering if there are any other tricks to force an immediate measure or something along those lines or if I'm stuck.
Is there a way to measure the average time it takes my code to run and each frame to render for my Flex app? More specifically, I know how to use getTimer() but I'm not sure about which events I should listen to in order to do this. I was reading this post and am not sure how you'd figure out how long the actual rendering took (it would seem like it may be the time between the RENDER event fires and the next ENTER_FRAME event fires, but I'm not sure). Also, not exactly sure where the user code happens, or whether I should care about EXIT_FRAME and FRAME_CONSTRUCTED. [code]...
I am trying to compare the performance of several different algorithms. So created several functions each of them implementing different approach of solving the same task.What was thinking to do is to create 2 Date objects before and after the function runs, and to compare them afterwords.
The program croaks when measureContentArea (in package mx.containers.utilityClasses, file CanvasLayout.as ) loops through the target's children from 0 to target.numChildren. When the program errors: n == 1, i == 0, and target.numChildren is now 0, when it was 1 before the loop. target.numChildren has changed while the loop is running. It's as if a child was removed by some side effect of calls in the loop.
This happens even when I have many IOComponents on the screen: Here This baffles me because I don't see how I can debug it. I do add and remove and insert children in my game code, but unless ActionScript is threaded I don't see how my code can reach into a loop in CanvasLayout.as .
Any simple way of measuring how long a button has been pressed for - had a look at gettimer but this seems to be an odd way of doing things - basically I want to say onclick start timing - offclick end timing var time = time button was pressed!
I'm using a List control. In the renderer of the List control I've got a Repeater. Each Repeater can have a different number of items. Adding to the complexity, one of the components being repeated in the repeater is a Text control that has long text that will wrap, increasing it's height. I need to expand the height of the List completely so that there's no vertical scrollbar. How can I do this?
I tried an extremely dirty attempt at calculating the Lists height based on the data source. From the data source I can figure out the number of repeater items and the number of items in each repeater in the List's renderer. But there's no way to compensate for the wrapping of the text in the Text control.
I am working on a site that has a clock but it displays in military time, is there a way to change it to regular time. The following is the Action script: