@:bind Seems to not be working

44 views
Skip to first unread message

Philip Stachowski

unread,
Sep 14, 2014, 9:51:52 AM9/14/14
to haxe...@googlegroups.com
Hi,

I'm attempting to prove out a migration strategy for moving an existing AS3 codebase to Haxe, one class at a time. I found the @:bind metatag to be used as a hint to the compiler to use a hx version of a class instead of one that resides in a swc, but it doesn't seem to be working. It looks to me like the compiler support of this tag hasn't been touched since 2011, so my assumption is it hasn't been tested in a while. fponticelli was helping me with the problem on IRC, and told me there are no unit tests for this tag. I've put together a small test case that illustrates the problem.

I have an as3 class that draws a red square. I have a hx class that draws a blue square, annotated with @:bind. I compile the as3 class into a swc, then compile the hx source against it. They resulting swf draws a red square.

Any help would be appreciated!

- Philip

PS - Thanks to fponticelli for the help last night, and for pointing me to this group!
Haxe-Test.zip

Simon Krajewski

unread,
Sep 14, 2014, 10:31:36 AM9/14/14
to haxe...@googlegroups.com
From what I gather the problem comes from the -swf-lib being a .swc. Haxe checks for TF9Classes, but that only has flash.display.Sprite as entry for this file. It then does not find the duplicate and @:bind is never applied.

Unfortunately that's where my Flash knowledge ends. Does this mean we have to parse the catalog.xml to find the symbols or what?

Simon

Philip Stachowski

unread,
Sep 14, 2014, 10:33:37 AM9/14/14
to haxe...@googlegroups.com
Simn is helping me in IRC, and I'm attaching a SWF (instead of a SWC) built from the same code.

- Philip
as3.swf

Simon Krajewski

unread,
Sep 14, 2014, 10:45:07 AM9/14/14
to haxe...@googlegroups.com
Am 14.09.2014 16:33, schrieb Philip Stachowski:
> Simn is helping me in IRC, and I'm attaching a SWF (instead of a SWC)
> built from the same code.

Well I was partially correct, but it's not related to SWF or SWC. The
new one doesn't list test.ColoredShape as symbol either, so it is again
not found.

Simon

Philip Stachowski

unread,
Sep 14, 2014, 1:32:08 PM9/14/14
to haxe...@googlegroups.com
It looks like the compiler was iterating the classes listed in the SymbolClass tag to check for duplicates. Simon changed it to check the DoABC tag instead so the class doesn't have to be a symbol.


That resolved the issue for the test case I uploaded!

Philip Stachowski

unread,
Sep 14, 2014, 3:05:37 PM9/14/14
to haxe...@googlegroups.com
Okay, I've hit another snag. With the compiler changes from above, I'm now getting a VerifyError when finding a base class.

I have a RedShape and a BlueShape that extend ColoredShapeBase, in as3. I've bound in haxe versions of BlueShape and ColoredShapeBase.

VerifyError: Error #1014: Class test::ColoredShapeBase could not be found.


I'm attaching another unit test, and images for what the test should look like for as3-only, and what it should look like for Haxe.


Haxe-Test-Inheritance.zip
flash-test-inheritance.jpg
haxe-test-inheritance.jpg
Reply all
Reply to author
Forward
0 new messages