
Writing double-byte applications
93
Or the design can be more detailed and include content switching in the NetStream, as in the
following:
ns = new NetStream(nc);
ns.onStatus = function(info){
if (info.code == "NetStream.Play.InsufficientBW"){
// Switch to play a content that requires less bandwidth.
curTime = this.time;
this.play("foo_low_bandwidth", curTime, -1, true);
}
}
vid.attachVideo(ns);
ns.setBufferTime(2);
ns.play("foo_high_bandwidth", 0, -1, true);
Writing double-byte applications
If you are using server-side ActionScript in a development environment that facilitates
double-byte text (such as an Asian language character set), your server-side ActionScript must
be in an ASC file that is UTF-8-encoded. This means you’ll need a JavaScript editor, such as
the Script window in Flash Professional or Dreamweaver, that encodes files to the UTF-8
standard. Then, you can use built-in JavaScript methods such as
Date.toLocaleString
,
which converts the string to the locale encoding for that system.
To ensure UTF-8 encoding in Dreamweaver, you need to check two settings: the document
encoding setting and the inline input setting.
■
To change the document encoding setting, select Modify > Page Properties, then select
Document Encoding. Choose Unicode (UTF-8).
■
To change the inline input setting, select Edit > Preferences (Windows) or Dreamweaver >
Preferences (Mac OS X), and then click General. Select Enable Double-Byte Online Input
to enable to enter double-byte text.
To use double-byte characters as method names, the method names must be assigned by using
the object array operator and not the dot operator:
// This is the CORRECT way to create double-byte method names.
obj["Any_hi_byte_name"] = function(){}
// This is the INCORRECT way to create double-byte method names.
obj.Any_hi_byte_name = function() {}
TIP
Some simple text editors might not encode files to the UTF-8 standard; Microsoft
Windows Notepad for Windows XP and Windows 2000 provides a Save As option to
encode files to the UTF-8 standard.
Содержание FLASH MEDIA SERVER 2-DEVELOPING MEDIA
Страница 1: ...Developing Media Applications ...
Страница 6: ...6 ...
Страница 10: ...10 About This Manual ...
Страница 36: ...36 Flash Media Server Architecture ...
Страница 80: ...80 Debugging and Monitoring Applications ...
Страница 106: ...106 Application Development Tips and Tricks ...
Страница 114: ...114 ...