March 4, 2010Danwize
As I was developing a game I needed something to round an integer to the nearest 5. The following function allows you to round a given integer n to the nearest integer f. It’s a very simple Actionscript function, but I it might come in handy.
public function round(n:int, f:int):int
{
[...]
Read More »
Posted in Actionscript in Flash/Flex |
November 11, 2009Danwize
I just happened across this cool feature in Flex while looking for solutions to other problems. It’s called deep linking. It allows you to return to a specific state of a Flex application by including information in the url. Go here to read more about it: http://cookbooks.adobe.com/post_Deep_Linking_in_Flex-9563.html
Read More »
Posted in Actionscript in Flash/Flex |
November 10, 2009Danwize
Are you tired of seeing the yellow focus rectangle in your Flex applications? It’s really easy to get rid of it. All you have to do is this: stage.setFocusRect = false; It’s really that easy. See more info about this property here: http://livedocs.adobe.com/flex/3/langref/flash/display/Stage.html#stageFocusRect
Read More »
Posted in Actionscript in Flash/Flex |
October 13, 2009Danwize
Here is a simple recursive binary search function written in AS3. This is a quick and efficient way to search an array. In the worst case, binary search will take log2(n) steps to finish the search where n is the length of the array. Of course this algorithm only works if the array has been sorted. It [...]
Read More »
Posted in Actionscript in Flash/Flex |