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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:18:45+00:00 2026-05-23T09:18:45+00:00

I have function init, which runs on the creationComplete of the application. The init

  • 0

I have function init, which runs on the creationComplete of the application. The init calls get_login_share_object function, in which objects are created, which are null.

Now my problem is that, I get a null object reference error on the Alert in “init()”. How can I avoid that. Is it possible that I can have a check to see, if the objects are null the program should just skip reading the objects.

private function init():void
        {               
            var stored_credentials:Object = get_login_share_object();
            Alert.show(stored_credentials.check_remember +" "+ stored_credentials.alias +" "+ stored_credentials.password );                
        }

        private function get_login_share_object():Object            
        {               
            //create or retrieve the current shared object
            var so:SharedObject = SharedObject.getLocal("loginData","/");       

            var dataToLoad:ByteArray = so.data.ws_creds;
            if(!dataToLoad)
                return null;

            //read in our key
            var aes_key:String = ServerConfig.aes_key;
            var key:ByteArray = new ByteArray();
            key = Base64.decodeToByteArray(aes_key);                 

            //read in our encryptedText
            var encryptedBytes:ByteArray = new ByteArray();
            dataToLoad.readBytes(encryptedBytes);

            //decrypt using 256b AES encryption
            var aes:ICipher = Crypto.getCipher("simple-aes128-ctr", key, Crypto.getPad("pkcs5"));
            aes.decrypt(encryptedBytes);

            encryptedBytes.position = 0;

            var obj:Object = new Object();
            obj.alias = encryptedBytes.readUTF();               
            obj.password = encryptedBytes.readUTF();
            obj.check_remember = encryptedBytes.readUTF();                              

            return obj;
        }
  • 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-23T09:18:46+00:00Added an answer on May 23, 2026 at 9:18 am

    You could check for the null like this:

    var stored_credentials:Object = get_login_share_object();
    if (stored_credentials)
        Alert.show(stored_credentials.check_remember +" "+ stored_credentials.alias +" "+ stored_credentials.password );
    else
        trace('No Shared Object');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following loop inside an function init(); which is executed onload, I
I have got the following very simple code: function init() { var articleTabs =
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
I have a class: function RustEditor() { this.init = function() { var saveButton =
I have the following within an XHTML document: <script type=text/javascript id=JSBALLOONS> function() { this.init
i have created a module with this among others this function in it: <?php
I have an application of which i have use database to insert values on
I have a class which is being operated on by two functions. One function
I have installed my PHP scripts which runs over Apache server in a Windows
I have code like this: private var video:Video; ... private function init():void { ...

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.