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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:13:38+00:00 2026-05-24T12:13:38+00:00

I am trying to get anytihng from my SQLite to render in Flex, and

  • 0

I am trying to get anytihng from my SQLite to render in Flex, and I can’t figure out how to display any data, even text, in Flex. What am I doing wrong?

    <fx:Script>
    <![CDATA[
        import flash.data.SQLConnection;
        import flash.data.SQLResult;
        import flash.data.SQLStatement;
        import flash.filesystem.File;

        import mx.collections.ArrayCollection;

        private var conn:SQLConnection;
        private var createStmt:SQLStatement;
        private var selectStmt:SQLStatement;
        [bindable] public var dataField:ArrayCollection;
        [bindable] private var row:Object;
        [bindable] private var pngIndex:int; 
        [bindable] public  var pngTitle:String; 
        [bindable] private var pngByteArray:ByteArray; 
        [Bindable] private var dp:ArrayCollection = new ArrayCollection();

        private function init():void
        {
            conn = new SQLConnection();
            conn.addEventListener (SQLEvent.OPEN, openSuccess);
            conn.addEventListener (SQLErrorEvent.ERROR, openFailure);

            var dbFile:File = File.applicationDirectory.resolvePath("assets/NM.sqlite");
            conn.openAsync(dbFile);
        }

        private function openSuccess(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.OPEN, openSuccess);
            conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);

            getData();
        }


        private function getData():void
        {
            //status = "Loading data";

            selectStmt = new SQLStatement();
            selectStmt.sqlConnection = conn;
            var sql:String = "SELECT Title FROM Data WHERE 'Index' = 0";
            selectStmt.text = sql;

            selectStmt.addEventListener(SQLEvent.RESULT, selectResult);
            selectStmt.addEventListener(SQLErrorEvent.ERROR, selectError);

            selectStmt.execute();
        }

        private function selectResult(event:SQLEvent):void
        {
            //status = "Data loaded";

            selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
            selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);

            [bindable] var result:SQLResult = selectStmt.getResult(); 
            dataField = new ArrayCollection(result.data);
            dp = ArrayCollection(dataField);

            if (dataField != null) {
                pngIndex = result.data.Index;
                pngTitle = result.data.Title;
                pngByteArray = result.data.Picture; 

                /* Pic.source = pngByteArray; */

            }

        }

    ]]>
</fx:Script>
<s:List x="31" y="44" width="511" height="415" dataProvider="{dp}"></s:List>

I’ve tried a number of different components, and I can’t seem to get the data to bind properly (although this code finally doesn’t have the dreaded “Data binding will not be able to detect assignments to… ” message, or the other dreaded “Property undefined” message).

Please help!

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

    Fixed.

    <fx:Script>
        <![CDATA[
            import flash.data.SQLConnection;
            import flash.data.SQLResult;
            import flash.data.SQLStatement;
            import flash.filesystem.File;
    
            import mx.collections.ArrayCollection;
    
            private var conn:SQLConnection;
    
            private function init():void
            {
                conn = new SQLConnection();
                conn.addEventListener(SQLEvent.OPEN, openSuccess);
                conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
                var dbFile:File = File.applicationDirectory.resolvePath("assets/NM.sqlite");
                conn.openAsync(dbFile);
            }
    
            private function openSuccess(event:SQLEvent):void
            {
                conn.removeEventListener(SQLEvent.OPEN, openSuccess);
                conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
                getData();
            }
    
            private function getData():void
            {
                var select:SQLStatement = new SQLStatement();
                select.sqlConnection = conn;
                select.text = "SELECT Title FROM Data WHERE 'Index' = 0";
                select.addEventListener(SQLEvent.RESULT, selectResult);
                select.addEventListener(SQLErrorEvent.ERROR, selectError);
                select.execute();
            }
    
            private function selectResult(event:SQLEvent):void
            {
                var result:SQLResult = event.currentTarget.getResult(); 
                if(result.data)
                {
                    list.dataProvider = new ArrayCollection(result.data);
                }
            }
    
        ]]>
    </fx:Script>
    <s:List id="list" x="31" y="44" width="511" height="415" labelField="Title" />
    

    I also recommend you read up more on how Flex works with lists and item renderers. There was a lot of problems with this code (ie. result.data.Index; is wrong since data is an array). From what I can gather, you’ll want a custom item renderer. Furthermore, I don’t recommend you use Binding if you don’t need it (as with this example altogether) since it incurs extra resources.

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

Sidebar

Related Questions

Trying to get a wildcard search to pick up on any text in org_name
I am trying to get column data from sqlLite DB and put that data
i am trying to fetch data from SQLite to list view but my list
i am currently trying to get data from a form in a view to
Hi i'm trying to get the content from a json file, but i can't
I am trying to get my VBO to draw, but I can't see anything.
So i am trying get 2 div-containers which both should contain centered text (Both
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
trying to get same string on tooltip as is in the Text e.g. Text=<%#
Trying to get this expression to work, can someone look at it and tell

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.