[swf target] Override class used in -swf-lib

54 views
Skip to first unread message

tecteun

unread,
Mar 13, 2013, 9:35:39 AM3/13/13
to haxe...@googlegroups.com
Can I override a class defined in a static linked swf?

I tried using @:bind on the class that should be used.

Example:
foo.swf defines -> class foo.Bar{ public new(){ trace(1); } }

swf project inludes foo.swf with -swf-lib ./foo.swf and also has a redefined foo.Bar{ public new(){ trace(2); } }

The output swf never includes the redefined foo.Bar class.

With flex this way of overriding library classes is normal, anybody know if this is also possible with Haxe?

Jan_Flanders

unread,
Mar 13, 2013, 10:08:48 AM3/13/13
to haxe...@googlegroups.com
Hi,

@:bind only works when the class that you are 'overriding' is listed in a SymbolClass tag in the swf lib (which is usually only the case for classes linked to exported assets).
Compiling foo.swf to foo.swc instead would also make the class being listed in a SymbolClass tag. If foo.swc is an option (not so when you need the stage/timeline of the swf lib) you can try it that way.

Jan

tecteun

unread,
Mar 13, 2013, 11:40:51 AM3/13/13
to haxe...@googlegroups.com
The case is that I dont' want to recompile the original library. So I tried to use hxswfml to create a SymbolClass for the necessary class - very ugly, and didn't work ;) -. 

I know that there are other ways to override code in a static library, still, I think its strange that hx project code does not overrule the as3 static linked code - I believe its always desirable that user code overrides linked libraries, which is, correct me if i'm wrong, the case for pure haxe projects.

All in all I'm starting to believe that is bug in the swf compiler backend...


Baluta Cristian

unread,
Mar 14, 2013, 3:27:25 AM3/14/13
to haxe...@googlegroups.com
Maybe if you put the -cp to your sources before the -swf-lib works?




--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Băluță Cristian
http://ralcr.com
http://imagin.ro

tecteun

unread,
Mar 18, 2013, 7:42:13 AM3/18/13
to haxe...@googlegroups.com
According to this old thread, this actually was working once.

Reply all
Reply to author
Forward
0 new messages