A tip for writing script for HD DVD

A tip for writing script for HD DVD

  • Comments 6

A very quick tip today, although this one trips me up a lot.

When you write script files for your HDi applications, always include a blank line at the start of the file and at the end of the file.

This is because the player will concatenate all the individual files together and execute them as a single large virtual file. So, for example, if you have two files like this:

first.js

var x = 42;
// end of first.js

second.js

var y = 42;

Then the player will see this:

<virtual_file>

var x = 42;
// end of first.jsvar y = 42;

And then later on when you try to reference the y variable, it doesn't exist because it was considered part of the comment. Doh!

At least, that's what the players do, but HDiSim doesn't. Which is why you can get away without the padding when running on the simulator, and then you get weird errors when running on the emulator / player.

  • omg you serious? It's good to know that before go crazy about bad behaviour!

  • Peter -

    I got the following error when I tried to validate my script file:

    ERROR (E000000036): Resource must be encoded with Unicode UTF-16 (Big endian) with BOM (Spec 8.2.1)

    How do I save my script with BOM?

  • Most editors such as Notepad or Visual Studio or Eclipse will do this for you -- just try "Save As..." or "Save with Encoding..." instead of "Save", and choose an encoding.

  • Thanks Peter. I was using Textpad 4.7 and even I saved it as Unicode(Big endian), it didn't work. In this case I have to code a Java program that inserts the UxFEFF char at the beginning of the file.  But if I use Textpad or Visual Web Developer, it works OK as long as I save it as Unicode(Big endian).

    I have another question. Is it even possible to make an HTTP request from the player to some HTTP server, using ECMAScript?  If yes, how? Thanks a lot.

  • Correction of my previous comment:

    in "But if I use Textpad or Visual Web Developer, it works OK as long as I save it as Unicode(Big endian)", I meant Notepad rather than "Textpad". Sorry for the typo.

  • Hello World is a very basic application. But, now let's take a look at one of the samples that has a

Page 1 of 1 (6 items)