0 Replies Latest reply on Nov 18, 2015 11:12 PM by huutaisc

    How can make a ebook app

    huutaisc

      Link BooksApp.FXP file : Dropbox - BooksApp.fxp

      ! !I have a ebook.xml like

      ============== EBook.xml ===========================

      <?xml version="1.0" encoding="utf-8"?>

      <list>

        <chapter>

          <id>1</id>

          <title>chapter 1</title>

          <content>An investigation by aviation experts using data from the aircraft's "black boxes" has yet to give its conclusions...

           </content>

        </chapter>

      <chapter>

          <id>2</id>

          <title>chapter 2</title>

          <content>An investigation by aviation experts using data from the aircraft's "black boxes" has yet to give its conclusions...

           </content>

        </chapter>

      <chapter>

          <id>3</id>

          <title>chapter 3</title>

          <content>An investigation by aviation experts using data from the aircraft's "black boxes" has yet to give its conclusions...

           </content>

      </chapter>

      <chapter>

          <id>4</id>

          <title>chapter 4</title>

          <content>An investigation by aviation experts using data from the aircraft's "black boxes" has yet to give its conclusions...

           </content>

      </chapter>

      </list>

      =========== ====================


      =============Ebooks.mxml=================

      Ebooks.mxml

      <?xml version="1.0" encoding="utf-8"?>

      <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

        xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.EbooksHomeView.mxml" applicationDPI="240">

        <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

        </fx:Declarations>

        <s:navigationContent>

        <s:Button icon="@Embed('assets/home.png')"

         click="navigator.popToFirstView()"/>

        </s:navigationContent>

      </s:ViewNavigatorApplication>

      =========================================================

       

      =============EbooksHomeView.mxml==========================

      EbooksHomeView.mxml

      <?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"

        creationComplete="srv.send()">

        <fx:Script>

        <![CDATA[

        import mx.binding.utils.BindingUtils;

       

        import spark.events.IndexChangeEvent;

       

       

        protected function list_changeHandler(event:IndexChangeEvent):void

        {

        // TODO Auto-generated method stub

        navigator.pushView(EbooksDetail,list.selectedItem);

        }

       

        ]]>

        </fx:Script>

        <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

        <s:HTTPService id="srv" url="assets/ebook.xml"

        result="data=srv.lastResult.list.chapter"/>

        </fx:Declarations>

       

       

        <s:navigationContent/>  <!-- remove button home -->

       

        <s:List id="list" top="0" bottom="0" left="0" right="0"

        dataProvider="{data}"

        change="list_changeHandler(event)">

        <s:itemRenderer>

        <fx:Component>

        <s:IconItemRenderer

        label="Chapter {data.id}: {data.title}"

        />

        </fx:Component>

        </s:itemRenderer>

        </s:List>

      </s:View>

      =============================================


      ==========EbooksDetail.mxml===================

      EbooksDetail.mxml

      <?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="Chương {data.id}: {data.title}">

       

        <fx:Script>

        <![CDATA[

        import flashx.textLayout.edit.SelectionState;

       

        import mx.events.IndexChangedEvent;

        protected function button1_clickHandler(event:MouseEvent):void

        {

        // TODO Auto-generated method stub

       

        navigator.pushView(EbooksDetail, ? );

        // navigator.popView();

        // navigator.popToFirstView();

        // navigator.popAll();

        // navigator.replaceView();

        }

       

        protected function button2_clickHandler(event:MouseEvent):void

        {

        // TODO Auto-generated method stub

       

        }

       

        ]]>

        </fx:Script>

       

        <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

        </fx:Declarations>

        <s:TextArea left="0" right="0" top="0" bottom="0" text="{data.content}"/>

        <s:Button x="361" y="620" label="next" click="button1_clickHandler(event)"/>

        <s:Button x="268" y="620" label="Pre" click="button2_clickHandler(event)"/>

      </s:View>

       

      In "button1_clickHandler" funtion , i don't know how to put  " arguments " to go next chapter .

      In "button2_clickHandler" funtion , i don't know how to put  " arguments " to go pre chapter .

      I'm a newbie with flash builder , So can anybody help me  ideas to solve that .

      Thank so much