Navigator.pushView()

I understand that to share data between views in a mobile application you need to pass it using the navigator.pushView() call. I've done that and it works, but now I wonder how I can pass data if the user just presses the physical back button on the mobile device.
Do I have to capture the keyboard down event like this:
navigator.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
and use pushView within the handler? will that cancel the original back button call completely? I wonder if there's a better way.
The use case is this: you're in the home view, the user presses a button and you gets to another view (using a pushView call). The user then makes some selections, then presses the physical back button to return to the home view. I need to pass the user selection to the home view somehow.

Hi,
There is a solution built-in to the Flex Mobile framework. Look at createReturnObject() discussed here in the docs:
http://help.adobe.com/en_US/flex/mobileapps/WSa122979b4619725672e48c412a3e152164-7fff.html
Check out the section called "Return data from a view"
iBrent

Similar Messages

  • Navigator.pushView() Problems

    I having problems with navigator.pushView(MyView), and problem is - it creates all the time NEW instance of the MyView!!!??
    I do navigator.pushView(MyView), it switches to MyView, the I hit back button, then navigator.pushView(MyView) again, and the object reference is new! But thing is that OLD MyView view still exists and receiving events, it messing up stuff!!!
    Any suggestions?

    It sounds like something outside of MyView is keeping a hard reference
    to it so it is not getting garbage collected. It could also be the
    destruction policy in MyView is set to "never".

  • Buttons navigation

    I'm just getting started using Flash Builder and need some help. Is there a way for me to make a button that will send a user to a different screen randomly. I'm a teacher and trying to create a math app for my students, where after there answer a question correctly, it sends them to the next question at random. Here is the code I have thus far, but it will only send them to the next question. Thanks for any help!
    <s:Button x="324" y="273" label="Next Question"
                  click="navigator.pushView(question2)" styleName="back" />

    Turn the click handler into a full on separate function. Then store all the views in an array and use Math.rand() to randomly choose one.
    Something like this:
    <fx:Script>
         <![CDATA[
              var questionsArray:Array = {question2,question3,question5,questionRed,questionGeography};
              function buttonClickHandler(event:MouseEvent){
                   var randomProblem:int = Math.floor(Math.random()*(questionsArray.length));     //generates a random integer between 0 and the total number of questions in the array (arrays are 0-based)
                   navigator.pushView(questionsArray[randomProblem]);
         ]]>
    </fx:Script>
    <s:Button id="randomProblemButton" label="Next Problem" click="buttonClickHandler(event)" />
    Haven't tested that, but something along that line should work

  • MobileApplication / View / Navigator issue

    I've ran into an issue I can't seem to resolve. I have a main view with a Label and a Timer. The timer executes once a second and updates the label with the current time. All is great.
    But,
    If I hit a button to go to another view via navigator.pushview(SecondView) I can still see the timer is still running via trace/console.
    On the second view I press a button and call navigator.popView to go back to the previous page.
    Now, the timer is still running, I can still see the timer event being called but now the Label is no longer being updated with the time, it simply shows the default initalized value.
    Can someone please shed some light on this. I really need to be able to return to the first view and have it operating just like I left it.
    Tom

    Unlike the ViewStack in desktop flash, a ViewNavigator only ever has one child in memory at a time. What that means is that when you push a new view on to the view navigator, the existing view is eligible for garbage collection.  When you pop the second view, you are not returned to that view you saw originally, a new one is created.
    The real problem exists because there are event listeners tied to that view, it will never be Garbage Collected (as I understand it ) and so you will always continue to see those events fire.
    Knowing how this works what you need to do is utilize the activate and deactivate events of the View to setup and destroy your timer object.  I have written an example of this and posted it on github.
    Take a look at this and see if it helps you sort out how your view should work.
    https://gist.github.com/951965
    HTH,
    sim

  • Memory leak when pushView an popView

    Hello to community!
    I am having problems of memory leaks with an app I had build. After using it for 30-40 min it begin to go slow and slow.
    The app show images as a catalog, but when I push and pop the views my memory rise a lot.
    I think I am deleting all my oibjects setting them to to null and disposing all de bitmapdata that I use so I think that the problem should not be there.
    I have 3 views in my app menuView.mxml,categoriesView.mxml and productsView.mxml.
    My App begin in my pc (not in tablet) with TotalMemory: 47Mb and Private Memory : 88 MB
    After pushing and poping the views for 5 times I get TotalMemory: 61Mb and Private Memory : 101 MB
    Imagine if I do this for 20 times, all the app begin to go very slow in my Ipad or my Samsung Galaxy Tab.
    Why is this happening? I have no idea how to solve this.
    Thanks a lot!!
    I put some code below.
    Whe I am in menuView i use the following code to push the view from menuView to categoriesView
    protected function button3_clickHandler(event:MouseEvent):void
                    if((FlexGlobals.topLevelApplication.getIdClienteServidorCompraActual()!=null)&&(FlexGloba ls.topLevelApplication.getIdClienteServidorCompraActual()>0))
                        navigator.pushView(categoriesView);
    Whe I am in categoriesView i use the following code to push the view from categoriesView to productsView. In this view i have 3 button for each category.
    protected function buttonC1_clickHandler(event:MouseEvent):void
                    //Categoria general con todos
                    var ab:ArrayCollection =  getIdAmbienteServidor();
                    cleanMemory();
                    navigator.pushView(productsView, null);
    private function cleanMemory():void
                    result.splice(0);
                    result = null;
                    System.gc();
    Whe I am in productsView I use the following code to pop(I USE PUSH INSTEAD OF POP DUE TO DIFFERENT OPTIONS I HAVE) the view from productsView to categoriesView .
    protected function button1_clickHandler(event:MouseEvent):void
                    cleanMemory();               
                    navigator.pushView(menuView);        
    private function cleanMemory():void
                    if(image1 != null)
                        image1.source = "";
                        if(image1.bitmapData != null)
                            image1.bitmapData.dispose();
                    if(image2 != null)
                        image2.source = "";
                        if(image2.bitmapData != null)
                            image2.bitmapData.dispose();
                    if(result != null)
                        result.splice(0);
                        result = null;
                    if(result1 != null)
                        result1.splice(0);
                        result1 = null;
                    if(result2 != null)
                        result2.splice(0);
                        result2 = null;
                    dbConnection = null;
                    object1 = null;
                    object2 = null;
                    dataToSave = null;
                    cGreyImageSmallAsset = null;
                    cRedImageSmallAsset.bitmapData.dispose();
                    cRedImageSmallAsset = null;
                    cOrangeImageAsset.bitmapData.dispose();
                    cOrangeImageAsset = null;
                    cGreenImageAsset.bitmapData.dispose();
                    cGreenImageAsset = null;
                    cPinkImageAsset.bitmapData.dispose();
                    cPinkImageAsset = null;
                    cBlueImageAsset.bitmapData.dispose();
                    cBlueImageAsset = null;
                    cGreyImageAsset.bitmapData.dispose();
                    cGreyImageAsset = null;
                    cRedImageAsset.bitmapData.dispose();
                    cRedImageAsset = null;
                    cGreenImageSmall = null;
                    cOrangeImageSmall = null;
                    cPinkImageSmall = null;
                    cBlueImageSmall = null;
                    cGreyImageSmall = null;
                    cRedImageSmall= null;
                    cGreenImage = null;
                    cPinkImage = null;
                    cBlueImage= null;
                    cGreyImage = null;
                    cRedImage= null;
                    cOrangeImage= null;
                    System.gc();
    I load the images with.
    private function setImages():void
                    //var width:Number = FlexGlobals.topLevelApplication.width;
                    if(object1!=null)
                        //var widthImage1:Number = (width/2)-80;
                        //image1.width = widthImage1;
                        panelLeft.visible = true;
                        buttonLeftMore.visible = true;
                        image1.source = "file://" + File.applicationStorageDirectory.nativePath + "/b"+object1.idArchivo+"_500.jpg";
                        setObject1MainTexts();
                    else
                        image1.source = "";
                        panelLeft.visible = false;
                        buttonLeftMore.visible = false;
                    if(object2!=null)
                        //var widthImage2:Number = (width/2)-80;
                        //image2.width = widthImage2;
                        panelRight.visible = true;
                        buttonRightMore.visible = true;
                        image2.source = "file://" + File.applicationStorageDirectory.nativePath + "/b"+object2.idArchivo+"_500.jpg";
                        setObject2MainTexts();
                    else
                        image2.source = "";
                        panelRight.visible = false;
                        buttonRightMore.visible = false;
    Whe I am in categoriesView i use the following code to pop(I USE PUSH INSTEAD OF POP DUE TO DIFFERENT OPTIONS I HAVE) the view from categoriesView to menuView.
    protected function button1_clickHandler(event:MouseEvent):void
                    cleanMemory();
                    navigator.pushView(menuView);
    private function cleanMemory():void
                    result.splice(0);
                    result = null;
                    System.gc();

    Hello,
    I've the similar problem. I try to clean all objects, listeners and images. But i still have a memory leak.
    Do you found a solution, Richard ?
    Regards.

  • Send to pushView string to convert to viewClass

    i have problem with convert string to Class i try getDefinitionByName() >>> get undefined Varabile
    how can i do it
    function gotoView (currView:String):void{
    navigator.pushView(currView as Class );// error
    please help me to solve that

    String[] splitString = str.split(",");

  • How to change the default orientation?

    Hello,
         I'm new to Adobe Flash Builder and I am currently making a mobile application for a school project. I was wondering how you change the default app orientation to landscape. I've tried going into my app.xml and change the aspect ratio to landscape with no luck, and it is very hard to find any answers on the internet. I would greatly appreciate your help.
    HomeView.mxml 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"
                        actionBarVisible="false" tabBarVisible="false" title="HomeView">
              <fx:Declarations>
              </fx:Declarations>
              <s:Image left="0" right="0" top="0" bottom="0" scaleMode="zoom" smooth="true"
                                   smoothingQuality="high" source="@Embed('file:///C:/Users/Owner/Downloads/48127-solarsystem-teaser.jpg')"/>
              <s:Button x="-5" y="0" width="410" height="1504"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Sun)"/>
              <s:Button x="444" y="852" width="80" height="80"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Mercury)"/>
              <s:Button x="628" y="742" width="120" height="124"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Venus)"/>
              <s:Button x="836" y="632" width="127" height="117"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Earth)"/>
              <s:Button x="994" y="506" width="99" height="96"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Mars)"/>
              <s:Button x="1255" y="464" width="298" height="279"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Jupiter)"/>
              <s:Button x="1626" y="302" width="274" height="270"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Saturn)"/>
              <s:Button x="1965" y="196" width="175" height="174"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Uranus)"/>
              <s:Button x="2201" y="66" width="175" height="174"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Neptune)"/>
    </s:View>
    App.xml code:
    <!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape").
                                  Optional. Mobile only. Default is the natural orientation of the device -->
                        <!-- <aspectRatio>landscape</aspectRatio> -->
                        <!-- Whether the app will begin auto-orienting on launch. Optional. Mobile
                                  only. Default false -->
                        <!-- <autoOrients>false</autoOrients> -->
    I need to make it so that the app is permanently in landscape.
    Thanks again.
         8th grade student

    <!-- <aspectRatio>landscape</aspectRatio> -->
    <!-- <autoOrients>false</autoOrients> -->
    In XML, everything within <!-- and --> is a comment.  You need to remove the <!-- and -->:
    <aspectRatio>landscape</aspectRatio>
    <autoOrients>false</autoOrients>

  • Trigger an event in the parent view, when popping a child view (Mobile)

    So from one view I'm pushing another view with some data:
    <s:Button label="Edit System" click="navigator.pushView(EditSystem, systems.selectedItem)"/>
    The problem I have is that in this other view I'm updating a view things in my sqlite database, so when I pop the 'EditSystem' view and return to the original, I want to run a function to requery the the sql so I can update a view things in the original view. But from what I can fugure Eventlisteners dont work across views? How do I trigger an event in the original view when I return from a child view via pop? 

    You should find this post useful: http://flexponential.com/2010/12/05/saving-scroll-position-between-views-in-a-mobile-flex- application/
    It demonstrates one way of saving and restoring data when pushing and popping a view.

  • Issue Putting Data from ArrayCollection into List

    I'm having trouble getting data that has been pulled from a textArea and put into an ArrayCollection to be displayed in a List.  The data is being saved and then read as a file from local storage.  When I run the application, nothing appears in the created list even though I get no compile-time errors.
    Here is my List code:
    <fx:Script>
    <![CDATA[
    import dh.DataHandling;
    import mx.collections.ArrayCollection;
    import mx.collections.ArrayList;
    import mx.events.FlexEvent;
    import spark.effects.SlideViewTransition;
    [Bindable]
    private var dataR:DataHandling = new DataHandling();
    protected function button1_clickHandler(event:MouseEvent):void  // pushed home button
    var svt:SlideViewTransition = new SlideViewTransition(300, SlideViewTransition.SLIDE_RIGHT);
    navigator.pushView(views.HomePage, event.relatedObject, svt);
    ]]>
    </fx:Script>
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:actionContent>
    <s:Button label="Delete"/>
    <s:Button label="Home" click="button1_clickHandler(event)" skinClass="skins.homeButtonSkin"/>
    </s:actionContent>
    <s:Image x="0" y="-80" height="603" source="mainapp1.jpg"/>
    <s:List  id="myCardsList" x="10" y="10" width="1004" height="500" top="0" bottom="0" left="0" right="0"
      dataProvider="{dataR.cards as ArrayCollection}">
    <s:itemRenderer>
    <fx:Component>
    <s:MobileIconItemRenderer label="{data.textTitle}"/>
    </fx:Component>
    </s:itemRenderer>
    </s:List>
    Here's the "saving/reading the file" class used in creating the ArrayCollection:  ( DataHandling.as )
    package dh
    public class DataHandling
    import flash.events.IOErrorEvent;
    import flash.filesystem.File;
    import flash.filesystem.FileMode;
    import flash.filesystem.FileStream;
    import mx.collections.ArrayCollection;
    [Bindable]
    public var cards:ArrayCollection = new ArrayCollection();
    public var file:File;
    public var fileStream:FileStream;
    public var fileName:String = "Initial String";
    public var directory:String = "SimpleSaveFromAIR";
    public var textTitle:String;
    public function DataHandling()
    public function add():void
    // new object
    var card:Object = new Object();
    card.tcard = textTitle;
    //card.mtext1 = mtext1.text;
    ///card.mtext2 = mtext2.text;
    cards.addItem(card);
    public function save():void
    // create file object (resolve user's directory, add own directory)
    file = File.documentsDirectory.resolvePath(directory + "\\" + fileName);
    // FileStream for writing the file
    fileStream = new FileStream();
    // open the file in write mode
    fileStream.open(file, FileMode.WRITE);
    // Write the ArrayCollection object of cards to the file
    fileStream.writeObject(cards);
    // close stream
    fileStream.close();
    public function read():void
    // get correct path
    file = File.documentsDirectory.resolvePath(directory + "\\" + fileName);
    // read if exists
    if(file.exists)
    // FileStream for reading the file
    fileStream = new FileStream();
    // open the file in read mode
    fileStream.open(file, FileMode.READ);
    // Read the ArrayCollection object of cards from the file
    cards = fileStream.readObject() as ArrayCollection;
    //close Stream
    fileStream.close();
    else
    // some sample data + save if file does not exist
    cards = new ArrayCollection();
    var card:Object = new Object();
    card.tcard = "Sample Title";
    card.mtext1 = "Sample Text";
    cards.addItem(card);
    save();

    Off topic: I noticed you are binding the label value of the renderer to the data.  It's recommended that you use the labelField property on the List instead for better performance on mobile, for example:
    <s:List  id="myCardsList" labelField="textTitle" ...>
      <s:itemRenderer>
        <fx:Component>
          <s:MobileIconItemRenderer />
        </fx:Component>
      </s:itemRenderer>
    </s:List>

  • Flex Mobile - Php INSERT

    Hello everybody, im a novice on Developpement using Flex.
    im working on a project which will be runned on BlackBerry Tablet (PlayBook), im using FlashBuilder Burrito + AIR SDK
    my project is a CRUD application, so i follow this tutorial http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html and it works
    now i try to do the same things on my DataBase, i can retrieve data but i can't Insert or Delete ...
    this is the code of my application :
    <?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"
              xmlns:valueObjects="valueObjects.*"
              xmlns:affiliesservice="services.affiliesservice.*"
              title="Accueil">
         <fx:Script>
              <![CDATA[
                   import mx.rpc.events.ResultEvent;
                   protected function saveBtn_clickHandler(event:MouseEvent):void
                        aff.longitude=11111.1;
                        aff.lattitude=11111.3;
                        createAffilies(aff);
                   protected function createAffilies(item:Affilies):void
                        createAffiliesResult.token = affiliesService.createAffilies(item);
                   protected function createAffiliesResult_resultHandler(event:ResultEvent):void
                        navigator.popView();
                        navigator.pushView(ajoutValides);
              ]]>
         </fx:Script>
         <fx:Declarations>
              <valueObjects:Affilies id="aff" />
              <s:CallResponder id="createAffiliesResult" result="createAffiliesResult_resultHandler(event)"/>
              <affiliesservice:AffiliesService id="affiliesService"/>
         </fx:Declarations>
         <s:Scroller left="0" right="0" top="0" bottom="103">
              <s:VGroup x="38" y="110" width="100%" height="100%" gap="15" paddingBottom="15"
                          paddingLeft="15" paddingRight="15" paddingTop="15">
                   <s:Label text="Nom"/>
                   <s:TextInput width="100%" text="@{aff.nom}"/>
                   <mx:Spacer height="5"/>
                   <s:Label text="Adresse"/>
                   <s:TextInput width="100%" text="@{aff.adr}"/>
                   <mx:Spacer height="5"/>
                   <s:Label text="Telephone"/>
                   <s:TextInput width="100%" text="@{aff.tel}"/>
                   <mx:Spacer height="5"/>
                   <s:Label text="Url"/>
                   <s:TextInput width="100%" text="@{aff.lien}"/>
                   <mx:Spacer height="5"/>
              </s:VGroup>
         </s:Scroller>
         <s:Button id="saveBtn" left="10" bottom="10" width="45%" label="Save"
                     click="saveBtn_clickHandler(event)"/>
         <s:Button id="cancelBtn" right="17" bottom="10" width="45%" label="Cancel"/>
    </s:View>
    and for the service i generate it automatically and this is the code :
    <?php
    *  README for sample service
    *  This generated sample service contains functions that illustrate typical service operations.
    *  Use these functions as a starting point for creating your own service implementation. Modify the
    *  function signatures, references to the database, and implementation according to your needs.
    *  Delete the functions that you do not use.
    *  Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh
    *  the service. Then drag service operations onto user interface components in Design View. For
    *  example, drag the getAllItems() operation onto a DataGrid.
    *  This code is for prototyping only.
    *  Authenticate the user prior to allowing them to call these methods. You can find more
    *  information at http://www.adobe.com/go/flex_security
    class AffiliesService {
         var $username = "root";
         var $password = "root";
         var $server = "localhost";
         var $port = "3306";
         var $databasename = "expressway";
         var $tablename = "affilies";
         var $connection;
          * The constructor initializes the connection to database. Everytime a request is
          * received by Zend AMF, an instance of the service class is created and then the
          * requested method is invoked.
         public function __construct() {
                $this->connection = mysqli_connect(
                                              $this->server, 
                                              $this->username, 
                                              $this->password,
                                              $this->databasename,
                                              $this->port
              $this->throwExceptionOnError($this->connection);
          * Returns all the rows from the table.
          * Add authroization or any logical checks for secure access to your data
          * @return array
         public function getAllAffilies() {
              $stmt = mysqli_prepare($this->connection, "SELECT * FROM affilies");         
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              $rows = array();
              mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
             while (mysqli_stmt_fetch($stmt)) {
               $rows[] = $row;
               $row = new stdClass();
               mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
              mysqli_stmt_free_result($stmt);
             mysqli_close($this->connection);
             return $rows;
          * Returns the item corresponding to the value specified for the primary key.
          * Add authorization or any logical checks for secure access to your data
          * @return stdClass
         public function getAffiliesByID($itemID) {
              $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where id=?");
              $this->throwExceptionOnError();
              mysqli_stmt_bind_param($stmt, 'i', $itemID);         
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
              if(mysqli_stmt_fetch($stmt)) {
               return $row;
              } else {
               return null;
          * Returns the item corresponding to the value specified for the primary key.
          * Add authorization or any logical checks for secure access to your data
          * @return stdClass
         public function createAffilies($item) {
              $stmt = mysqli_prepare($this->connection, "INSERT INTO affilies (nom, adr, tel, longitude, lattitude, lien) VALUES (?, ?, ?, ?, ?, ?)");
              $this->throwExceptionOnError();
              mysqli_stmt_bind_param($stmt, 'sssdds', $item->nom, $item->adr, $item->tel, $item->longitude, $item->lattitude, $item->lien);
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);         
              $this->throwExceptionOnError();
              $autoid = mysqli_stmt_insert_id($stmt);
              mysqli_stmt_free_result($stmt);         
              mysqli_close($this->connection);
              return $autoid;
          * Updates the passed item in the table.
          * Add authorization or any logical checks for secure access to your data
          * @param stdClass $item
          * @return void
         public function updateAffilies($item) {
              $stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET nom=?, adr=?, tel=?, longitude=?, lattitude=?, lien=? WHERE id=?");         
              $this->throwExceptionOnError();
              mysqli_stmt_bind_param($stmt, 'sssddsi', $item->nom, $item->adr, $item->tel, $item->longitude, $item->lattitude, $item->lien, $item->id);         
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);         
              $this->throwExceptionOnError();
              mysqli_stmt_free_result($stmt);         
              mysqli_close($this->connection);
          * Deletes the item corresponding to the passed primary key value from
          * the table.
          * Add authorization or any logical checks for secure access to your data
          * @return void
         public function deleteAffilies($itemID) {
              $stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE id = ?");
              $this->throwExceptionOnError();
              mysqli_stmt_bind_param($stmt, 'i', $itemID);
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              mysqli_stmt_free_result($stmt);         
              mysqli_close($this->connection);
          * Returns the number of rows in the table.
          * Add authorization or any logical checks for secure access to your data
         public function count() {
              $stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename");
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              mysqli_stmt_bind_result($stmt, $rec_count);
              $this->throwExceptionOnError();
              mysqli_stmt_fetch($stmt);
              $this->throwExceptionOnError();
              mysqli_stmt_free_result($stmt);
              mysqli_close($this->connection);
              return $rec_count;
          * Returns $numItems rows starting from the $startIndex row from the
          * table.
          * Add authorization or any logical checks for secure access to your data
          * @return array
         public function getAffilies_paged($startIndex, $numItems) {
              $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?");
              $this->throwExceptionOnError();
              mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems);
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              $rows = array();
              mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
             while (mysqli_stmt_fetch($stmt)) {
               $rows[] = $row;
               $row = new stdClass();
               mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
              mysqli_stmt_free_result($stmt);         
              mysqli_close($this->connection);
              return $rows;
          * Utility function to throw an exception if an error occurs
          * while running a mysql command.
         private function throwExceptionOnError($link = null) {
              if($link == null) {
                   $link = $this->connection;
              if(mysqli_error($link)) {
                   $msg = mysqli_errno($link) . ": " . mysqli_error($link);
                   throw new Exception('MySQL Error - '. $msg);
    ?>
    and i can't even find an error !! could anyone help me or even give me a solution to read the error report.
    thx.

    so... while no one find the probleme or even give me an answer to it, i search another solution that correspond to my knowledge and i found : As-SQL it's easy to use and while u don't need to manage a lot of data this solution will be helpfull.
    any way, even if i found another solution i still want to know the problem.

  • How to push a view to another view to a specific State in Mobile App?

    I want to open a second view that contains some states from the first view.
    Example: myFirstView  with a spark list component:
    So far I got this code for the view of the list to push to the other views:
    <fx:Script>
            <![CDATA[
                import spark.events.IndexChangeEvent;
                protected function selectionChangingHandler(event:IndexChangeEvent):void
                    if(myList.selectedIndex == 0){
                        navigator.pushView(mysecondView);
                    } else if (myList.selectedIndex == 1){
                        navigator.pushView(myThirdView);
                    } else if (myList.selectedIndex == 2){
                        navigator.pushView(myFouthView);
            ]]>
    <s:List id="myList" width="100%" height="100%"
                alternatingItemColors="[#EEEEEE, #E3E3E3]" change="selectionChangingHandler(event)">
                <s:dataProvider>
                    <s:ArrayList>
                        <fx:Object label="newView 1" />
                        <fx:Object label="newView 2" />
                        <fx:Object label="newView 3" />
                    </s:ArrayList>
                </s:dataProvider>
            </s:List>
    This code push to the views but I need to go to  any of the states in each view.
    And mysecondview  let's say with 3 States:
    <s:State name="myState1"/>
    <s:State name="myState2"/>
    <s:State name="myState3"/>
    From the fisrt view list to go, let's say to mySecondView > myState 1, 2 or 3
    Any help?
    Hope is wel explained
    Thanks in advance

    Hi,
       I am having view1 and view2.
      in view1 i am using roadmap. S1 is one of the step of road map.
      in view1 i used this code to get the reference of this view in componentcontroller attribute
    Data: lo_api TYPE REF TO if_wd_view_controller.
    If first_time = 'X'.
    lo_api = wd_this->wd_get_api( ).
    wd_Comp_Controller->my_VIEW = lo_api.
    endif.
    in my view2 i want to access the roadmap step
    i dono how to access that.. i used this code.......
             wd_comp_controller->my_view->get_element( 'S1' ).
    is this correct.. If not what is the code to get that id..
    Can any one tell me clearly...

  • Could not resolve mx:DataGrid to a component implementation

    I'm very new at this. Building a mobile app. Running the latest Flex/FlashBuilder (4.6). When I compile I get this error: "could not resolve <mx:DataGrid> to a component implementation". Here is my code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- dpcontrols/DataGridPassData.mxml -->
    <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="Jobs List">
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.*;
                                  private var DGArray:Array = [
                                            {Lease:'Bagby Heirs', Well:'1', Location:'Quitman', Customer:'Fair Oil Company', ScheduleDate:'2/23/2012', ServiceDate:'5/16/2012'},
                                            {Lease:'ITU', Well:'301', Location:'Ingram Trinity', Customer:'Southwest Operating, Inc.', ScheduleDate:'3/19/2012', ServiceDate:'4/25/2012'},
                                            {Lease:'ITU', Well:'81', Location:'ITU', Customer:'Southwest Operating, Inc.', ScheduleDate:'3/19/2012', ServiceDate:'4/25/2012'},
                                            {Lease:'Tolliver A', Well:'5', Location:'Turner Town', Customer:'SEDI', ScheduleDate:'4/16/2012', ServiceDate:'5/11/2012'},
                                            {Lease:'W R Cady', Well:'1', Location:'Coffield', Customer:'Green River Resource', ScheduleDate:'5/9/2012', ServiceDate:'4/10/2012'},
                                            {Lease:'Royal National Bar', Well:'2', Location:'Coffield', Customer:'Green River Resource', ScheduleDate:'5/9/2012', ServiceDate:'4/10/2012'},
                                            {Lease:'Pan American L', Well:'1', Location:'Chandler', Customer:'East Texas Oil & Gas', ScheduleDate:'5/14/2012', ServiceDate:'6/8/2012'},
                                            {Lease:'Paluxy B Sand', Well:'5', Location:'West Tyler', Customer:'Culver & Cain', ScheduleDate:'6/1/2012', ServiceDate:'5/25/2012'},
                                            {Lease:'Wh Pittman Hei', Well:'2', Location:'Quitman', Customer:'Southwest Operating, Inc.', ScheduleDate:'7/10/2012', ServiceDate:'6/18/2012'},
                                            {Lease:'Vivian Pruitt', Well:'1', Location:'Crow - Hwy 80M', Customer:'Buffco Productions, Inc.', ScheduleDate:'8/7/2012', ServiceDate:'8/29/2012'}
                                  [Bindable]
                                  public var initDG:ArrayList;
                                  //Initialize initDG ArrayList variable from the Array.
                                  //If you use this technique to process an HTTPService,
                                  //WebService, or RemoteObject result, use an ArrayCollection
                                  //rather than an ArrayList.
                                  public function initData():void {
                                            initDG=new ArrayList(DGArray);
                        ]]>
              </fx:Script>
              <!--s:states>
              <s:State name="loginState"/>
              <s:State name="State1"/>
              </s:states-->
              <fx:Declarations>
                        <!-- Place non-visual elements (e.g., services, value objects) here -->
                          <fx:Component className="AlertMsgDay">
                                  <s:SkinnablePopUpContainer x="70" y="300">
                                            <s:TitleWindow title="Filtering" close="close()">
                                                      <s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
                                                                <s:Label text="This button will filter jobs to show only TODAY."/>
                                                                <s:Button label="OK" click="close()"/>
                                                      </s:VGroup>
                                            </s:TitleWindow>
                                  </s:SkinnablePopUpContainer>
                        </fx:Component>
                        <fx:Component className="AlertMsgWeek">
                                  <s:SkinnablePopUpContainer x="70" y="300">
                                            <s:TitleWindow title="Filtering" close="close()">
                                                      <s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
                                                                <s:Label text="This button will filter jobs to show only THIS WEEK."/>
                                                                <s:Button label="OK" click="close()"/>
                                                      </s:VGroup>
                                            </s:TitleWindow>
                                  </s:SkinnablePopUpContainer>
                        </fx:Component>
              </fx:Declarations>
              <s:BorderContainer x="10"  y="111" borderColor="#808080" cornerRadius="5" borderWeight="2" width="98%" height="369">
                        <s:Scroller width="100%" height="363" verticalScrollPolicy="on">
                                  <s:Group width="100%" height="100%">
                                            <mx:DataGrid id="myGrid" width="900" height="350" dataProvider="{initDG}" >  <<<< THE ERROR IS HERE
                                                      <mx:columns>
                                                                <mx:DataGridColumn dataField="Lease" />
                                                                <mx:DataGridColumn dataField="Well" />
                                                                <mx:DataGridColumn dataField="Location" />
                                                                <mx:DataGridColumn dataField="Customer" />
                                                                <mx:DataGridColumn dataField="ScheduleDate" headerText="Schedule Date" />
                                                                <mx:DataGridColumn dataField="ServiceDate" headerText="Service Date" />
                                                      </mx:columns>
                                            </mx:DataGrid>
                                  </s:Group>
                        </s:Scroller>
              </s:BorderContainer>
              <s:Label x="10" y="10" width="96" height="53" fontSize="24" text="Sort by:"
                                   verticalAlign="middle"/>
              <s:Button id="btn_show_today" x="104" y="11" width="105" height="53" label="Today"
                                    fontSize="13" fontWeight="bold" click="(new AlertMsgDay()).open(this, false);"/>
              <s:Button id="btn_show_week" x="216" y="11" width="105" height="53" label="Week"
                                    fontSize="13" fontWeight="bold" click="(new AlertMsgWeek()).open(this, false);"/>
              <s:Button x="348" y="10" width="184" height="53" label="Edit this Job" fontSize="18" click="navigator.pushView(views.JobFormView);"/>
    </s:View>

    I'm very new at this. Building a mobile app. Running the latest Flex/FlashBuilder (4.6). When I compile I get this error: "could not resolve <mx:DataGrid> to a component implementation". Here is my code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- dpcontrols/DataGridPassData.mxml -->
    <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="Jobs List">
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.*;
                                  private var DGArray:Array = [
                                            {Lease:'Bagby Heirs', Well:'1', Location:'Quitman', Customer:'Fair Oil Company', ScheduleDate:'2/23/2012', ServiceDate:'5/16/2012'},
                                            {Lease:'ITU', Well:'301', Location:'Ingram Trinity', Customer:'Southwest Operating, Inc.', ScheduleDate:'3/19/2012', ServiceDate:'4/25/2012'},
                                            {Lease:'ITU', Well:'81', Location:'ITU', Customer:'Southwest Operating, Inc.', ScheduleDate:'3/19/2012', ServiceDate:'4/25/2012'},
                                            {Lease:'Tolliver A', Well:'5', Location:'Turner Town', Customer:'SEDI', ScheduleDate:'4/16/2012', ServiceDate:'5/11/2012'},
                                            {Lease:'W R Cady', Well:'1', Location:'Coffield', Customer:'Green River Resource', ScheduleDate:'5/9/2012', ServiceDate:'4/10/2012'},
                                            {Lease:'Royal National Bar', Well:'2', Location:'Coffield', Customer:'Green River Resource', ScheduleDate:'5/9/2012', ServiceDate:'4/10/2012'},
                                            {Lease:'Pan American L', Well:'1', Location:'Chandler', Customer:'East Texas Oil & Gas', ScheduleDate:'5/14/2012', ServiceDate:'6/8/2012'},
                                            {Lease:'Paluxy B Sand', Well:'5', Location:'West Tyler', Customer:'Culver & Cain', ScheduleDate:'6/1/2012', ServiceDate:'5/25/2012'},
                                            {Lease:'Wh Pittman Hei', Well:'2', Location:'Quitman', Customer:'Southwest Operating, Inc.', ScheduleDate:'7/10/2012', ServiceDate:'6/18/2012'},
                                            {Lease:'Vivian Pruitt', Well:'1', Location:'Crow - Hwy 80M', Customer:'Buffco Productions, Inc.', ScheduleDate:'8/7/2012', ServiceDate:'8/29/2012'}
                                  [Bindable]
                                  public var initDG:ArrayList;
                                  //Initialize initDG ArrayList variable from the Array.
                                  //If you use this technique to process an HTTPService,
                                  //WebService, or RemoteObject result, use an ArrayCollection
                                  //rather than an ArrayList.
                                  public function initData():void {
                                            initDG=new ArrayList(DGArray);
                        ]]>
              </fx:Script>
              <!--s:states>
              <s:State name="loginState"/>
              <s:State name="State1"/>
              </s:states-->
              <fx:Declarations>
                        <!-- Place non-visual elements (e.g., services, value objects) here -->
                          <fx:Component className="AlertMsgDay">
                                  <s:SkinnablePopUpContainer x="70" y="300">
                                            <s:TitleWindow title="Filtering" close="close()">
                                                      <s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
                                                                <s:Label text="This button will filter jobs to show only TODAY."/>
                                                                <s:Button label="OK" click="close()"/>
                                                      </s:VGroup>
                                            </s:TitleWindow>
                                  </s:SkinnablePopUpContainer>
                        </fx:Component>
                        <fx:Component className="AlertMsgWeek">
                                  <s:SkinnablePopUpContainer x="70" y="300">
                                            <s:TitleWindow title="Filtering" close="close()">
                                                      <s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
                                                                <s:Label text="This button will filter jobs to show only THIS WEEK."/>
                                                                <s:Button label="OK" click="close()"/>
                                                      </s:VGroup>
                                            </s:TitleWindow>
                                  </s:SkinnablePopUpContainer>
                        </fx:Component>
              </fx:Declarations>
              <s:BorderContainer x="10"  y="111" borderColor="#808080" cornerRadius="5" borderWeight="2" width="98%" height="369">
                        <s:Scroller width="100%" height="363" verticalScrollPolicy="on">
                                  <s:Group width="100%" height="100%">
                                            <mx:DataGrid id="myGrid" width="900" height="350" dataProvider="{initDG}" >  <<<< THE ERROR IS HERE
                                                      <mx:columns>
                                                                <mx:DataGridColumn dataField="Lease" />
                                                                <mx:DataGridColumn dataField="Well" />
                                                                <mx:DataGridColumn dataField="Location" />
                                                                <mx:DataGridColumn dataField="Customer" />
                                                                <mx:DataGridColumn dataField="ScheduleDate" headerText="Schedule Date" />
                                                                <mx:DataGridColumn dataField="ServiceDate" headerText="Service Date" />
                                                      </mx:columns>
                                            </mx:DataGrid>
                                  </s:Group>
                        </s:Scroller>
              </s:BorderContainer>
              <s:Label x="10" y="10" width="96" height="53" fontSize="24" text="Sort by:"
                                   verticalAlign="middle"/>
              <s:Button id="btn_show_today" x="104" y="11" width="105" height="53" label="Today"
                                    fontSize="13" fontWeight="bold" click="(new AlertMsgDay()).open(this, false);"/>
              <s:Button id="btn_show_week" x="216" y="11" width="105" height="53" label="Week"
                                    fontSize="13" fontWeight="bold" click="(new AlertMsgWeek()).open(this, false);"/>
              <s:Button x="348" y="10" width="184" height="53" label="Edit this Job" fontSize="18" click="navigator.pushView(views.JobFormView);"/>
    </s:View>

  • Need help for flash builder

    i need help for flash builder 4 and papervison 3d. I need to create a slider with it ranges of value from 10 to 50 to adjust the camera values for the camera.fov and also need to create it for the yaw of the object from 0 to 360. I try to look for any slider event and classes in this program but cant find any, btw, i need to use the AS only project file.
    here is my codes:
    can you please tell me how i should modify the codes?
    package
        import flash.display.BitmapData;
        import flash.display.Sprite;
        import flash.events.Event;
        import org.papervision3d.materials.BitmapFileMaterial;
        import org.papervision3d.materials.BitmapMaterial;
        import org.papervision3d.objects.primitives.Sphere;
        import org.papervision3d.view.BasicView;
        [SWF (width="800", height="600", backgroundColor="0x000000",frameRate="30")]
        public class EarthBitmap extends BasicView
            private var sphere:Sphere;
            public function EarthBitmap()
                super(800 , 600);
                var earthmaterial:BitmapFileMaterial = new BitmapFileMaterial("../assets/Earth.jpg");
                sphere = new Sphere(earthmaterial,100,20,18);
                camera.fov = 25;
                scene.addChild(sphere);
                addEventListener(Event.ENTER_FRAME,rotateSphere);
            public function rotateSphere(evt:Event):void
                sphere.yaw(0.2);
                singleRender();

    Turn the click handler into a full on separate function. Then store all the views in an array and use Math.rand() to randomly choose one.
    Something like this:
    <fx:Script>
         <![CDATA[
              var questionsArray:Array = {question2,question3,question5,questionRed,questionGeography};
              function buttonClickHandler(event:MouseEvent){
                   var randomProblem:int = Math.floor(Math.random()*(questionsArray.length));     //generates a random integer between 0 and the total number of questions in the array (arrays are 0-based)
                   navigator.pushView(questionsArray[randomProblem]);
         ]]>
    </fx:Script>
    <s:Button id="randomProblemButton" label="Next Problem" click="buttonClickHandler(event)" />
    Haven't tested that, but something along that line should work

  • Flex 4.5 mobile - inline CSS in htmlText

    I want to change one word of text to bold and change the text color, but my htmlText is not rendering:
    <?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="ReminderPro Basic" backgroundColor="0xCCFFCC"
    creationComplete="init();">
    <fx:Script>
      <![CDATA[
       import spark.components.supportClasses.StyleableTextField;
       private var greetingText1:String = "<span style='color: #FF0000; font-weight: bold'>ReminderPro</span> <span style='color: #660066'>makes it easy to create customizable alarms and reminders.</span>";
       [Bindable] private var greetingText2:String = "Great when you need an alarm that repeats, such as a reminder to check something in the over.";
       [Bindable] private var greetingText3:String = "Keep your kids accountable when limiting video game usage.";
       private function init():void{
        StyleableTextField(greetingTA1.textDisplay).htmlText = greetingText1;   
      ]]>
    </fx:Script>
    <s:layout>
      <s:VerticalLayout gap="20" paddingTop="50" paddingLeft="30"
       paddingRight="30" paddingBottom="50"
       horizontalAlign="center"/>
    </s:layout>
    <s:TextArea id="greetingTA1" width="100%" borderVisible="false"
      selectable="false" editable="false" skinClass="skins.CustomTextAreaSkin1"
      textAlign="center"/>
    <s:TextArea id="greetingTA2" width="100%" borderVisible="false"
        selectable="false" editable="false" skinClass="skins.CustomTextAreaSkin1"
        color="0x660066" textAlign="center" text="{greetingText2}"/>
    <s:TextArea id="greetingTA3" width="100%" borderVisible="false"
        selectable="false" editable="false" skinClass="skins.CustomTextAreaSkin1"
        color="0x660066" textAlign="center" text="{greetingText3}"/>
    <s:Spacer height="20"/>
    <s:Button label="New Reminder" click="navigator.pushView(views.NewReminderView)"/>
    <s:Spacer height="20"/>
    <s:Button label="Saved Reminders" click="navigator.pushView(views.SavedRemindersView)"/>
    </s:View>

    Hi Gregory,
    this is mobile project, yes?
    if you try that way it will work I think:
    private var greetingText1:String = "<font color='#FF0000'><b>ReminderPro</b></font> <font color='#660066'>makes it easy to create customizable alarms and reminders.</font>";
    http://help.adobe.com/en_US/flex/mobileapps/WS19f279b149e7481c-3c2dbaa612bb06a5ea2-8000.ht ml
    regards,
    Peter

  • FlipViewTransition in Sdk 4.6

    I'm getting this warning with the new SDK (and I can't find documentation about that!):
    'FlipViewTransition' has been deprecated since 4.6
                                                    var flipTrans:FlipViewTransition = new FlipViewTransition();
                                            flipTrans.direction = ViewTransitionDirection.RIGHT;
                                            flipTrans.mode = FlipViewTransitionMode.CUBE;
                                            navigator.pushView(DettagliView, data,null,flipTrans);

    You can disable deprecation warnings completely (-show-deprecation-warnings=false), or only for a specific version.
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf67670-7fd5.html#WS2d b454920e96a9e51e63e3d11c0bf69084-7eaf

Maybe you are looking for

  • IPod Nano Battery

    I just got an iPod nano (4th gen.) yesterday and I charged it until the battery was fully charged. I used the iPod for about 2 hours total today and the battery completely drained. I was playing some games, but mostly listening to music. Is this a pr

  • What does the iphone have that the ipod touch doesn't?

    i was just wondering what the iphone has that the ipod touch doesn't if there is anything. (Apart from the obvious phone and maybe the camera)

  • Upgrade from Mac OS X 10.4.11 to OS X Snow Leapard

    What do I need to purchase to upgrade my iMac software from OS X 10.4.11 to OS X Snow leapard. I have one computer with two users. Thanks

  • Image capture doesnt detect camera plugged in, why ?

    HI all I only found out how good image capture was a few weeks ago when I wanted to backup ALL the photos on my iPad my MBP detected the iPad instantly my mate plugs his camera into his MBP and image capture doesnt know it is there waiting for photos

  • BBB file - accessible by anyone?

    Hi everyone. If someone's gotten a hold of my BBB backup file (extraced via Blackberry Desktop Sofware) - could they restore it into any Blackberry device and access all files backed up in there? Emails, contacts etc... Thanks in advance.