Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============
- // LESSON 1
- //============
- //This line simply adds an event listener for the "Main Menu" button
- //by calling the function defined on the previous frame. As this will
- //be used in every frame from now on, it will not be mentioned again.
- mainmenuInstance.addEventListener(MouseEvent.CLICK, returnToMenu);
- // ==================================================================
- var node1:Number = 0
- //var node1Value:String = node1.toString();
- //currentNodeLesson1.text = node1.toString();
- nextPhrase.addEventListener(MouseEvent.CLICK, nextNode);
- function nextNode(event:MouseEvent):void
- {
- trace("NEXT");
- node1++;
- trace(node1);
- ParseData(xmlDataLesson1);
- }
- var xmlLoaderLesson1:URLLoader = new URLLoader();
- var xmlDataLesson1:XML = new XML();
- xmlLoaderLesson1.addEventListener(Event.COMPLETE, lesson1XML);
- xmlLoaderLesson1.load(new URLRequest("lesson1.xml"));
- XML.ignoreWhitespace = false;
- function lesson1XML(e:Event):void
- {
- xmlDataLesson1 = new XML(e.target.data);
- }
- function ParseData(dataInput:XML):void
- {
- trace("XML Output");
- trace("------------------------");
- trace(dataInput.phrase.norwegian.text()[node1]);
- lesson1Norwegian.text = dataInput.phrase.norwegian.text()[node1];
- //currentNodeLesson1.text = node1;
- //dataInput refers to the whole XML
- //phrase returns all <phrase> tags' contents
- //norwegian returns only <norwegian> tags within those
- //text() removes the tags when tracing
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement