tags:

views:

81

answers:

1

Hi,

I was wondering is it possible to pass an array through the localConnection in flash? My local connects connect my flash application with the javascript and passes variables between them.

+1  A: 

You can pass arrays through LocalConnection. But local connections are for communication between two different SWFs (one loaded into another or embedded in same or different html pages). For communication between flash and SWF, you should be using ExternalInterface.call()

From liveDocs

public static function call(functionName:String, ... arguments):*

Calls a function exposed by the Flash Player container, passing zero or more arguments. If the function is not available, the call returns null; otherwise it returns the value provided by the function. Recursion is not permitted on Opera or Netscape browsers; on these browsers a recursive call produces a null response. (Recursion is supported on Internet Explorer and Firefox browsers.)

You can specify zero or more parameters, separating them with commas. They can be of any ActionScript data type. When the call is to a JavaScript function, the ActionScript types are automatically converted into JavaScript types; when the call is to some other ActiveX container, the parameters are encoded in the request message.

Amarghosh
I use localconnection to call a javascript function in my main HTML and I am supposed to pass an array to the javascript. So will it work in that case?
Fahim Akhter
`LocalConnection` is for communications between two SWFs - and **not for communication between an SWF and javascript**. Can you show me the code that you are using? And yeah, you can pass arrays through local connection.
Amarghosh