Skip to content

Flash Player Oddities

Mike Welsh edited this page Feb 20, 2020 · 9 revisions

This page is a list of weird behaviors in the official Flash Player that we don't quite understand and require investigation. This also includes behavior that varies between different version of the Flash Player. Spooky! 👻

AVM1

DefineFunction2 preloads registers in wrong order

SWF19 lists that register get preloaded in this order:

this, arguments, super, _root, _parent, _global

The ActionScript compiler also generates code expecting this order.

But the actual order in the Player seems to be:

this, arguments, super, _root, _global, _parent

This means that this code will be compiled incorrectly by Flash:

function f()
{
	trace(_parent);
	trace(_global);
}
f();

traces _global first, then _parent:

[type Object]
undefined

See the define_function2_preload_order test for an example.

NaN == NaN is true

NaN == NaN returns true in AVM1 depending on the version of the Flash Player. Flash Player 6 and below(?) properly returns false. Higher versions return true.

NaN.toString(base) returns garbage for non-decimal bases

NaN.toString(16) returns -(0000000 for example. There are different garbage values for every non-decimal base. Seems like mis-indexing into ASCII table?

This seems to only happen in Flash Player 7? and higher (SWF version irrelevant). Flash Player 6 and below prints 0 for all non-decimal bases.

o is null

trace(o) will print null instead of the expected undefined.

Clone this wiki locally