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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:58:41+00:00 2026-06-12T05:58:41+00:00

I have a Flex mobile app that currently contains 2 views View 1 has

  • 0

I have a Flex mobile app that currently contains 2 views

View 1 has a databound list that uses itemRenderer to display an ID and A Label
View 2 displays a databound list that uses itemRenderer to display controls based upon the contents of a dataset.

All data is held in a SQLite database.

View 1 is a list of surveys
View 2 is list of questions relative to each survey.

Where I am struggling is to pass the survey ID value to the SQL query in view 2 so that the data returned is the questions related to each survey.

I have gone over and over dispatchEvent but cannot work out how I pass the relevant value from data.surveyID to the parameter variable on view 2 to query the database.

View 1 code

                <?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" 
                    xmlns:mx="library://ns.adobe.com/flex/mx" 
                    title="Surveys"
                    creationComplete="listen()">
                <fx:Script>
                    <![CDATA[
                        import flash.data.SQLConnection;
                        import flash.data.SQLResult;
                        import flash.data.SQLStatement;
                        import flash.events.Event;
                        import flash.filesystem.File;
                        import mx.collections.ArrayCollection;
                        import spark.events.IndexChangeEvent;
                        import spark.events.ListEvent;
                        import spark.transitions.FlipViewTransition;
                        import spark.transitions.FlipViewTransitionMode;
                        import spark.transitions.ViewTransitionDirection;
                        private var conn:SQLConnection;
                        private function get myData():ArrayCollection 
                        {
                            var stmt:SQLStatement = new SQLStatement();
                            stmt.sqlConnection = new SQLConnection();
                            stmt.sqlConnection.open(File.applicationDirectory.resolvePath("assets/cp_db.sqlite"));
                            stmt.text = "SELECT * FROM surveys";
                            stmt.execute();
                            var result:Array = stmt.getResult().data;
                            if (result)
                            {
                                var list:ArrayCollection = new ArrayCollection();
                                for (var i:int=0; i<result.length; i++) 
                                {
                                    list.addItem(result[i]);
                                }
                                return list; 
                            }
                            else 
                            {
                                return null; 
                            } 
                        }
                        private function workingHandler ( event:Event ) : void
                        {
                            trace( "I'm the working handler here :) " );
                        }
                        private function listen():void{
                        list.addEventListener( "switchToDay", regularListener );

                        }

                        public var itemLabel:String;
                        private function regularListener (event:Event) : void
                        {
                            trace( "I'm the regular listener"  );
                            trace(itemLabel);
                        }
                        public function conIndex( ind:int):String{
                            return ind.toString();
                        }

                    ]]>

                </fx:Script>
                <fx:Declarations>
                    <!-- Place non-visual elements (e.g., services, value objects) here -->
                </fx:Declarations>

                <s:List id="list" left="10" right="10" top="10" bottom="10" labelField="{data.SurveyName}"
                        click="navigator.pushView(surveyDetailView, conIndex(list.selectedIndex+1));"
                        dataProvider="{myData}"  >
                    <s:itemRenderer>
                        <fx:Component>
                            <s:ItemRenderer>
                                <s:LabelItemRenderer id="surID" width="50" label="{data.surveyID}"/>
                                <s:LabelItemRenderer id="surName" x="0" width="100%" label="{data.SurveyName}"
                                                     click="surName.dispatchEvent(new Event('switchToDay', true,false));"/>
                            </s:ItemRenderer>
                        </fx:Component>
                    </s:itemRenderer>
                </s:List>
            </s:View>

View 2 code

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    title="{data}">
<fx:Declarations>
    <s:SlideViewTransition id="slideTrans" direction="down" duration="300"/>
</fx:Declarations>
<fx:Script>
    <![CDATA[
        import flash.data.SQLConnection;
        import flash.data.SQLStatement;
        import flash.filesystem.File;
        import flash.filesystem.FileMode;
        import mx.collections.ArrayCollection;
        import spark.components.Button;
        import spark.components.Label;
        public var surveyIdParam:String = '1';
        public var myPar:String;
        public function get myData():ArrayCollection 
        {
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = new SQLConnection();
            stmt.sqlConnection.open(File.applicationDirectory.resolvePath("assets/cp_db.sqlite"));

            stmt.parameters[0] = surveyIdParam;
            stmt.text = "SELECT * FROM surveyquestions  where surveyID = ?";
            stmt.execute();
            var result:Array = stmt.getResult().data;

            if (result)
            {
                var list:ArrayCollection = new ArrayCollection();
                for (var i:int=0; i<result.length; i++) 
                {
                    list.addItem(result[i]);
                }
                return list; 
            }
            else 
            {
                return null; 
            } 
        }
    ]]>
</fx:Script>
<s:List id="list" left="0" right="0" top="50" bottom="0" dataProvider="{myData} ">
    <s:itemRenderer>
        <fx:Component>
            <s:ItemRenderer>
                <fx:Script>
                    <![CDATA[
                        import spark.components.Label;
                        private function addItem(qtype:String):void
                        {

                            if (qtype == "1") {
                                icrHeading.visible = true;
                                ti.visible=false;
                                cb.visible=false;
                            }
                            else if (qtype == "2") {

                            }
                            else if (qtype == "3") {
                                icrDetail.visible=true;
                            }
                        }
                    ]]>
                </fx:Script>
                <s:VGroup id="contentHolder">

                </s:VGroup>

                <s:IconItemRenderer id="icr1" visible="false" x="0" width="50"
                                    label="{data.QuestionTypeID}"/> 
                <s:IconItemRenderer id="icrHeading" visible="false" x="0" width="450"
                                    label="{data.QuestionTitle}" color="0xff0000"/>
                <s:IconItemRenderer id="icrDetail" visible="false" x="50" width="450"
                                    label="{data.QuestionTitle}"/>
                <s:Label id="ilbl1" x="50" width="120" added="addItem(icr1.label.toString())"/>
                <s:TextInput id="ti" x="600" width="200" text=""/>
                <s:CheckBox id="cb" x="550">
                </s:CheckBox>
            </s:ItemRenderer>
        </fx:Component>
    </s:itemRenderer>
</s:List> 
<s:Button id="btn" x="717" y="10" label="{data}" click="navigator.popView()"/>
  • 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-12T05:58:43+00:00Added an answer on June 12, 2026 at 5:58 am

    This article may help you pass data between your views. Basically, navigator.pushView accepts parameters

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

Sidebar

Related Questions

I have a list in flex mobile project which contains multiple rows. I want
In my Flex 4.5 mobile app, I have an actionScript item renderer (that derives
I have a view like this in my Flex mobile Application: <s:View xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s=library://ns.adobe.com/flex/spark
I am building an mobile flex app in eclipse indigo and have my app
In a Flex Mobile project I have a simple itemRenderer where I'm trying to
I have to create an mobile flex application with tabbed navigator view. One of
I have a Pure AS3 mobile project that I'm developing in Flex 4.5, and
I'm working in a mobile app for iPad in Flex 4, I have a
I have a requirement to build a flex mobile app (iOS/Android) which is capable
I have a Flex mobile project with two different style sheets: theme1.css (Contains all

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.