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 8933249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:29:38+00:00 2026-06-15T09:29:38+00:00

So, I have successfully grabbed a value out of an XML document and set

  • 0

So, I have successfully grabbed a value out of an XML document and set it into a separate class called “AddCommas.” The trace functions have shown me that it sets properly.

For more details, my objective is to take the language indicator (“fr” for french or “en” for english), set it inside the appropriate class and into a variable I will use. Now, I am using this variable to be used in an if statement; which will help me format a number properly (commas, decimals, spaces) per the clients request.

However, my problem is when I try to get the value to use it. It always comes back as Null. I have placed traces all over my program trying to pinpoint when this happens, but I cannot find it. Here’s the code…

The pull from the XML file and into the set (this works fine, but I am adding it for your benefit in case I missed something)

 public var commaHold = new AddCommas();
    localLanguage = xmlObj.localLanguage;
    trace("localLanguage + " + localLanguage);
    commaHold.setLanguage(localLanguage); // Set Language
   //More code follows...

This is the set function istelf…

public function setLanguage(localLanguage:String){
langHold = localLanguage;
trace("Set Language =  " + langHold); //This always shows a successful set
}

Now am I wrong in thinking that in AS3, once langHold in my AddCommas class has been set I should be able to use it without calling a get within the function I am using the If Statement in, right? Such as this?

var language = langHold;
if (language == "en"){
trace("Language is = " + language); // More code follows afterwards and as of now, this shows NULL

Now, I have attempted plenty of Get functions to add the language variable in the call itself to this function and it’s always the same. Am I missing some fundamentals here?

Thank you very much for your time.

  • 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-06-15T09:29:39+00:00Added an answer on June 15, 2026 at 9:29 am

    If you expect a string comparison you need to use quotes, unless en is a String variable since langHold is a String, like:

    if (language == "en"){
    

    Consider modifying the set function to use the as3 keyword like:

    private var _language:String;
    
    public function set language(value:String):void {
         _language = value;
         //do other stuff here if necessary, put a breakpoint on the line above
    }
    
    public function get language():String{
         return _language;
         //put a breakpoint on the line above
    }
    

    You should be able to see when any instance of your class has the property changed. The only other issue I can think of is it is not the same instance of the class and therefore doesn’t share the property value you set earlier. In the debugger you can check the “hashCode” or “address” it shows for this to see if it changes when it hits the breakpoints.

    Here’s a sample Singleton structure in AS3 (this all goes in one file):

    package com.shaunhusain.singletonExample
    {
    
        public class SingletonExample
        {
            private static var instance:SingletonExample;
    
            public static function getIntance():SingletonExample
            {
                if( instance == null ) instance = new SingletonExample( new SingletonEnforcer() );
                return instance;
            }
    
            /**
             * 
             * @param se Blocks creation of new managers instead use static method getInstance
             */
            public function SingletonExample(se:SingletonEnforcer)
            {
            }
        }
    }
    
    internal class SingletonEnforcer {public function SingletonEnforcer(){}}
    

    using this single shared instance from any other class would look something like this:

    private var singletonInstance:SingletonExample = SingletonExample.getInstance();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully parsed an XML file into a custom ListView , but how
I have successfully fetched an image from photo library and I have set it
I have successfully implemented django-ajax-uploader into my project. But I do not know how
I have successfully scheduled local notifications in my app using the code below: Class
I have successfully setup castle windsor using an xml configuration file and everything works
I have successfully set up my twitter callback on my webpage and everything is
I have successfully incorporated Write-Progress into my scripts. When my scripts get to any
I have successfully set up a WPF Datagrid with the March 2009 WPF Toolkit
I have successfully integrated PayPal Express into a Flex application. In DoExpressCheckoutPayment.php, I have
I have successfully used these recording settings to create audio formatted into the needed

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.