Using the "params" array in "handleRequest()&

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Using the "params" array in "handleRequest()&

Postby Pippoflash » 10 Feb 2006, 14:25

Hey :)
I am trying to use the "params" array returned from hendleRequest() in an ActionScript Room extension.
I can access the array and navigate it, but commands such as unshift, join, pop or concat do not work properly...
Also if I trace the array itself (without cycling through values) the output on the adimn panel is a strange string: "[Ljava.lang.String;@1522de2"
How can I hanlde the params array?

thx!
P
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Feb 2006, 21:27

Ah! Very nice question! :)
They don't work because the object you get is a native Java array, not an Actionscript array.

We might hide this from the Actionscript framework... Let me think about it a little bit more.

A Java array is a very simple (and veeeery fast) data structure. It only has one property called length, like in AS
But no other methods.
So there's no unshift, join etc...

You can cycle through it just like you would do with an AS array but if you need to use the other methods you will have to convert it to a real AS array.

Example:

Code: Select all

function arrayConvert(javaArray)
{
   var asArray = []
   
   for (var i = 0; i < javaArray.length; i++)
      asArray[i] = javaArray[i]
      
   return  asArray
}
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 11 Feb 2006, 02:01

ahhh ok :)
Thanks for the explanation, I suspected something similar...
Just to fulfill my curiosity, what is interpreting the ECMAScript on the server?
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 11 Feb 2006, 06:36

The great, unsurpassable Rhino by Mozilla group :)
http://www.mozilla.org/rhino/
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 33 guests