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

  • SEARCH
  • Home
  • 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 359035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:21:20+00:00 2026-05-12T12:21:20+00:00

I’m using Python+PyAMF to talk back and forth with Flex clients, but I’ve run

  • 0

I’m using Python+PyAMF to talk back and forth with Flex clients, but I’ve run into a problem with the psudo-Enum-Singletons I’m using:

class Type {
    public static const EMPTY:Type = new Type("empty");
    public static const FULL:Type = new Type("full");
    ...

}

When I’m using locally created instances, everything is peachy:

if (someInstance.type == Type.EMPTY) { /* do things */ }

But, if ‘someInstance’ has come from the Python code, it’s instance of ‘type’ obviously won’t be either Type.EMPTY or Type.FULL.

So, what’s the best way to make my code work?

Is there some way I can control AMF’s deserialization, so when it loads a remote Type, the correct transformation will be called? Or should I just bite the bullet and compare Types using something other than ==? Or could I somehow trick the == type cohesion into doing what I want?

Edit: Alternately, does Flex’s remoting suite provide any hooks which run after an instance has been deserialized, so I could perform a conversion then?

  • 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-12T12:21:21+00:00Added an answer on May 12, 2026 at 12:21 pm

    Random thought: Maybe you could create a member function on Type that will return the canonical version that matches it?

    Something like:

    class Type {
      public static const EMPTY:Type = new Type("empty");
      public static const FULL:Type = new Type("full");
      ...
    
      // I'm assuming this is where that string passed
      // in to the constructor goes, and that it's unique.
      private var _typeName:String;
    
      public function get canonical():Type {
        switch(this._typeName) {
          case "empty": return EMPTY;
          case "full": return FULL;
          /*...*/
        }
      }
    }
    

    As long as you know which values come from python you would just convert them initially:

    var fromPython:Type = /*...*/
    var t:Type = fromPython.canonical;
    

    then use t after that.

    If you can’t tell when things come from python and when they’re from AS3 then it would get pretty messy, but if you have an isolation layer between the AS and python code you could just make sure you do the conversion there.

    It’s not as clean as if you could control the deserialization, but as long as you’ve got a good isolation layer it should work.

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

Sidebar

Ask A Question

Stats

  • Questions 170k
  • Answers 170k
  • 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 As far as I know, not in mysql. May 12, 2026 at 2:06 pm
  • Editorial Team
    Editorial Team added an answer Already answered in: DES encryption of 8 bytes plain text… May 12, 2026 at 2:06 pm
  • Editorial Team
    Editorial Team added an answer ACL9 is what i currently use for the authorization, authlogic… May 12, 2026 at 2:06 pm

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

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.