Document.insertLabel can only store string data ..The second parameter must be a string and i would like to store a HostObject per exemple ..
Any idea ?
using SDK,or Dynamicly create HostObject from string.
You just need to serialize the data first, and unserialize it when you read it out...
Ok, so i'm creating a HostObject.
var vHostObject:HostObject = new HostObject ();
and now, how to give it the string data stored in Document.extractLabel to get a valid HostObject ??
(just for information, the string data represents PageItem.properties.toSource() )
You are using the CS SDK and writing in Actionscript?
What exactly are you using HostObject for?
It always helps to give full info when you ask questions. I missed the reference to HostObject...
Yes, i'm using CS SDK in Flex.
I have to get several states ( geometry, rotation, strokeColor .... ) of a PageItem in Page.
To do that, i get that state by using PageItem.properties which is HostObject according to Flex debugger and I store the PageItem.properties.toSource() by using PageItem.insertLabel(key , value:String)
And in my palette, when user want to change state of PageItem, I would like to switch state by using PageItem.properties = PageItem.extractLabel("state2").
But PageItem.properties waits a HostObject and i have a string, so how to convert this string to be setted to PageItem.properties. ??
I could store PageItem.properties(HostObject) into a Dictionnary and switch states simply ... This works .. but i want to store all states in Document because afer a reopen, i would find them again ...
I hope my english is ok...
I don't think you need HostObject for that. I think a simple Object will work.
No matter what method you use to serialize and unserialize the data, you'll write the serialized string to a label and read it out afterwards.
I finally used a jsx call to execute an eval which returns this famous HostObject.
I set the PageItem.properties with that, and ......................that works !!!
Thanks Harbs for your help.