Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Bug Report

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-29-2004, 06:35 PM
Senior Member
 
Join Date: Feb 2003
Posts: 212
Default Problem with getArray

Im trying to save some user comments to a datafile.
In the comments, the users can make use of komma's.
But when saving to the datafile.
The sentences containing komma's are split into seperate parts of the array.

for example: this array in actionscript

Code:
Dag = new Array()
Dag[0] = "I like toast, bread, french fries and mayonaise"
Dag[1] = "Some other sentence"
When I transfer it to ffish and save it to my datafile , this is the output
Code:
[Dag]
type=array
[Dag.0]
type=string
value=I like toast
[Dag.1]
type=string
value= bread
[Dag.2]
type=string
value= french fries and mayonaise
[Dag.3]
type=string
value= Some other sentence
Looking a bit closer to it, I discovered that the problem occured with the getArray command.
Seems that the array-parts are joined in Ffish with a ","
Is there an easy way around this?
Can I use another delimitor?
Reply With Quote
  #2 (permalink)  
Old 04-30-2004, 06:13 AM
Member
 
Join Date: Sep 2003
Posts: 95
Default Re:Problem with getArray

Hmm, hope I am wrong, but I don't think there is much you can do meester.

SWFKit seems to be splitting on the ","

SWFKit might need to delimit the array elements with a pipe (|) or double pipe (||) instead?
Reply With Quote
  #3 (permalink)  
Old 04-30-2004, 09:28 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Problem with getArray

The "getArray" method calls the "getVariable" method to get the value of the array then splits it into seperate parts.

The "getVariable" method will always join the items in an array with ",", we cannot change the delimitor.

You can write your own getArray method like this
Code:
function myGetArray(name)
{
    var arr = [];
    var length = parseInt(FlashPlayer.getVariable(name + ".length"));
    for (var i = 0; i < length; i++)
    {
        arr.push(FlashPlayer.getVariable(name + "." + i.toString()));
    }
    return arr;
}
(The code hasn't been tested)
Reply With Quote
  #4 (permalink)  
Old 04-30-2004, 09:32 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Problem with getArray

We cannot implement the "getArray" method in this way.
Eg. In Action Script
Code:
Dag = new Array()
Dag[0] = "I like toast, bread, french fries and mayonaise"
Dag[1000001] = "Some other sentence"
Reply With Quote
  #5 (permalink)  
Old 04-30-2004, 09:56 AM
Senior Member
 
Join Date: Feb 2003
Posts: 212
Default Re:Problem with getArray

the code works fine
thank you
Reply With Quote
  #6 (permalink)  
Old 05-02-2004, 07:58 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Problem with getArray

The getArray and getObject methods are improved in 2.1 r2.

The getObject method can accept an array parameter contains the property names.
The getArray method works like "myGetArray" method if the length of the array is smaller than 5000.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:36 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.