I know this might not be the right place to post this question but I have to start somewhere since I don't really know what it is I'm dealing with, maybe you can help?
I'm using the views_datasource xml-output together with the DrupalSite library for Flash (Actionscript 3). I'm getting all the xml into flash but I'm lost when it comes to the data field (the alt/description text) for my cck imagefield ('slides') . I outputs like this:
[nid] -> 2
> [node_data_field_slides_field_slides_data] -> a:2:{s:3:"alt";s:15:"Design proposal";s:5:"title";s:0:"";}
[node_vid] -> 2
[node_data_field_slides_nid] -> 2
[node_type] -> case
[files_node_data_field_slides_filepath] -> sites/default/files/case-l/someimage.jpg
What kind of data is this? Looks like an array... (and does anyone happen to know how I parse it in Actionscript 3?)
a:2:{s:3:"alt";s:15:"Design proposal";s:5:"title";s:0:"";}
I tried the JSON library for actionscript 3 but this:"JSON.decode('a:2:{s:3:"alt";s:15:"Design proposal";s:5:"title";s:0:"";}')" only throws the error "JSONParseError: Unexpected a encountered".
Can you point me in the right direction?
Comments
Comment #1
Andreas Radloff commentedI figured it out myself, it's sql-data that can be deserialized in actionscript by using a class found here: http://sephiroth.it/test/unserializer/ .
I had to modify the class by commenting out these lines:
//import mx.core.*;
//use namespace mx_internal;
and changing all
mx_internal static function
to
private static function
I hope it helps someone trying to integrate drupal with flash using this module...
Comment #2
gregglesComment #3
allisterbeharry commentedThis is data in PHP's serialization format - CCK is storing the data for this field as an serialized array because the field is storing multiple values. This is something the rendering should check for and output multiple child elements or arrays. I'll add this to the todo for the next release. In the meantime your solution using a client-side deserializing library is the only way to handle the multiple values.
Comment #4
allisterbeharry commentedThis is fixed in 6.x-1.0-beta1. It now properly handles multiple-valued CCK fields.