AssetPaths not finding file



  • I'm having a very beginner level problem right now, but strangely can't seem to find any information online about it. (neither documentation or a forum post) Any help would be really appreciated.

    //code
    tilemap.loadMapFromArray(mapData, 10, 5, AssetPaths.Tile, 32, 32);

    The AssetPaths class can't detect the Tile png file, despite it being in the assets/images folder. I've noticed a AssetPaths.hx file in my root directory, do I have to modify that in some way to access things?



  • I'm a newb to this but I believe it's supposed to be:
    AssetPaths.Tile__png

    Take a look at this tutorial page:



  • Thank you !

    At some point I'd like to put together some sort of resource/tutorial for this engine (which I'm liking more and more right now) Because sometimes I find very simple problems like this and they don't have a go to page - digging around in the starting tutorial is a little unintuitive to say the least.


  • administrators

    Do you not get auto-completion for AssetPaths?



  • Probably super slow auto-complete which takes forever to show. I also experience that



  • @DleanJeans said in AssetPaths not finding file:

    Probably super slow auto-complete which takes forever to show. I also experience that

    Just had another check and yeah this is happening with me as well. (I reckon it was probably the reason behind the issue originally too)



  • If your ide is flashdevelop, you can edit your project.xml file and copy this over top of your <assets...
    <assets path="assets" include="." />
    the [includes="."] is what makes it load the folder content.

    After downgrading to a previous version of some software to get haxeflixel to compile a project, the "include..." needed to be applied.

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    0

  • administrators

    @galoyo That's strange, the include attribute should not be needed.

    Also, the project.xml is present no matter what, doesn't have anything to do with FD.



  • Yes, it is strange as that is the only way i could get assetPaths to display the folders content.

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    0

  • administrators

    AssetPaths does not care about your Project.xml.



  • https://github.com/HaxeFlixel/flixel/issues/1304
    http://community.openfl.org/t/assets-cant-find-my-files/866/2

    both links are saying a similar thing as me. assetPath displays the folder content defined in project as path="assets" the second link said, does not work until that person changed the path. The first link says that there is a connection between assetPaths and project.xml.

    this is all confusing but nevertheless it now works as the way i stated.

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    0


  • @galoyo I read the first link totally differently. The OP there was assuming there was a link, yes, but Gama11 explained there too that there isn't. If you open up AssetPaths.hx in your project's source folder, you should be able to see which directory it's looking in, because it calls the builder macro with it. Mine looks like this (the default):

    package;
    
    @:build(flixel.system.FlxAssets.buildFileReferences("assets", true))
    class AssetPaths {}
    

    And it's that "assets" there that determines what you can find in AssetPaths.

    As for the files themselves actually being present when you build, though...@Gama11 wouldn't they need to be included properly via project.xml? I.e. if your project.xml doesn't refer to "assets" but AssetPaths does, then I would expect that AssetPaths autocompletion would find your assets, but at run-time, the correct-looking paths it had put in your code would refer to things that, on build, had not been copied into bin/export/$platform/assets. Is that correct?


  • administrators

    @IBwWG said in AssetPaths not finding file:

    wouldn't they need to be included properly via project.xml? I.e. if your project.xml doesn't refer to "assets" but AssetPaths does, then I would expect that AssetPaths autocompletion would find your assets, but at run-time, the correct-looking paths it had put in your code would refer to things that, on build, had not been copied into bin/export/$platform/assets. Is that correct?

    That's exactly correct.



  • Sorry, I am still a bit confused... Then why when I put in the <assets path="assets" include="star.star" /> at project.xml that the files within the assets folder displayed in the popup content menu and without the "include" nothing displayed not even the menu? Remember that i was downgrading software and assetsPath stopped working.

    IBwWG, i concluded that at the first link, the author was using a different path and was saying why the new path was not working. I may have misunderstood that message but I did get the idea of the "include" for the assets within the project file.

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    1


  • @galoyo Maybe super-slow autocomplete as was mentioned earlier? How long do you give it?



  • I gave it about two minutes. Maybe it was the result of broken software dependencies because the build stopped working when I was downgrading software. Adding include in the assets at project.xml was most likely a coincidence, considering that the AssetPaths does not use the project.xml as Gama11 stated.

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    0


  • When I downgraded openFl and lime to get them to work with haxeflixel... https://github.com/HaxeFlixel/flixel/issues/1902

    I needed to build the project before executing it for the AssetsPaths to display correctly in flashDevelop ide ;)

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    0

Log in to reply