03-11-2011 02:40 PM
What I'm having trouble with is the path.
I have tried
navigateToURL(new URLRequest("file:// " + File.applicationStorageDirectory.nativePath + "rules.html"));I have tried adding extra slashes, I've also tried File.applicationDirectory.nativePath, but nothing seems to work, even after I went through all the relevant threads.
03-11-2011 02:53 PM
03-11-2011 03:00 PM
navigateToURL(new URLRequest("file://app-storage/rules.html"));
did not work either
I have the .html file in the bin-debug folder, src folder, and the main project folder just in case. But it still not working! arggg!
03-11-2011 03:02 PM
Is the rules.html physically there? Is it in the BAR file?
03-11-2011 03:11 PM
I simply have the .html file residing in those directories, just as all my other files (such as images) that I use in the game. Do I have to somehow explicitly add it to the .bar file? Excuse my ignorance, I am fairly new to this.
Thank you!
03-11-2011 03:19 PM - edited 03-11-2011 03:19 PM
The application storage directory is a runtime directory for the app. So either you need to create the file in the application and saved it there, or during initial run, you moved it there. The runtime environment has no knowledge of a /src directory.
Go to the application storage directory and copy the rules.html in there to get the UI to work (getting the URL correct). If that works, then you will need to package the file up as part of the BAR file to the simulator. Then change the code to look for the file in the application directory (instead of the application storage directory). Believe "file://app/rules.html" will work. You can probably use the File native path to the application directory to work as well.
I believe the "app" directory while in FB is the bin-debug directory.
03-11-2011 03:53 PM
Thank you John, that makes sense. How exactly do I accomplish that, however?
This is what I have so far:
var htmlFile:File = new File("/info.html");
Now using that file object, what exactly do I do to get it into the .bar file?
Thank you
03-11-2011 04:53 PM
Guess I meant:
var file : File = File.applicationDirectory.resolvePath( 'info.html' ); navigateToURL( new URLRequest( 'file://' + file.nativePath ), "_blank" );
03-11-2011 06:40 PM - edited 03-11-2011 06:46 PM
Thank you for your reply. However, I tried this, and a number of variations of this, but it still won't load the html file...frustrating
03-11-2011 06:51 PM
It worked fine in AIR. Try 'file:///'?