Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Panagiotis Halatsako |
I am trying to make a simple quiz game (godot v3.2.1 stable) with some jpeg photos located in res://photos/
I have used the following code to get the images to a var called movie_titles (it’s a movie quiz!):
func dir_contents(path):
JavaScript.eval("console.log('reading from path:"+path+"')")
var dir = Directory.new()
if dir.open(path) == OK:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
if dir.current_is_dir():
#print("Found directory: " + file_name)
pass
else:
#print("Found file: " + (path+file_name).get_extension())
if (path+file_name).get_extension() == "jpg":
JavaScript.eval("console.log('"+path+file_name+"')")
movie_titles.append(path+file_name)
file_name = dir.get_next()
else:
print("An error occurred when trying to access the path.")
JavaScript.eval("console.log('An error occurred when trying to access the path.')")
emit_signal("titles_read")
My problem is that when I export this to html5 I get that the size of the movie_titles is 0.
I get this both from the built in test webserver and in python3’s web server. Is there something I need to do to html5 export?