• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

i need help in this! How to allow my "Back" button to go back to the previous question? PLease help

New Here ,
Jul 15, 2013 Jul 15, 2013

Copy link to clipboard

Copied

<?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="Qns 1" viewActivate="creationComplete()"

                    >

 

  <fx:Declarations>

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

 

  </fx:Declarations>

 

  <fx:Script>

 

 

                    <![CDATA[

 

 

 

         

 

                              private var myXML:XML;

 

                              private var myLoader:URLLoader;

 

 

                              private function creationComplete():void {

 

                                        var ran:Number=Math.round(Math.random()*40);

                                        trace(ran);

                                        myLoader = new URLLoader();

                                        myLoader.load(new URLRequest("assets/questions.xml"));

                                        myLoader.addEventListener(Event.COMPLETE, processXML);

                                        function processXML(e:Event):void {

                                                  myXML = new XML(e.target.data);

                                                  questionLabel.text = myXML.question[ran-1].text;  

                                                  ans1Btn.label=(myXML.question[ran-1].ans1.text());

                                                  ans2Btn.label=(myXML.question[ran-1].ans2.text());          

                                                  ans3Btn.label=(myXML.question[ran-1].ans3.text());          

 

 

 

                                        }

 

                              }

                    ]]>

 

 

 

 

  </fx:Script>

 

 

          <s:Image x="0" y="0" width="320" height="415" source="assets/qns1.jpg"/>

 

 

          <s:Button x="168" y="355" width="139" height="33" label="Next" click="navigator.pushView(qns2)"/>

 

 

 

 

          <s:Label id="questionLabel" x="25" y="35" width="267" height="79" color="#000000"

                               fontFamily="_sans" fontSize="16" fontStyle="normal" textAlign="center"

                               textDecoration="none"/>

              <s:Button x="26" y="355" width="134" height="33" label="Back" click="navigator.popView()"/>

 

          <s:Button id="ans1Btn" x="25" y="173" width="268" height="45" fontSize="12" />

          <s:Button id="ans2Btn" x="26" y="227" width="268" height="45" fontSize="12"/>

          <s:Button id="ans3Btn" x="26" y="289" width="268" height="45" fontSize="12"/>

 

 

</s:View>

Views

357

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines