Adobe-Runtime-Support
Adobe-Runtime-Support copied to clipboard
trace(Screen.mainScreen.mode) cause ReferenceError
Problem Description
trace(Screen.mainScreen.mode) cause ReferenceError: Error #1069: Property toString not found on flash.display.ScreenMode and there is no default value..
It has been tested with multiple AIR versions, even with latest AIR 50.0.0.1 with multiple Windows and Linux devices with different AIR applications. Same problem in all cases.
Related feature request: https://github.com/airsdk/Adobe-Runtime-Support/issues/1879
Steps to Reproduce
Launch code below. Application example with sources attached. trace_screen_mode_bug.zip
trace(Screen.mainScreen.mode);
Actual Result: Error:
ReferenceError: Error #1069: Property toString not found on flash.display.ScreenMode and there is no default value.
at global/trace()
Expected Result:
You will see in traces: [ScreenMode]
Known Workarounds
Do not trace ScreenMode objects.
Curious one, thanks for pointing it out. Turns out the "prototype pointer" wasn't being set in the ScreenMode class constructor.. See e.g. where this is done for a Dictionary object (for our future reference, I suspect there may be other classes with this omission!)
Fixed with latest AIR 50.0.1.1. Thanks!