MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Dokumentacja Strona 251

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 369
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 250
60
Understanding file naming and domains used with this method
If an HTML page containing a movie is accessed differently (with regards to domain names) from
the way the movie itself accesses the Flash Communication Server, then the connection will not
be successful. This is a security feature of the Flash Player. But in some cases, this may be
inconvenient.
For example, if a web page containing a movie is served on an intranet from, say, http://
deptserver.mycorp.com, it can also be accessed simply by http://deptserver. If the page is accessed
via, say, http://deptServer/tcpage.htm, but the movie specifies deptServer.mycorp.com in the
targetURI, then the movie will not make a successful connection to the server. Similarly, if the
web page and movie are accessed as http://deptserver.mycorp.com/tcpage.htm, but the movie
specifies rtmp://deptserver in the
targetURI, it will not connect.
There are a few things you can do to prevent the security policies from inconveniencing you or
your users. First, and easiest, is to use a
targetURI that doesnt specify a server name. (This is
applicable only if the Flash Communication Server and web server are running on the same
machine.) To do so, leave off the second slash in the
targetURI. For example, the following
commands will make the Flash Player attempt to connect to the same host and domain as the web
server the SWF file was served from.
nc = new NetConnection();
nc.connect("rtmp:/myApp");
Second, there is a bit of JavaScript you can use in your HTML page to avoid the security
problem. Assuming the movie uses a fully qualified domain name URL to access the Flash
Communication Server, this JavaScript redirects the web page to an explicitly named full
URL, like this:
<SCRIPT language="javascript">
//if the URL didn’t have the domain on it
if (document.URL.indexOf("mycorp.com") == -1) {
//redirect to a version that does
document.URL="http://deptServer.mycorp.com/tcpage.htm";
}
</script>
Finally, if you own a domain name, have access to the DNS records of that domain name, and
have a static IP address for your Flash Communication Server, you can create address ("A")
records to point a host name to that IP address. For instance, flashcom.mycorp.com could map to
the machine running the Flash Communication Server and having an IP address provided by
your IT department or ISP. Your web pages can continue to be hosted by whatever means you are
currently using. ("CNAME" records are recommended if you need to forward traffic to a server
that has a DNS-accessible host name but may or may not have a static IP address.)
Example
The following example connects to the funAndGames application on the macromedia server.
con = new NetConnection();
con.connect("rtmp://real.macromedia.com/funAndGames");
See also
NetConnection.close, NetConnection.onStatus
Przeglądanie stron 250
1 2 ... 246 247 248 249 250 251 252 253 254 255 256 ... 368 369

Komentarze do niniejszej Instrukcji

Brak uwag