When
undefined
is converted to a string, the result is
undefined
.
firstname = "Joan ";
lastname = "Flender";trace(firstname + middlename + lastname);
// JoanundefinedFlender
When
undefined
is converted to a string, the resultis "" (an empty string).
firstname = "Joan ";
lastname = "Flender";trace(firstname + middlename + lastname);
//Joan Flender
When you convert a string to a Boolean value, the result is
true
if the string has a length greater than zero; the resultis
false
for an empty string.When you convert a string to a Boolean value, thestring is first converted to a number; the result is
true
if the number is nonzero,
false
otherwise.When setting the length of an array, only a valid numberstring sets the length. For example, "6" works but " 6" or"6xyz" does not.
my_array=new Array();
my_array[" 6"] ="x";trace(my_array.length); // 0
my_array["6xyz"]="x";
trace(my_array.length); // 0
my_array["6"]="x";
trace(my_array.length); // 7
When setting the length of an array, even amalformed number string sets the length:
my_array=new Array();
my_array[" 6"] ="x";trace(my_array.length); // 7
my_array["6xyz"]="x";
trace(my_array.length); // 7my_array["6"] ="x";
trace(my_array.length);// 7
Domain-name rules for settings and local data
In Flash Player 6, superdomain matching rules are used by default when accessing local settings (such ascamera or microphone access permissions) or locally persistent data (shared objects). That is, the settings anddata for SWF files hosted at here.xyz.com, there.xyz.com, and xyz.com are shared, and are all stored atxyz.com.In Flash Player 7, exact-domain matching rules are used by default. That is, the settings and data for a filehosted at here.xyz.com are stored at here.xyz.com, the settings and data for a file hosted at there.xyz.com arestored at there.xyz.com, and so on.A new property,
System.exactSettings
, lets you specify which rules to use. This property is supported for filespublished for Flash Player 6 or later. For files published for Flash Player 6, the default value is
false
, whichmeans superdomain matching rules are used. For files published for Flash Player 7, the default value is
true
,which means exact-domain matching rules are used.If you use settings or persistent local data and want to publish a Flash Player 6 SWF file for Flash Player 7, youmight need to set this value to
false
in the ported file.For more information, see
Cross-domain and subdomain access between SWF files
When you develop a series of SWF files that communicate with each other—for example, when using
loadMovie()
,
MovieClip.loadMovie()
,
MovieClipLoader.LoadClip()
, or Local Connection objects—youmight host the movies in different domains, or in different subdomains of a single superdomain.In files published for Flash Player 5 or earlier, there were no restrictions on cross-domain or subdomain access.In files published for Flash Player 6, you could use the
LocalConnection.allowDomain
handler or
System.security.allowDomain()
method to specify permitted cross-domain access (for example, to let a fileat someSite.com be accessed by a file at someOtherSite.com), and no command was needed to permitsubdomain access (for example, a file at www.someSite.com could be accessed by a file atstore.someSite.com).Files published for Flash Player 7 implement access between SWF files differently from earlier versions in twoways. First, Flash Player 7 implements exact-domain matching rules instead of superdomain matching rules.Therefore, the file being accessed (even if it is published for a Player version earlier than Flash Player 7) mustexplicitly permit cross-domain or subdomain access; this topic is discussed below. Second, a file hosted at asite using a secure protocol (HTTPS) must explicitly permit access from a file hosted at a site using an insecureprotocol (HTTP or FTP); this topic is discussed in the next section (see HTTP to HTTPS protocol access betweenSWF files).Because Flash Player 7 implements exact-domain matching rules instead of superdomain matching rules, youmight have to modify existing scripts if you want to access them from files that are published for Flash Player 7.(You can still publish the modified files for Flash Player 6.) If you used any
LocalConnection.allowDomain()
or
System.security.allowDomain()
statements in your files and specified superdomain sites to permit, you mustchange your parameters to specify exact domains instead. The following code shows an example of the kinds of changes you might have to make:
// Flash Player 6 commands in a SWF file at www.anyOldSite.com// to allow access by SWF files that are hosted at www.someSite.com// or at store.someSite.comSystem.security.allowDomain("someSite.com");
Leave a Comment