0 Replies Latest reply on May 2, 2010 11:22 PM by baubaii

    as3 and label childs

    baubaii

      hi, how to make what every child could have its own tag, but not the last one in xml?

      here is my code:

       

       

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

      <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"

      xmlns:tagfiles="*"

      layout="absolute" width="630" height="400" backgroundColor="#000000"

      creationComplete="init();">

      <mx:Style>

      @font-face {

      src:url("fonts/TAHOMA.TTF");

      fontFamily: Tahoma;

      fontWeight: normal;

      advancedAntiAliasing: true;

      }

      .Labelrec

      {

      font-family: Tahoma;

      fontSize:11;

      fontThickness: 200;

      }

      ScrollBar

                  {

                      thumbSkin: Embed(source="img/scrool_thumb.png", scaleGridLeft="1", scaleGridTop="10", scaleGridRight="14", scaleGridBottom="43");

                      trackSkin: Embed(source="img/scroll_track.png", scaleGridLeft="1", scaleGridTop="22", scaleGridRight="16", scaleGridBottom="153");  

                      upArrowSkin: Embed(source="img/arrow_up.png");

                      downArrowSkin: Embed(source="img/arrow_down.png");

                  }

      </mx:Style>

      <mx:Fade alphaFrom="0" alphaTo="1" id="fin" />

      <mx:Script>

      <![CDATA[

      import mx.controls.*;

      import flash.events.Event;

      import flash.net.URLLoader;

       

       

      import mx.core.UIComponent;

      import mx.rpc.events.ResultEvent;

      import mx.rpc.http.HTTPService;

      import flash.events.MouseEvent;

       

      private var _node:Object;

      private var myXML:XML;

      private var myLoader:URLLoader;

      private var keyword:String;

      private var masyvas:Array;

      private var bb:VBox;

      private var holder:UIComponent;

       

      //private var _node:Object;

       

      public function init():void {

      fin.play([can]);

      fin.play([myVBox]);

      goTagGo();

       

      }

       

      public function goTagGo():void {

       

      var service : HTTPService = new HTTPService();

      service.url = 'data/projektai.php';

             service.addEventListener(ResultEvent.RESULT, xmlLoaded);

            service.send();

       

        

      }

       

      public function xmlLoaded(e:Event):void {

      trace("xml loaded");

      var result:* = HTTPService(e.target).lastResult;

       

      for each (var tag:Object in result.tags.tag )  {

      var mc = gimdom(tag);


       

      }

      }

      public function gimdom(node:Object):void {

      _node=node;

      var myButton:Label = new Label();

                  myButton.htmlText = "<font color=\"#ae917c\">" + node.name + "</font>" +

                  " <font color=\"#a0a0a0\">" + node.text + "</font>";

      myButton.mouseChildren = false;

      myButton.buttonMode = true;

      myButton.useHandCursor = true;

      myButton.width=500;

      myButton.id=node.idd;

      myVBox.addChild(myButton);

      keyword=node.name;

                  this.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

       

       

       

      }

      public function mouseUpHandler( e:MouseEvent ):void {

      Alert.show(this._node.text);

       

      }

       

      public function mouse():void {

      Alert.show(this._node.text);

      }

       

       

      ]]>

      </mx:Script>

       

         <mx:Canvas id="can" width="99.9%" height="100%" horizontalScrollPolicy="off">

         <mx:VBox id="myVBox" width="100%" height="100%" verticalScrollPolicy="off" y="5" x="5">

         </mx:VBox>

       

         </mx:Canvas>

       

      </mx:Module>

      function  "public function mouseUpHandler( e:MouseEvent ):void {

      Alert.show(this._node.text);

       

      }" gets last xlm tag