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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:00:40+00:00 2026-06-03T06:00:40+00:00

In Flash builder, I’m struggling with basics of data retrieval from local database. Using

  • 0

In Flash builder, I’m struggling with basics of data retrieval from local database. Using Lita, I created a SQLite database with a single basic (item) table located in a “DAO” folder .It is meant to populate a List. and I have 2 problems:

  1. How to embed the database (with all its pre-populated data) without recreating it from scratch as shown in many tutorials ?
  2. For the purpose of prototyping, how to link the data retrieved a single MXML file directly in the list without creating many other classes (ok, in this cases the number of required classes would be limited) such as :
<?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="HomeView" >

<fx:Script>

  <![CDATA[

      import flash.data.SQLConnection
      import flash.data.SQLStatement;
      import flash.filesystem.File;
      import flash.filesystem.FileMode;
      import mx.collections.ArrayCollection;`

      private function get myData():ArrayCollection 
      {
          var stmt:SQLStatement = new SQLStatement();
          stmt.sqlConnection = new SQLConnection();

          stmt.sqlConnection.open(File.applicationStorageDirectory.resolvePath("dao/MyDatabase.db"));
          stmt.text = "SELECT id, name FROM Item";

          stmt.execute();
          var result:Array = stmt.getResult().data;

          if (result)
          {
              var list:ArrayCollection = new ArrayCollection();
              list.source(result); 
              return list; 
          } else {
              return null; 
          } 
      }
      ]]>
    </fx:Script>

    <s:List id="list" top="0" bottom="0" left="0" right="0" 
           dataProvider="{myData}" >
    <s:itemRenderer>
    <fx:Component>
    <s:IconItemRenderer label="{myData.name}">
    </s:IconItemRenderer>
    </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-03T06:00:41+00:00Added an answer on June 3, 2026 at 6:00 am

    Thanks to Marcx and Marcos Placona’s Blog entry on copying database locally I came up with this:

    <?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="HomeView" >
    
    <fx:Script>
    
      <![CDATA[
    
          import flash.data.SQLConnection
          import flash.data.SQLStatement;
          import flash.filesystem.File;
          import flash.filesystem.FileMode;
          import mx.collections.ArrayCollection;
    
          private function get myData():ArrayCollection 
          {
              var myData:String = "dao/MyDatabase.db";
              var embededSessionDB:File = File.applicationDirectory.resolvePath(myData);
              var writeSessionDB:File = File.applicationStorageDirectory.resolvePath(myData);
              // If a writable DB doesn't exist, we then copy it into the app folder so it's writteable
              if (!writeSessionDB.exists) 
              {
                 embededSessionDB.copyTo(writeSessionDB);
              }
    
              var stmt:SQLStatement = new SQLStatement();
              stmt.sqlConnection = new SQLConnection();
    
              stmt.sqlConnection.open(File.applicationStorageDirectory.resolvePath(myData));
              stmt.text = "SELECT id, name FROM Item";
    
              stmt.execute();
              var result:Array = stmt.getResult().data;
    
                stmt.execute();
                var result:Array = stmt.getResult().data;
                var r:ArrayCollection = new ArrayCollection();
    
                if (result)
                {      
                    r.source = result; 
                    return r;
                }else{
                    return null;
                } 
          }
    
          [Bindable]private var resultArr:ArrayCollection = getData();
    
          ]]>
    
        </fx:Script>
    
        <s:List id="list" top="0" bottom="0" left="0" right="0" 
               dataProvider="{myData}" label="name">
        </s:List>
        </s:View>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a Flex/Flash Builder 4 application that loads data using E4X/XML, like this:
i'm using flash builder 4..i want to ask something..how to binding data to custom
Using Flash Builder 4.6, I am following http://www.flex-blog.com/adobe-air-sqlite-example (edit: link seems to be broken)
Using Flash Builder I need to create a data service with 2 parameters named
I created an flv video player using Flash Builder 4. This BasicVideoPlayer project is
I'm using Flash Builder 4 (the version after Flex Builder 3, so very similar
I'm using Flash Builder 4 Beta 2. I have it connecting to a PHP
I'm using Flash Builder 3 to edit my Flex app, but I noticed that
i just checking Flash Builder 4 ( i come from Flex builder 3 ),
i am using Flash-builder 4 and developed an application to capture screen image and

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.