Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 297741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:40:03+00:00 2026-05-12T06:40:03+00:00

what i’m trying to do is walk an object that is also a complex

  • 0

what i’m trying to do is walk an object that is also a complex tree of objects and output the actionscript 3 code it took (or takes) to create instantiate and populate that object and all its children.

so for instance if you saw something like this in your debugger

myObjectToParse (ParseMe@173e239)
----------[0]someBlob (SomeBlob@173e322)|null
----------[1]someChildren (Array@173e239)
--------------------[0]childFoo (ChildFoo@123e239)
------------------------------someProperty (Number@173e239) | 45
------------------------------someOtherProperty (Number@173e239) | 45
--------------------[1]childBar (ChildFoo@123e239)
------------------------------someStringProperty(String@173e239) | "hello world"

The exporter would spit out:

public class MySerialized extends ParseMe
{
    public var someBlob:SomeBlob;
    public var someChildren:Array;

    public function MySerialized()
    {
        //populateSomeBlob(); //its null so the export doesn't write it out    
        populateSomeChildren();    
    }

    private function populateSomeChildren()
    {
        someChildren=new Array(2);
        var childFoo:ChildFoo=new ChildFoo();
        childFoo.someProperty=45;
        childFoo.someOtherProperty=45;
        childFoo.someProperty=45;
        childFoo.someOtherProperty=45;

        var childBar=new ChildBar();
        childBar.someStringProperty="hello world";

        someChildren[0]=childFoo;
        someChildren[1]=childBar;
    }
}

Any tips? Ideas? Thanks!

Edit: I think i may end up just trying to serialize to an amf ByteArray…sounds simpler, but i haven’t played with and don’t know how many levels deep it can go and what types of references it supports.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:40:03+00:00Added an answer on May 12, 2026 at 6:40 am

    in general, this is not possible, i am afraid … for example, you have readonly properties … also, some classes’ constructor expects initialization values (although i personally think this is not very clever in most cases, but ok) … also, some objects may be instances of private/internal classes, so the generated instantiation code will throw errors …

    you can however make a solution for objects, that do not have these problems …

    ok, basically, flash.utils.describeType will be of a lot of help … that’ll give you all the fields of an object (also tell you, whether it has read only fields etc.), as well as the class name …

    this will help you iterating through an objects properties … for dynamic objects (describeType will tell you), you will additionaly have to loop over the properties using for-in loops … use * as type for the iteration variable, that way it’ll also work with Dictionarys for example …

    then you need to treat specific built-in types specially …

    • XML: use XML::toXMLString … this’ll give you the base for an XML literal …
    • Array: loop through it, and build an array literal
    • Number,int,uint,Boolean: use the standard string representation for a literal
    • String: remember to escape the string (newlines, backslashes etc.) … easiest would be "unescape('"+escape(yourStringValue)+"');" … you can of course create a normal String literal with escape sequences … simplest way would be com.adobe.serialization.JSON.serialize(yourStringValue) (using as3corelib)
    • Date: use something like "new Date("+yourDateValue.getTime()+");" … although it is questionable, whether it really makes sense to harcode dates …
    • DisplayObject and subclasses: this will not be trivial, if you really want that … you will need to find a way to properly rebuild the display list hierarchy …
    • IEventDispatcher and implementors: this is quite impossible … there is no way to find out the handlers registered to a IEventDispatcher, plus you’ll be having a hard time generating ActionScript from function objects (quite impossible) …
      you will have to choose a recursive approach … please note that if you want to support circular references, this’ll be more difficult … you might wanna take that decision before you design your algorithm …

    hope this helps …

    greetz

    back2dos

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 339k
  • Answers 339k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use this code for your ListView's DoubleClick event: private void… May 14, 2026 at 4:32 am
  • Editorial Team
    Editorial Team added an answer This statement works in Access 2003. You would have to… May 14, 2026 at 4:32 am
  • Editorial Team
    Editorial Team added an answer Check this link, may be that can be helpful to… May 14, 2026 at 4:32 am

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.