Quantcast
Channel: upshots » ActionScript 3
Browsing latest articles
Browse All 10 View Live

JS/AS – Cache your RegExp!

In both JavaScript and ActionScript, creating a regular expression – even using literal notation – results in the instantiation of a new RegExp object. If you’re going to use a pattern repeatedly...

View Article



PHP vs JS conditionals and ternary

Just a quick note about how PHP conditional operators differs from ECMA (JS and AS)… The double-pipe ‘OR’ operator, in JS, evaluated to the value of the expression that is not false. In PHP, it...

View Article

Understanding Easing (Explaining Penner’s equations) – JavaScript and...

Despite the commonality of the classic easing equations, largely attributed to Penner, there doesn’t seem to be the in-depth examination of “how it works” that a lot of code is subject to nowadays....

View Article

Cache “nudger”

With web technologies generally, and flash specifically, managing cached assets can sometimes feel like walking a tightrope. If you’ve got a simple slideshow and have occasional updates to the image...

View Article

ActionScript – using the Factory Pattern for Display Objects (ViewFactory)

Instantiating a Display Object is a fairly heavy lift. Usually this is negligible, but when dealing with particle or fluid effects, it can add up. Here’s one implementation of the Factory pattern used...

View Article


JavaScript – separate (split) array

I often have a list from the server that I need to split into 2 separate arrays. For example, all options that are enabled and all that are not. Here’s a little extension to handle that. Takes a single...

View Article

JavaScript – splice array on multiple indices (multisplice)

Managing multiple splices in a loop can get confusing, as the position of each element changes after each splice operation. Here’s a little extension to help manage that: ​Array.prototype.multisplice =...

View Article

JavaScript – remove multiple elements from an array

While you can always .filter() an array to remove unwanted elements, here’s a little sugar to remove all elements that evaluate truthily when compared to any argument passed: Array.prototype.remove =...

View Article


jQuery (or anything else) basics of dragging

Here’s the most basic implementation of dragging I’m aware of… I’ll present an example usin jQuery, but the same logic can be used in any JS framework, raw JS, or even ActionScript, Java, or any other...

View Article


Wrapping / Looping / Infinite Array Traversal

I’ll use JavaScript syntax and provide a JS fiddle POC, but this really applies to almost any language – at least any that use indexed arrays (all that I can think of). To get an index greater than...

View Article
Browsing latest articles
Browse All 10 View Live


Latest Images