03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Dans les fichiers SWF publiés pour Flash Player 6, la chaîne renvoyée est le superdomaine <strong>du</strong><br />

fichier SWF actuel. Par exemple, si le fichier SWF se trouve à l'adresse www.macromedia.com,<br />

cette comman<strong>de</strong> renvoie "macromedia.com".<br />

Dans les fichiers SWF publiés pour Flash Player 7 ou version ultérieure, la chaîne renvoyée est<br />

le domaine exact <strong>du</strong> fichier SWF actuel. Par exemple, si le fichier SWF se trouve à l'adresse<br />

www.macromedia.com, cette comman<strong>de</strong> renvoie "www.macromedia.com".<br />

Si le fichier SWF actuel est un fichier local résidant sur l'ordinateur client, cette comman<strong>de</strong><br />

renvoie "localhost".<br />

L'emploi le plus courant <strong>de</strong> cette comman<strong>de</strong> consiste à inclure le nom <strong>de</strong> domaine <strong>de</strong> l'objet<br />

LocalConnection d'envoi en tant que paramètre <strong>de</strong> la métho<strong>de</strong> que vous comptez invoquer<br />

dans l'objet LocalConnection <strong>de</strong> réception ou avec LocalConnection.allowDomain pour<br />

accepter les comman<strong>de</strong>s issues d'un domaine spécifié. Si vous autorisez uniquement la<br />

communication entre les objets LocalConnection appartenant au même domaine, vous<br />

n'aurez probablement pas besoin d'utiliser cette comman<strong>de</strong>.<br />

Disponibilité : <strong>ActionScript</strong> 1.0 ; Flash Player 6<br />

Renvoie<br />

String - Une chaîne représentant le domaine <strong>de</strong> l'emplacement <strong>du</strong> fichier SWF actuel ; pour<br />

plus d'informations, consultez la section Description.<br />

Exemple<br />

Dans l'exemple suivant, un fichier SWF <strong>de</strong> réception accepte uniquement les comman<strong>de</strong>s<br />

issues <strong>de</strong>s fichiers SWF situés dans le même domaine ou à l'adresse macromedia.com :<br />

// If both the sending and receiving SWF files are Flash Player 6,<br />

// then use the superdomain<br />

var my_lc:LocalConnection = new LocalConnection();<br />

my_lc.allowDomain = function(sendingDomain):String{<br />

return (sendingDomain==this.domain() || sendingDomain=="macromedia.com");<br />

}<br />

// If either the sending or receiving SWF file is Flash Player 7 or later,<br />

// then use the exact domain. In this case, commands from a SWF file posted<br />

// at www.macromedia.com will be accepted, but those from one posted at<br />

// a different subdomain, e.g. livedocs.macromedia.com, will not.<br />

var my_lc:LocalConnection = new LocalConnection();<br />

my_lc.allowDomain = function(sendingDomain):String{<br />

return (sendingDomain==this.domain() ||<br />

sendingDomain=="www.macromedia.com");<br />

}<br />

LocalConnection 747

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!