Did you add a trace message into SWFLiteLibrary
(near the IOErrorEvent dispatch) to see whether that is the IOErrorEvent that is being dispatched, or if it is a different one?
Yes, it’s IOErrorEvent from SWFLiteLibrary being called
I added this in SWFLiteLibrary
var path = (rootPath != null && rootPath != "") ? rootPath + "/" + id : id;
trace("loading library : " + path);
var loader = new URLLoader ();
loader.addEventListener (Event.COMPLETE, function (_) onComplete (loader.data));
loader.addEventListener (IOErrorEvent.IO_ERROR, function (e) {
trace("loader error " + e);
promise.error (e);
});
loader.load (new URLRequest (path));
And this is what I get now in Tizen log
[lime.app.Preloader] Preloading asset library NyanCat.js:32695
SWFLiteLibrary.hx:227: loading library : lib/library/library.txt NyanCat.js:5878
[lime.app.Preloader] Preloading asset library NyanCat.js:32695
[lime.app.Preloader] Loaded asset library [1/2] NyanCat.js:32695
SWFLiteLibrary.hx:231: loader error [IOErrorEvent type="ioError" bubbles=true cancelable=false text="0" errorID=0] NyanCat.js:5878
Error: [lime.app.Preloader] ERROR: [IOErrorEvent type="ioError" bubbles=true cancelable=false text="0" errorID=0] NyanCat.js:32676
Hmm, and if you embed="false"
it does not work either?
Perhaps setting it to embed makes it not generate this file, and SWFLiteLibrary
has a minor bug here where it does not handle an embedded version (and instead tries to load from disk, which is the default case)
If it still does not allow *.txt, perhaps *.json would work (even though the file is not actually JSON)
This is what I get if I set embed=“false”
lime.app.Preloader] Preloading asset library NyanCat.js:32698
[lime.app.Preloader] Loaded asset library [1/2] NyanCat.js:32698
[lime.app.Preloader] Preloading asset library: library NyanCat.js:32698
Error: [lime.app.Preloader] ERROR: There is no asset library with an ID of "library" NyanCat.js:32679
Do I need generate=“true”?
I’ll try json file trick
changing data to json while the content is not json generates error while building the project
Description Resource Path Location Type
JSON should begin with { or [ library.json /NyanCat/lib/library Unknown Validation Marker
I tried changing data file extension to *.a, and it’s still generating same error
[lime.app.Preloader] Preloading asset library NyanCat.js:32162
SWFLiteLibrary.hx:227: loading library : lib/library/library.a NyanCat.js:5345
[lime.app.Preloader] Preloading asset library NyanCat.js:32162
[lime.app.Preloader] Loaded asset library [1/2] NyanCat.js:32162
SWFLiteLibrary.hx:231: loader error [IOErrorEvent type="ioError" bubbles=true cancelable=false text="0" errorID=0] NyanCat.js:5345
Error: [lime.app.Preloader] ERROR: [IOErrorEvent type="ioError" bubbles=true cancelable=false text="0" errorID=0] NyanCat.js:32143
So I think, there is no problem with file extension here
I did another test here – embed="true"
did work normally. (I’m not testing on Tizen at the moment)
I believe it hits the if (Assets.exists (id))
case in SWFLiteLibrary, so it never falls down to the
URLLoader` case
embed=“true” always works on browsers like chrome, etc I think, that’s why it’s confusing me why it doesn’t work on Tizen, which is just a wrapper of html5 version of the game
I don’t think the problem lies in if (Assets.exists (id)) , because the log reports that library.txt is already loaded, then URLLoader throws that ioerrorevent message. is there something to do with deserializing library.txt or when it tries to load assets defined in library.txt
How do you do a Tizen application, based on HTML5?
yes, there is 2 ways to create tizen app : native app (based on C++) and mobile web app which is just a wrapper of html5 web app.
what does embed=“true” mean in project.xml?
- does it embed our assets into an asset file and can be loaded without URLLoader or
- just add the file into the project which will be loaded later using URLLoader.
because I check in chrome with embed=“true” for my swf library, it always trigger the URLLoader to load library.txt
edit : this is the complete logs of assets with what library contents list that have been loaded
chrome version
https://pastebin.com/nc992y8J
tizen version
https://pastebin.com/y1hiZW6Y
why is it preloading an empty library? Is it a bug?
the highlight from the log is
Log.hx:96 [lime.app.Preloader] Loaded asset library [1/2]{
types : {
h : {
}
},
sizes : {
h : {
}
},
preload : {
h : {
}
},
paths : {
h : {
}
},
pathGroups : {
h : {
}
},
classTypes : {
h : {
}
},
cachedText : {
h : {
}
},
cachedImages : {
h : {
}
},
cachedFonts : {
h : {
}
},
cachedBytes : {
h : {
}
},
cachedAudioBuffers : {
h : {
}
},
onChange : {
canceled : false,
__listeners : [<function>],
__priorities : [0],
__repeat : [true]
},
bytesLoaded : 0,
bytesTotal : 0,
promise : {
future : {
isComplete : true,
value : {
types : {
h : <...>
},
sizes : {
h : <...>
},
preload : {
h : <...>
},
paths : {
h : <...>
},
pathGroups : {
h : <...>
},
classTypes : {
h : <...>
},
cachedText : {
h : <...>
},
cachedImages : {
h : <...>
},
cachedFonts : {
h : <...>
},
cachedBytes : {
h : <...>
},
cachedAudioBuffers : {
h : <...>
},
onChange : {
canceled : <...>,
__listeners : <...>,
__priorities : <...>,
__repeat : <...>
},
bytesLoaded : 0,
bytesTotal : 0,
promise : {
future : <...>
},
bytesLoadedCache : {
h : <...>
},
assetsLoaded : 1,
assetsTotal : 1,
loaded : true
},
__progressListeners : [<function>]
}
},
bytesLoadedCache : {
h : {
}
},
assetsLoaded : 1,
assetsTotal : 1,
loaded : true
}
I think I narrowed down the problem, my main suspect is the error happened when it tries to load lib/library/library.txt.
It somehow throws an error before loading is finished for I don’t know what the reason is can we save the data in json format or even simpler just a string without being serialized?
Great news
Here’s the fix:
I updated my Z1 to Tizen 2.4, successfully got BasicUI running on it (installing the Samsung Extension in the package manager as well as the “Permit to install applications” option in the Connection Explorer were non-obvious, however), and got NyanCat running inside instead of the standard content.
It returns HTTP status 0 when it loads the file, which we assumed was an error (since it is not between status 200 and 400)
If you patch your local Lime install with this fix, I believe it should work for you as well
you’re the best!
with this I can confirm that openfl runs on tizen with html5 build. Congratulations!
Can we release a minor version fix for this so I don’t have to use the git version ?
performance is still not good though, but we can continue improving it
Also, try -Dcanvas
, it might perform better than WebGL on the device
music is still not working, is it still on to do list? is there workaround for playing music?
I believe I heard sound in the PiratePig sample. Do you have MP3, WAV and OGG files (with the same file name, different file extension) for each sound you wish to use?
Sound is not supported from SWFs at the moment, but should work from openfl.utils.Assets
never mind it’s working now, just have some issue with uninitialized variable in javascript which is treated as null.