I’m getting the following compile errors on targets other than flash for the “loader.loadBytes(bytes, loaderContext);” line in the following code:
var loaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loaderContext.allowCodeImport = true;
var loader: Loader = new Loader();
var req = new URLRequest(url);
var urlLoader = new URLLoader(req);
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.addEventListener(Event.COMPLETE, function(event: Event) {
var bytes: ByteArray = getEventData(event);
loader.loadBytes(bytes, loaderContext);
});
Too many arguments
Function ‘loadBytes’ requires arguments : buffer
This compiles and runs for the flash target. E.g. this gets the error:
Thanks for the quick response!
I updated openfl and lime
haxelib update openfl
haxelib update lime
and now I get this compile error:
$ openfl test flash
/usr/lib/haxe/lib/openfl/3,5,3/extern/flash/display3D/Context3D.hx:62: characters 54-123 : Class not found : flash.display3D.textures.VideoTexture
and this for neko:
$ openfl test neko
/usr/lib/haxe/lib/openfl/3,5,3/openfl/utils/ByteArray.hx:118: characters 9-59 : openfl.utils.ByteArrayData should be openfl.utils.ByteArray
I’m guessing I did not do the update properly or completely, any help appreciated!
I have some more issues that I’m guessing are a problem with updating libraries, but I did
$ openfl upgrade
openfl is up to date
lime is up to date
hxcpp is up to date
lime-samples is up to date
openfl-samples is up to date
actuate is up to date
box2d is up to date
layout is up to date
swf is up to date
and
$ haxe -version
3.2.1
I’m working on loading a swf asset at runtime and getting these compile errors:
$ openfl test flash
/usr/lib/haxelib/swf/2,1,6/format/swf/SWFData.hx:872: characters 17-25 : format.swf.utils.BitArray has no field get
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:15: characters 18-26 : format.swf.utils.BitArray has no field get
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:62: characters 4-12 : format.swf.utils.BitArray has no field set
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:62: characters 28-36 : format.swf.utils.BitArray has no field get
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:66: characters 4-12 : format.swf.utils.BitArray has no field set
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:66: characters 28-36 : format.swf.utils.BitArray has no field get
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:70: characters 4-12 : format.swf.utils.BitArray has no field set
/usr/lib/haxelib/swf/2,1,6/format/swf/utils/BitArray.hx:70: characters 28-36 : format.swf.utils.BitArray has no field get
/usr/lib/haxelib/swf/2,1,6/format/swf/SWFData.hx:310: characters 9-17 : format.swf.utils.BitArray has no field get
Any help on what I might be doing wrong appreciated!
fwiw, I tried cloning the swf repo and using that - get the same errors
Also, my ultimate goal is to see if I can load an asset swf in HTML5 (for desktop browser). I’m trying to compile for flash here because I’m assuming that will be the most likely to work.
I got the line generating the compile errors from this post:
this line:
var swf = new format.SWF (bytes);
If I comment it out, I don’t get the compile errors I listed earlier in this thread.
I’ve been looking for a way to load a swf at runtime outside the flash target, and I thought this was supposed to create a swf object from a loaded byteArray… We don’t have any bytecode in the swfs to be loaded
That’s “swf”, “swflite” works at compile-time only right now, but that’s what HTML5 relies upon. I think we could do more to allow for “swflite” loading at runtime, but that’s the key you need for all targets outside Flash
So by loading at runtime, this means loading swf data that was incorporated at compile time?
This area is very confusing, and in researching it, I’ve found a lot of other people who are similarly confused.
Would you say it is worth pursuing to attempt to load a swf at runtime that only has graphic assets (no bytecode or even sound) for an HTML5 target? Or is there an OpenFl way to convert a swf to assets that are more amenable to loading in an HTML5 target?
Compiling with “swflite” pre-digests the SWF into a new format that’s more suitable for HTML5. In practice, this is now something we could load at runtime – and we do. The trick is just working out the tooling for pre-generating the SWFLite output, then fetching it at runtime on a server
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:15: characters 18-26 : format.swf.utils.BitArray has no field get
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:62: characters 4-12 : format.swf.utils.BitArray has no field set
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:62: characters 28-36 : format.swf.utils.BitArray has no field get
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:66: characters 4-12 : format.swf.utils.BitArray has no field set
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:66: characters 28-36 : format.swf.utils.BitArray has no field get
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:70: characters 4-12 : format.swf.utils.BitArray has no field set
H:/haxelibs/lib/swf/2,2,0/format/swf/utils/BitArray.hx:70: characters 28-36 : format.swf.utils.BitArray has no field get
H:/haxelibs/lib/swf/2,2,0/format/swf/SWFData.hx:310: characters 9-17 : format.swf.utils.BitArray has no field get
H:/haxelibs/lib/swf/2,2,0/format/swf/SWFData.hx:872: characters 17-25 : format.swf.utils.BitArray has no field get