3 Replies Latest reply on Sep 19, 2010 7:48 PM by John Hall

    add event listener to all my mx:Text



      I have some mx:Texts:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" addedToStage="Ese()" width="1024" height="768" viewSourceURL="srcview/index.html">
           <mx:Script source="ese/Ese.as"/>
           <mx:Canvas borderColor="0xCCCCCC" borderThickness="1" id="canvas" height="768">
           <mx:Text x="880" y="122" text="Text" id="text1"/>
              <mx:Text x="880" y="122" text="Text" id="text2"/>
              <mx:Text x="880" y="122" text="Text" id="text3"/>


      How can I add an event listener to all of them at once? I know that I can add event listener to each one of them separately, by typing id.addEventListener(MouseEvent.MOUSE_DOWN, startdrag) but I would like to add this listener at once to all of them. I tried text.addEventListener(MouseEvent.MOUSE_DOWN, startdrag) but it does not work.


      PS: I need to add the listener only to the texts, not the other objects, so i cannot add the listener to the canvas.