P
P
Porcelain2014-05-28 19:04:31
ActionScript
Porcelain, 2014-05-28 19:04:31

Various virtual machine results with/without object type casting (AIR 4.0)

Given: Flash Builder 4.7, AIR 4.0

var customLayout:ILayout;
customLayout = new HorizontalLayout();
(customLayout as HorizontalLayout).gap = 222;
customLayout.gap = 222;

Question:
How did it happen that line 3 was executed, and an error appeared on line 4:
ReferenceError: Error #1056: Cannot create property gap on feathers.layout.HorizontalLayout.

Additional information:
The HorizontalLayout class and the ILayout interface are part of the Feathers framework .
HorizontalLayout: code , api
ILayout: code , api
gap is a getter/setter of the HorizontalLayout class; not included in the ILayout interface.
The customLayout variable was created normally, it contains an instance of the HorizontalLayout class:
6d27804067.png
No compilation error occurred (and in my opinion it should), a screenshot from the working debug mode of Flash Builder.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EjIlay, 2014-10-15
@EjIlay

You can try to disassemble the swif file and see what actually happens after compilation. or look at the bytecode, if there is enough qualification. In any case, it looks very much like a compiler glitch.
And a long time ago I switched to using IntelliJ IDEA and a separately downloaded SDK in order to get away from such problems, because in "one_huge_project" such miracles in the flashbuilder began to climb through the line.
I suspect that these problems are related to the launch settings of the Java machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question