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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:11:22+00:00 2026-06-12T19:11:22+00:00

I have an array list which is connected with a private static function and

  • 0

I have an array list which is connected with a private static function and would like to make another array list on a different view (Flex builder, Action script) so I copied the private static function edited the name and the “Select” parts but I get an error saying:

“1061: call to a possibly undefined method members through a reference with static type class.”

Here is the code of the AS:

package model
{
    import flash.data.SQLConnection;
    import flash.data.SQLResult;
    import flash.data.SQLStatement;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    import flash.filesystem.FileMode;
    import flash.filesystem.FileStream;

    import model.Dish;

    import mx.collections.ArrayCollection;

    public class SQLiteDatabase
    {
        private static var _sqlConnection:SQLConnection;

        public static function get sqlConnection():SQLConnection
        {
            if (_sqlConnection)
                return _sqlConnection;
            openDatabase(File.desktopDirectory.resolvePath("test.db"));
            return _sqlConnection;
        }

        public  function getNote(id:int):Dish
        {
            var sql:String = "SELECT id, title, time, message FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = id;
            stmt.execute();
            var result:Array = stmt.getResult().data;
            if (result && result.length == 1)
                return processRow(result[0]);
            else
                return null;
        }
        public function getmember(id:int):Dish
        {
            var sql:String = "SELECT id, title, time, message FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = id;
            stmt.execute();
            var result:Array = stmt.getResult().data;
            if (result && result.length == 1)
                return processRow(result[0]);
            else
                return null;
        }

        public function getMYBlist(id:int):Dish
        {
            var sql:String = "SELECT id, title, time, message FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = id;
            stmt.execute();
            var result:Array = stmt.getResult().data;
            if (result && result.length == 1)
                return processRow(result[0]);
            else
                return null;
        }

        public static function notes():ArrayCollection
        {
            var noteList:ArrayCollection = new ArrayCollection();

            var sql:String = "SELECT id, title, time, message FROM notes";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.execute();
            var sqlResult:SQLResult = stmt.getResult();
            if (sqlResult) {
                var result:Array = sqlResult.data;
                if (result) {
                    for (var index:Number = 0; index < result.length; index++) {
                        noteList.addItem(processRow(result[index]));
                    }
                }
            }
            return noteList;
        }

        public static function members():ArrayCollection
        {
            var memberslist:ArrayCollection = new ArrayCollection();

            var sql:String = "SELECT id, name FROM members";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.execute();
            var sqlResult:SQLResult = stmt.getResult();
            if (sqlResult) {
                var result:Array = sqlResult.data;
                if (result) {
                    for (var index:Number = 0; index < result.length; index++) {
                        memberslist.addItem(processRow(result[index]));
                    }
                }
            }
            return memberslist;
        }




        public static function addNote(note:Dish):void
        {
            var sql:String = 
                "INSERT INTO notes (title, time, message) " +
                "VALUES (?,?,?)";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.title;
            stmt.parameters[1] = note.time;
            stmt.parameters[2] = note.message;
            stmt.execute();
        }

        public static function addMember(note:Dish):void
        {
            var sql:String = 
                "INSERT INTO notes (title, time, message) " +
                "VALUES (?,?,?)";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.title;
            stmt.parameters[1] = note.time;
            stmt.parameters[2] = note.message;
            stmt.execute();
        }

        public static function deleteNote(note:Dish):void
        {
            var sql:String = "DELETE FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.id;
            stmt.execute();
        }



        public static function updateNote(note:Dish):void
        {
            var sql:String = "UPDATE notes SET title=?, time=?, message=? WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.title;
            stmt.parameters[1] = note.time;
            stmt.parameters[2] = note.message;
            stmt.parameters[3] = note.id;
            stmt.execute();
        }



        protected static function processRow(o:Object):Dish
        {
            var note:Dish = new Dish();
            note.id = o.id;
            note.title = o.title == null ? "" : o.title;
            note.time = o.time == null ? "" :o.time;
            note.message = o.message == null ? "" : o.message;
            return note;
        }

        public static function openDatabase(file:File):void
        {
            var newDB:Boolean = true;
            if (file.exists)
                newDB = false;
            _sqlConnection = new SQLConnection();
            _sqlConnection.open(file);
            if (newDB)
            {
                createDatabase();
                populateDatabase();
            }
        }

        protected static function createDatabase():void
        {
            var sql:String = 
                "CREATE TABLE IF NOT EXISTS notes ( "+
                "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                "title VARCHAR(50), " +
                "time VARCHAR(50), " +
                "message VARCHAR(200))";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.execute();         
        }

        protected static function populateDatabase():void
        {
            var file:File = File.applicationDirectory.resolvePath("assets/notes.xml");
            if (!file.exists) return;
            var stream:FileStream = new FileStream();
            stream.open(file, FileMode.READ);
            var xml:XML = XML(stream.readUTFBytes(stream.bytesAvailable));
            stream.close();
            for each (var n:XML in xml.note)
            {
                var note:Dish = new Dish();
                note.id = n.id;
                note.title = n.title;
                note.time = n.time;
                note.message = n.message;
                addNote(note);
            }
        }

    }
}

and the code of the MXML file:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="Profile">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import model.Dish;
            import model.SQLiteDatabase;

            import spark.events.IndexChangeEvent;

            protected function onNote2Selected(event:IndexChangeEvent):void {
                var selectedNote:Dish = event.currentTarget.dataProvider[event.newIndex];
                navigator.pushView(MemberDetailsView, selectedNote);
            }


            protected function onAddButtonClicked(event:MouseEvent):void {
                navigator.pushView(AddMemberView);
            }

        ]]>
    </fx:Script>


    <s:VGroup gap="-1">
    </s:VGroup>
    **<s:List dataProvider="{SQLiteDatabase.members()}"  change="onNoteSelected(event)"**
            left="0" right="0" top="0" bottom="0">

        <s:itemRenderer>
            <fx:Component>
                <s:IconItemRenderer labelField="title" messageField="message"/>
            </fx:Component>
        </s:itemRenderer>
    </s:List>
</s:View>
  • 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-12T19:11:24+00:00Added an answer on June 12, 2026 at 7:11 pm

    The error is because you are accessing a static method to a non-static class. The meaning is that the instance has not been created yet, so while the linker should be able to locate the static member function, there is no way to resolve which instance of the object. If you declare the class static, it should solve this problem.

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

Sidebar

Related Questions

Scenario : I have a member variable, an array-list,(which is not static, private member)
I have an array list of objects in my application. private static ArrayList<Player> userList=new
I have an array of points A,B,C,D,E...N which when connected make a path. How
I have an array list named newSymptomList which contains a list of Symptom id's
I have a collection (or list or array list) in which I want to
I have a 2D array. Lets suppose that it has some connected region which
I have a class cnList which stores a flexible number of items. This list
I have an input box for which I am using the Jquery autocomplete function.
I have declared the following method: private void mockInvokeDBHandler(Map<String, Object>... rows) { List<Map<String, Object>>
I'm working on a project where we have an array of atoms which acts

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.