views:

33

answers:

1

Hi, I'm working on dashboard editor in flex, an application that allow users to drag ui objects inside a canvas. i need a solution to save the canvas with the objects inside (with all properties and locations x & y) to allow users to save dashboards to database and to open them . I need a way to get the canvas insides without parsing each object inside the canvas. some build-in function to export a ui object into mxml string or something. I'm wondering if there is a way to do that. regards, Elad.

+2  A: 

You'll should use this function. After you should go for each property and get parameter from your UIComponent, so at the end you'll serialize it to String as you want (so in 4-5 strings of code you'll make your export).

But I should to say that you'll have a problems when you'll parse it back, because:
there are inherited read-only properties, which you can't apply for new instance manually!

So you'll need to export e.g. {x:yourUIComponent.x,y:yourUIComponent.y,color:yourUIComponent.color}

Something like this, so there are no the code as you exactly want, but there are another way:

each user is generating events on your dashboard, if you'll save this events, you could recreate the components on other client sides, using event handlers that you already have.

Questions? :)

Eugene