EventListener problem

Hello,
This is example from tutorial, but i can`t make it to process
13 line, unless i delete 9-11 lines, but then listener is skipped,
thats bad, couse all photos are showed one by one without
waiting... my button is named: `next`. working with Flash CS3
ActionScript 2.
1. var x = 1;
2. _root.createEmptyMovieClip("MyImagesHolder", 0);
3. var MyArray = new Array();
4. var i = 0;
5. while (i<=NumberOfImages) {
6. MyArray
= LocationToImages+i+FileType;
7. i++;
8. }
9. NextListener = new Object();
10. next.addEventListener("click", NextListener); //!!!!
// Call the code below if the next button is clicked
11. NextListener.click = function() {
12. x = x+1;
13. loadMovie(MyArray[x], _root.MyImagesHolder);
14. }
15. stop();
Mainly i want to do something like 9 small pictures, and then
i click on one of them, on the right to them opens big one. on this
example it should work only with button, not pusshing the photo,
and it is not i want, but i want to understand, what is wrong with
my example above.
so, if someone could correct an error + get an example or
link to tutorial, how to make every photo be iteractive, if
clicked, on the right opens big one...
now photos are as graphic, not converted to symbols, and i
don`t know if it`s worth to do so...
ok, thanx, and forgive for my spelling ;]

are you using a button component?
(and use the attach code option to display code in this
forum.)

Similar Messages

  • Dual EventListener problem

    Hello All,
    I am new to these forums, and to ActionScript. I have come here to ask the following question, as I cannot find answers elsewhere.
    I have the following short piece of as3 script:
    import flash.display.Bitmap;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    var imageArray:Array = new Array();
    var file:String = "xml/images.xml";
    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest(file);
    loader.load(request);
    loader.addEventListener(Event.COMPLETE, xmlReady);
    function xmlReady(e:Event):void {
         var xmlData = XML(e.target.data);
         trace(xmlData);
         loadImages(xmlData);
         addEventListener(Event., traceArray);
    function loadImages(images:XML):void {
         for (var i:Number = 0; i < images.length(); i++){
         var loader:Loader = new Loader();
         var request:URLRequest = new URLRequest(images.node[i].@f); // load element f (filepath/filename.jpg) out of a node element
         loader.load(request);
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageReady);
    function imageReady(e:Event):void {
         imageArray.push(e.target.content as Bitmap);
    function traceArray():void{
         trace(imageArray.length);
    The script does not throw any exceptions or warnings. Somehow, the script will only load one image into array imageArray, in stead of all (5) images specified in the XML document. I am certain that the XML is correct, because the XML object can load it's data and display it (i tested this). I suspect this problem has something to do with the asynchronous execution due to COMPLETE events being used. Can anyone point me in the right direction as to how this script may be rewritten in a better (functional) way and/or tell me a way to do load assets in as3 without using events? Or is this the only way possible in as3 in order to prevent browser freezes?
    With regards,
    bla124356

    I did not see the trace in that function.
    I have changed my code to:
    import flash.display.Bitmap;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    var imageArray:Array = new Array();
    var file:String = "xml/images.xml";
    var arrayLength:Number = 0;
    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest(file);
    loader.addEventListener(Event.COMPLETE, xmlReady);
    loader.load(request);
    function xmlReady(e:Event):void {
              var xmlData = XML(e.target.data);
              trace(xmlData);
              trace(xmlData.node.length);
              trace(xmlData.length);
              arrayLength = xmlData.node.length;
              loadImages(xmlData);
    function loadImages(images:XML):void {
              while (arrayLength > 0){
                        var loader:Loader = new Loader();
                        var request:URLRequest = new URLRequest(images.node[arrayLength].@f);
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageReady);
                        loader.load(request);
    function imageReady(e:Event):void {
              imageArray.push(e.target.content as Bitmap);
              arrayLength--;
              trace(imageArray.length);
    And here is the output:
    <root>
      <node id="1" f="images/1.jpg" th="images/thumbs/1.jpg" t="image 1"/>
      <node id="2" f="images/2.jpg" th="images/thumbs/2.jpg" t="image 2"/>
      <node id="3" f="images/3.jpg" th="images/thumbs/3.jpg" t="image 3"/>
      <node id="4" f="images/4.jpg" th="images/thumbs/4.jpg" t="image 4"/>
      <node id="5" f="images/5.jpg" th="images/thumbs/5.jpg" t="image 5"/>
    </root>
    Now, it seems that for some weird reason, the xmlData in the xmlReady event handler is having a fit of quantum weirdness. As you can see, trace(xmlData); works and output's it's xml. However, trace(xmlData.node.length); and trace(xmlData.length); do not work. Any ideas?

  • ComboBox eventListener problem

    Hello fellow flexers,
    I'm having issues with a ComboBox, when the user selects an item from the ComboBox I need Flex to change to another state. I'm attempting to do this through an eventListener. Here is my code:
    <mx:ComboBox id="step3_cb_primary_income" dataProvider="{income}" change="step3_cb_primary_income.addEventListener(MouseEvent.CLICK, prrimaryIncomeResult, false, 0) "> </mx:ComboBox>
    private function primaryIncomeResult(event:Event) {
         if(step3_cb_primary_income.selectedIndex==1) {
              currentState='income';
         if(step3_cb_primary_income.selectedIndex==2) {
              currentState='finance';
    When the ComboBox selectedIndex changes, nothing happens. I'd really appreciate some help on this. I've gone through Adobe's addEventListener examples and tutorials to no avail. I feel like I'm just missing the obvious, but I've spent a few hours trying to figure this out and am all out of options.
    Thanks,
    Michael

    Am not clear about your requirement. If you want to invoke change event listener, try this
    <mx:ComboBox id="step3_cb_primary_income" dataProvider="{income}" change="primaryIncomeResult(event)"> </mx:ComboBox>
    private function primaryIncomeResult(event: Event): void {
         if(step3_cb_primary_income.selectedIndex == 1) {
              currentState='income';
         if(step3_cb_primary_income.selectedIndex == 2) {
              currentState='finance';

  • Combox EventListener problem with SDK 3.5

    I am trying to build a custom combobox component and making that editable at the time of open and non-editable after close. Below is my code that is working fine SDK 3.2 but with SDK3.5 it is now. I mean with SDK3.5 when i click open it closes itself automatically..
    public class LookUpComboBox extends ComboBox
            public function LookUpComboBox()
                super();
                addEventListener(Event.OPEN,startLookUp);
                addEventListener(Event.CLOSE,stopLookUp);
            private function startLookUp(e:Event):void
                editable = true;
            private function stopLookUp(e:Event):void
                editable  = false;
    Can someone please help me out on this?

    In your addEventListener(), substitute "DropdownEvent.OPEN" & "DropdownEvent.CLOSE", and see if that helps.

  • [JS CS3] Problem with EventListener

    Hello,
    I am having a problem passing information from two functions to a third when those functions are invoked by an eventListener. Below is the code, very simplified.
    The first function will get the last word of each text frame at the moment the file is opened.
    In the second function, the last word of each text frame will be recorded at the moment of Save.
    The third function will compare the two arrays and get the page number where the last word has moved. This script is to tell the user if there is any text flow from one page to another while making minor changes.
    The problem is that the first two functions only return the function itself and not the values of the function.
    If I assign the first two functions to variables, the third function works correctly but the eventListener does not recognize the functions. I have to comment out the eventListeners and call the first two functions outside of them.
    Any advice to help me solve this would be helpful.
    Thanks,
    Tom
    #targetengine "session"
    main();
    function main(){
    var myEventListener1 = app.addEventListener("afterOpen",arrLastWordsOnOpen, false);
    var myEventListener2 = app.addEventListener("afterSave",arrLastWordsOnSave, false);
    var myEventListener3 = app.addEventListener("afterSave",compare, false);
    function arrLastWordsOnOpen(){
    var a = 5;
    alert(a);
    return a;
    function arrLastWordsOnSave(){
    var b = 6;
    alert(b);
    return b;
    function compare(){
        var c = arrLastWordsOnOpen+arrLastWordsOnSave;
        alert(c);

    Hi Tom,
    Your three functions are registered as event handlers, so they are intended to be automatically called when the corresponding events occur, so this is —generally— a wrong approach to call such functions by yourself from other points of your code. What you need is to store the results computed by arrLastWordsOnOpen and arrLastWordsOnSave, so that the third handler can use the values. Since you are using a persistent engine, you could simply declare a and b at the main() level. Then arrLastWordsOnOpen would update a, arrLastWordsOnSave would update b,and compare just needs to set c = a + b;
    If you don't want to 'pollute' the outer scope of the handler functions, you can also store the computed values as new properties of the functions themselves:
    #targetengine "session"
    main();
    function main()
         var myEventListener1 = app.addEventListener("afterOpen",arrLastWordsOnOpen, false);
         var myEventListener2 = app.addEventListener("afterSave",arrLastWordsOnSave, false);
         var myEventListener3 = app.addEventListener("afterSave",compare, false);
         function arrLastWordsOnOpen()
              var a = 5;
              alert(a);
              arrLastWordsOnOpen.computedValue = a;
         function arrLastWordsOnSave()
              var b = 6;
              alert(b);
              arrLastWordsOnSave.computedValue = b;
         function compare()
              var c = arrLastWordsOnOpen.computedValue + arrLastWordsOnSave.computedValue;
              alert(c);
    Hope that helps.
    @+
    Marc

  • Problem with EventListener

    As I've stated in all my recent posts to this forum, I'm a
    total newbie at AS and need all the help I can get.
    I've got a button (one of several, but I'll concentrate on
    one for now) and I want to use a Listener in order to have the
    button click carry out commands. On the advice of another helpful
    forum user I applied the code (see bottom of message) to the first
    frame of the movie; I've given it a simple GetURL command as I'm
    less likely to get that wrong. However, the button does nothing.
    (The button instance itself is wrapped inside a movie clip and
    the MC instance is what appear on the stage; this is so that I can
    target and change dynamic text, giving each button a different
    label at runtime.)
    If someone can tell me what I'm doing wrong with my Listener
    code I'd be really grateful; the project is stalled until I resolve
    this and I'm stumped. I'm sure it's something simple.
    Many thanks in advance;
    Rick
    Here's the code:

    Thanks for your reply Luigi.
    I thought it was a path problem too, and your response made
    perfect sense - -target the button inside the MC rather than the MC
    itself. But when I did that it still didn't work. So I decided to
    go the Occams Razor route and cut away all the extraneous items --
    started with a fresh .fla. This new movie has only two frames, and
    one button -- a simple button this time, with no nesting of any
    sort.
    Frame one contains a stop command and the listener code for
    the button; the listener code tells the _root timeline to go to
    frame 2 and stop. Frame 2 contains a cloud shape, so I'll know
    easily if the button has worked or not.
    The button instance is called clicker_btn.
    The listener is called myListener.
    The button click still does not work, and I'm really pulling
    my hair out now.
    Here's the code that sits in Frame 1 of the new test file:
    Thanks.
    // Pause frame 1 until button clicked
    stop();
    // LISTENER
    var myListener:Object = new Object();
    myListener.click = function(evtObj) {
    gotoAndStop(2);
    clicker_btn.addEventListener("click", myListener);

  • Nothing but a Blank Screen/ TimerClass problem? EventListener?

    When I test the code below nothing happens. I just get a blank screen.
    What is supposed to happen?
    When the program opens a splash screen should be added for 3 seconds and then fade out. Then some main screen movie clips should be added to the stage.
    package
        //**************** IMPORT STATMENTS *********************
        import flash.display.MovieClip;
        import com.greensock.TweenLite;
        import flash.utils.Timer;
        public class Main extends MovieClip
            //***************** Variables ***************************
           private var MainScene:Main = new Main();
            private var PopUp_MoreApps:MoreApps_mc = new MoreApps_mc();
            private var PopUp_About:About_mc = new About_mc();
            //*****SPLASH SCREEN ***
            private var mc_timerSplash:Timer;
            private var splashScreen:mcSplashScreen;
            //*****************CONSTRUCTOR CODE ********************************************************************* **************
            public function Main()
                mc_timerSplash = new Timer(3000,1);
                mc_timerSplash.addEventListener(TimerEvent.TIMER,  StartTimer);
                //When timer is finished stop the timer;
                mc_timerSplash.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleted);
                splashScreen = new mcSplashScreen();
                //Adds the splash screen
                addChild(splashScreen);
                splashScreen.x = stage.stageWidth / 2;
                splashScreen.y = stage.stageHeight / 2;
                mc_timerSplash.start();
            //*********** FUNCTIONS *********************************
            private function timerCompleted(e:TimerEvent):void
                    mc_timerSplash.stop();
                    mc_timerSplash = null;
            private function StartTimer(e:TimerEvent):void
                TweenLite.to(splashScreen, 1, {alpha:0, onComplete: SplashScreen});
            private function SplashScreen():void
                removeChild(splashScreen);
                addMainScene();
         //adds the main screen movieclips  
          private function addMainScene():void
                addChild(MainScene);
                MainScene.x = 489;
                MainScene.y = 350;
                //TweenLite.from(MainScene.wbbIntro_mc, .5, {alpha: 0});
                TweenLite.from(MainScene, 1, {alpha:0});
                TweenLite.to(MainScene.girls_mc, 1, {y:395, delay:.3});
                TweenLite.to(MainScene.boys_mc, .5, {y:396, delay: .6});
                TweenLite.to(MainScene.Joe_mc, .5, {y:339, delay: 1});
                TweenLite.to(MainScene.Paul_mc, .5, {y:322, delay:1.2});
            private function removeMainScene():void
                removeChild(MainScene);
                TweenLite.to(MainScene.girls_mc, .1, {y:690});
                TweenLite.to(MainScene.boys_mc, .1, {y:693});
                TweenLite.to(MainScene.Joe_mc, .1, {y:636});
                TweenLite.to(MainScene.Paul_mc, .1, {y:619});

    then your problem is with Main.
    what's your document class?  what's the class of your MainScene variable?   (and, those can't be the same.)

  • Focus Problem on Solaris with jdk 1.3.1

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

  • Anyone had this problem?

    I was using some code that worked perfectly in Flash MX 2k4
    but is causing recursion errors in Flash 8.
    Attach an eventListener to a TextInput or TextArea calling a
    'focusOut' event. In the focusOut method, call an Alert component.
    Tabbing from the first input to the next causes a recursion
    error while testing the movie. From a webpage, it just quits
    working.
    Any ideas?
    ps - maliboo from www.flashzone.pl gave me a tip that works
    but it's a lame fix for something that was working in Flash MX 2k4
    : before calling the Alert, remove the listener and after calling
    the Alert, reattach it. It works but it's seriously a lame fix.
    Here's the code:

    Hi.
    I've had a similar problem. Its a problem with the Alert
    component but i can't find out what the problem is.
    I have a class which works without an Alert box but as soon
    as i add an Alert it throws the error 'a script is causing flash to
    run slowly etc.'
    The code i'm using. The alert is called in one method and the
    handler is another private method.
    Alert.show("Start Game", "Message Window", Alert.NO |
    Alert.YES, this, alertHandler);
    function alertHandler(){
    etc.
    This code works when it used independantly in a seperate fla
    (without any other code or assets);
    There is mention of a problem on LiveDocs with regards to a
    custom class breaking the Alert component but no real solution is
    given.
    Please can someone help?

  • Problem with Function Key in multiple JTextArea's

    Hi all,
    I have an unusual problem that I'm hoping someone has run into before. I'm working on a chatroom with multiple JTextArea's. I'm filter incoming keystrokes to run the appropriate method. I want to use function keys to perform various functions. I know it will, theoretically work because my test program worked fine in my test apllet with 1 JTextArea. All the other keyevent's work fine but the eventlistener acts like it doesn't detect any (function) event at all. I'm hoping that someone has run into this before.
    Thanks.
    Chris

    Here's a code snipet:
    String dummy;
    int keyVal = e.getKeyCode();
    switch (keyVal) {
    case KeyEvent.VK_F1:
    But what concerns me is that my debugger doesn't respond to any function key. I can't even debug because the debuger can't see what I'm doing. I've tried listening for function keys in the parent panel but with the same result. This is going to be a bear to solve.
    Thanks.
    Chris

  • EventListener...: From AS2 to AS3..?

    I'm trying to rewrite som AS2 code so it will fit to AS3 but
    some minor problem occurs...
    Here's the AS2 code:
    panel.onRollOver = panelOver;
    function panelOver() {
    this.onEnterFrame = scrollPanel;
    delete this.onRollOver;
    The idea here is to create an EventListener in AS3 that will
    trigger when the pointer is rolling over the movieclip "panel".
    So far, so good...
    Here's the AS3 code so far:
    panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
    function panelOver(myEvent:MouseEvent):void {
    this.onEnterFrame = scrollPanel;
    Now, the problem is to rewrite [delete this.onRollOver;] so
    it will work in AS3...
    Could it be something like:
    delete this.EventListener(panel)?
    I'm really struggling these days finding my way through AS3
    but I do feel that I'm starting to get a hang of it...
    Thank you for any help I get...!
    PS.
    I think I might run into some more problems after solving
    this one.. But we're all here to learn, aren't we?

    panel.removeEventListener(MouseEvent.MOUSE_OVER, panelOver);
    (parameters should match as in addEventListener)
    delete doesn't work.
    this.onEnterFrame = scrollPanel; wont work either. infact
    there is nothing called onEnterFrame in AS3..
    it would be like
    this.addEventListener(Event.ENTER_FRAME, scrollPanel);

  • Killing a thread ( runnable ) - problem

    Hi,
    I already posted about this, and got a good answer.
    But, I still have a probalem :
    Here is a piece of my code :
    // this is the bean which is in the EPN and I want it to create a thread that prints something :
    public class EventListener implements StreamSink,com.bea.wlevs.ede.api.DisposableBean ,InitializingBean {
    // the relevant methods:
    RunnableTestBean runnableTestBean; // this is the thread which suppose to print ..
    public void destroy() throws Exception {
              System.out.println("destroydestroydestroydestroydestroydestroydestroy");
              runnableTestBean.suspend();
         public void afterPropertiesSet() throws Exception {
              runnableTestBean=new RunnableTestBean();
              runnableTestBean.run();
              //System.out.println("afterPropertiesSetafterPropertiesSetafterPropertiesSet");
    and the class RunnableTestBean :
    public class RunnableTestBean implements RunnableBean {
         boolean stopped=false;
         public void run() {
              while ( !stopped){
                   System.out.println(" printing...");
                   try {
                   wait(5000);
                        //Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        System.out.println(" Stoping thread ??");
                        e.printStackTrace();
         public void suspend() throws Exception {
              stopped=true;
    The thing is that when I use the method as above :
    public void run() {
              while ( !stopped){
                   System.out.println(" printing...");
                   try {
                   wait(5000);
                        //Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        System.out.println(" Stoping thread ??");
                        e.printStackTrace();
    When I undeploy the application , the destoy method ( in EventListener class ) is not called !
    but,
    if I implement the run "run" method like this :
    public void run() {
    System.out.println(" Something ");
    than everything is fine!
    The differrence as you can see , is that when I use an infinite loop - the destroy method never called ( seems that the caller waits for it to stop , and that's why the
    destroy method not called )
    When i don't use the infinaie loop- it's OK.
    So, any help ?
    Thanks ..

    Looking at the code that you have posted, the problem is that you are calling runnablebean.run() method in afterPropertiesSet (instead of starting a thread in which the run method is called). So, it looks like it will get stuck in afterPropertiesSet for ever.
    The recommended approach for what you are trying to do is to make the EventListener class implement RunnableBean (instead of having a separate class that implements RunnableBean that gets called from afterPropertiesSet). This means that at application startup time, this EventListener's run() method will be called by OCEP framework code in a separate thread. You can still use the suspend() method to stop the thread similar to how you are doing in your code now.

  • EventListener working 95% of the time in IE but only 2% in Firefox?

    I have no clue how to even begin to debug this. The problem
    is much more common in Firefox than in IE, but it does happen in
    both.
    The critical problem is that my EventListener function
    startChatClickHandler is not triggered 98% of the time in Firefox
    and about 5% of the time in IE. Even the Alert box doesn't trigger.
    I can click on it all day in Firefox and it just sits there though
    once ever while it works but never more than once. But if I right
    click on it, then select Rewind, it will work 100% - at least till
    I try it again. That must be a clue but I have no idea what it
    means. Also, it used to work just fine but one of my changes must
    have had a unintented effect but I can't seem to fix it. Also, I've
    had the same results on more than one PC.
    Another possible clue is that if I hit the enter key instead,
    that works 100% of the time in both Firefox and IE, even though all
    it does is pass it on to the EventListener function
    startChatClickHandler. It's like it's just not "hearing" the mouse
    clicks most of the time.
    The instance of the button is called startChatButton and
    userNameInput is a instance of a TextInput. The code for this
    section is below.
    I've struggled with this for 12 hours straight and I am at my
    wits end. Anyone who can help with this will have my undying
    gratitude.
    import mx.controls.Alert;
    var mainpicpath:String;
    var loadit_lv:LoadVars = new LoadVars();
    var userdata_so:SharedObject =
    SharedObject.getLocal("user_data");
    var tempName:String;
    //var buttonlistenerObject:Object = new Object();
    profileText.text = "Still loading...";
    userNameInput.text = chatName;
    tempName = userdata_so.data.chatname;
    if (tempName.length > 0)
    userNameInput.text = tempName;
    profileText.text = "Profile text failed to load.";
    function startChatClickHandler (evt:Object):Void // <-----
    HERES THE PART THAT ONLY SOMETIMES GETS TRIGGERED, MUCH WORST IN
    FIREFOX
    Alert.show("function click triggered","Info");
    _global.userName = userNameInput.text;
    if (_global.userName.length > 0)
    userdata_so.data.chatname = userNameInput.text;
    userdata_so.flush();
    else
    _global.userName = "Guest";
    nc.connect("rtmp://my flash media server);
    startChatButton.addEventListener("click",
    startChatClickHandler);
    function enter(ev)
    Alert.show("function enter triggered","Info");
    startChatClickHandler(ev);
    userNameInput.addEventListener("enter", this); //<----
    THIS ALWAYS WORKS
    function onConnect(ev)
    //Alert.show("You are connected to: " + nc.uri,
    "Information");
    gotoAndPlay("Main");
    mainpicpath = "
    http://www.mywebsite.com/site_images/profiles/mainpic-"
    + channel + ".jpg";
    loadMovie(mainpicpath, "loginpic");
    loadit_lv.onData = function(src:String)
    if (src != undefined)
    profileText.text = src;
    else
    profileText.text = "Error loading profile text.";
    loadit_lv.load("
    http://www.mywebsite.com/profiletext/"
    + channel + ".txt");
    And this is how the flash movie is called from Perl:
    print qq{<object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    width="720" height="500" id="customer_v16b" align="middle">};
    print qq{<param name="allowScriptAccess"
    value="sameDomain" />};
    print qq{<param name="movie" value="
    http://www.mywebsite.com/flash/customer_v16b.swf?dummyVar=$dummy"
    />};
    print qq{<param name="FlashVars"
    value="channel=$host_page&hostName=$profile_info{'
    name'}&chatName=$chat_name">};
    print qq{<param name="quality" value="high" />};
    print qq{<param name="bgcolor" value="#FFFFFF" />};
    print qq{<embed src="
    http://www.mywebsite.com/flash/customer_v16b.swf?dummyVar=$dummy"
    FlashVars="channel=$host_page&hostName=$profile_in
    fo{'name'}&chatName=$chat_name" quality="high"
    bgcolor="#FFFFFF" width="720" height="500" name="customer_v16b"
    align="middle" allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash" pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    />};
    print qq{</object>};

    I stripped almost all the code out and verified I could click
    on the button and that it was working correctly.
    Then I started adding things back in till it broke again.
    Heres as much of the original code that I could put back
    without breaking it:
    import mx.controls.Alert;
    var mainpicpath:String;
    var loadit_lv:LoadVars = new LoadVars();
    var userdata_so:SharedObject =
    SharedObject.getLocal("user_data");
    var tempName:String;
    //var buttonlistenerObject:Object = new Object();
    profileText.text = "Still loading...";
    userNameInput.text = chatName;
    tempName = userdata_so.data.chatname;
    if (tempName.length > 0)
    userNameInput.text = tempName;
    profileText.text = "Profile text failed to load.";
    function startChatClickHandler (evt:Object):Void
    Alert.show("function click triggered","Info");
    _global.userName = userNameInput.text;
    if (_global.userName.length > 0)
    userdata_so.data.chatname = userNameInput.text;
    userdata_so.flush();
    else
    _global.userName = "Guest";
    //nc.connect('rtmp:/GPL_chat_alpha/chat',
    _global.userName,"customer",hostName);
    nc.connect("rtmp://myflashmediaserver",
    _global.userName,"customer",hostName,channel);
    startChatButton.addEventListener("click",
    startChatClickHandler);
    function onConnect(ev)
    //Alert.show("You are connected to: " + nc.uri,
    "Information");
    gotoAndPlay("Main");
    The following sections of code will break it (in that
    clicking on the button no longer does anything), either together or
    one at a time:
    function enter(ev)
    Alert.show("function enter triggered","Info");
    startChatClickHandler(ev);
    userNameInput.addEventListener("enter", this);
    mainpicpath = "
    http://www.girlsplaylive.com/site_images/profiles/mainpic-"
    + channel + ".jpg";
    loadMovie(mainpicpath, "loginpic");
    loadit_lv.onData = function(src:String)
    if (src != undefined)
    profileText.text = src;
    else
    profileText.text = "Error loading profile text.";
    loadit_lv.load("
    http://www.girlsplaylive.com/profiletext/"
    + channel + ".txt");
    So the question is why does this happen and whats the best
    way to fix it?

  • Facing some runtime problem in new AIR 2.0Beta2 SDK and same application work in OLD AIR 2.0Beta1 SD

    Severity:
    Runtime Error
    Reproducibility:
    Every Time
    Discoverability:
    High
    Found in Version:
    SDK Flex 3 (Released)
    Affected OS(s):
    Windows              - XP
    Steps to Reproduce:
    « Hide
      Steps to reproduce:
    1. Run the Application 
    2. At the creation complete I am referring "StorageVolumeInfo" i.e. StorageVolumeInfo.storageVolumeInfo.addEventListener(StorageVolumeChangeEvent.STORAGE_VOL UME_MOUNT, onVolumeMount);
    3.
      Actual Results:
      I am getting runtime ERROR as below:
    VerifyError: Error #1014: Class flash.filesystem::StorageVolume could not be found.
    at _FreepandasV2WatcherSetupUtil$/init()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.4.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3213]
    at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.4.0\frameworks\projects\fram ework\src\mx\managers\SystemManager.as:3065]
      Expected Results:
       I am using ADOBE AIR 2.0Beta2 version SDK.
    The same application is run in Last SDK i.e AIR 2.0Beta1
      Workaround (if any):
      I am using ADOBE AIR 2.0Beta2 version.
    Can you please help me out...
    Thank you

    My settings with air 3.3:
    <renderMode>gpu</renderMode>
    <aspectRatio>portrait</aspectRatio>
              <autoOrients>false</autoOrients>
            <fullScreen>true</fullScreen>
            <visible>true</visible>
            <softKeyboardBehavior>none</softKeyboardBehavior>
        </initialWindow>
    It only displays a white screen with a small gray square (1/5 of the screen size - top left).
    A scrollbar is visible if you drag the screen and the sound is playing...
    I tried this settings:
    <aspectRatio>portrait</aspectRatio>
            <renderMode>gpu</renderMode>
              <autoOrients>true</autoOrients>
            <fullScreen>true</fullScreen>
            <visible>true</visible>
            <softKeyboardBehavior>none</softKeyboardBehavior>
        </initialWindow>
    It won't work...
    Edit:
    I also tested the new sdk http://www.adobe.com/products/air/sdk/ with gpu mode.
    iPhone works fine but the iPad version always crashes.
    The app opened up but if I try to load a level created with box2d the app always closes (crashs).
    I think that is a gpu ram issue?
    Is this a iPad issue or air?
    Edit 2:
    I changed the creationcomplete event to viewactivate. The transition now looks really worse but the levels are loading.
    I also deleted all the elements before changing the view (removeElement and removeChild).
    The third step I made was to use weak eventListener obj.addEventListener("event, function, false,0,true);
    I think that iOS systems have the problem of less gpu ram than android devices ...

  • Problem trying to send file to browser in JSF

    Hi I've tried two different techniques for sending a file to a browser(making the user download a file). I've tried an example from myfaces wikipage
    FacesContext context = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
    int read = 0;
    byte[] bytes = new byte[1024];
    String fileName = "test.txt";
    response.setContentType("text/plain");
    response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
    OutputStream os = null;
    StringBuffer stringBuffer1 = new StringBuffer("Java Forums rock");
    ByteArrayInputStream bis1;
    try {
        bis1 = new ByteArrayInputStream(stringBuffer1.toString().getBytes("UTF-8"));
        os = response.getOutputStream();
         while ((read = bis1.read(bytes)) != -1) {
            os.write(bytes, 0, read);
        os.flush();
        os.close();
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }FacesContext.getCurrentInstance().responseComplete();
    I have also tried using a component named fileDownload from PrimeFaces. Both give the same result:
    I get a response from the server, the response contains text that should be in the file. The header is a follows:
    X-Powered-By    Servlet/3.0, JSF/2.0
    Server  GlassFish v3
    Content-Disposition attachment;filename="test.txt"
    Content-Type    text/plain
    Transfer-Encoding   chunked
    Date    Thu, 20 May 2010 06:30:20 GMTTo me this looks correct but for some reason I don't get to download the file, I just get this response in firebug.
    Does anyone have any idea?, could it be a serversetting problem? I using glassfish 3
    Thanks / Stefan

    False alarm, it didn't really work, I think it was just a glitsh in JSF that made it work. I think the problem lies in JSF and facelets. I use a facelet and a template.
    Template
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:p="http://primefaces.prime.com.tr/ui"
         xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
         <title><ui:insert name="windowTitle">Default title</ui:insert></title>
         <link rel="stylesheet" type="text/css"
              href="/admin/resources/css/mainGUI.css" />
              <noscript lang="NO">Beklager, dette nettstedet krever at Javascript er skrudd på / tilgjengelig.</noscript>
              <noscript lang="EN">We're sorry, this site need Javascript to be enabled.</noscript>
    </h:head>
    <h:body>
         <div id="fwCenterMiddle" class="fwCenterMiddle"><ui:insert
              name="content">Default content</ui:insert></div>
    </h:body>
    </html>Facelet
    <f:view xmlns="http://www.w3.org/1999/xhtml"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:p="http://primefaces.prime.com.tr/ui"
         xmlns:c="http://java.sun.com/jsp/jstl/core" contentType="text/html"
         xmlns:em="http://java.sun.com/jsf/composite/emcomp/"
         xmlns:fn="http://java.sun.com/jsp/jstl/functions">
         <ui:composition template="/templates/masterLayout.xhtml">
              <ui:define name="content">
                   <h1><h:outputText value="Export">
                   </h:outputText></h1>
                   <h:outputText value="#{ChooseExportController.selectEvent}"/>
                                  <h:outputText value="#{ChooseExportController.selectRole}"/>
                   <h:form id="form" >
                        <p:panel header="Velg Election event" style="margin-bottom:10px;" rendered="#{ChooseExportController.selectEvent}">
                             <h:selectOneMenu value="#{ChooseExportController.eventPk}"
                                  onchange="this.form.submit();"
                                  valueChangeListener="#{ChooseExportController.eventListener}">
                                  <f:selectItem itemLabel="" itemValue="0"/>
                                  <f:selectItems
                                       value="#{ChooseExportController.electionEventList}" var="n"
                                       itemLabel="#{n.name}" itemValue="#{n.pk}" />
                             </h:selectOneMenu>
                        </p:panel>
                         <p:messages errorClass="errors" layout="table" showDetail="true"
                             globalOnly="true" />
                        <p:dataTable id="datatable" value="#{ChooseExportController.operatorRoleList}" rendered="#{ChooseExportController.selectRole}"
                             var="operatorRole" border="1" selectionMode="single"
                             selection="#{ChooseExportController.operatorRole}" paginator="true" rows="10">
                             <p:column sortBy="#{operatorRole.role.name}">
                                  <f:facet name="header">
                                       <h:outputText value="Name" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.role.name}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvArea.areaLevelString}">
                                  <f:facet name="header">
                                       <h:outputText value="OmrÃ¥desnivÃ¥" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvArea.areaLevelString}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvArea}">
                                  <f:facet name="header">
                                       <h:outputText value="OmrÃ¥deskontekst" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvArea}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvElection.electionLevelString}">
                                  <f:facet name="header">
                                       <h:outputText value="ValgnivÃ¥" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvElection.electionLevelString}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvElection}">
                                  <f:facet name="header">
                                       <h:outputText value="Valgkontekst" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvElection}" />
                             </p:column>
                        </p:dataTable>
                         <br />
                         <p:commandButton value="Velg rolle" id="selectRole" action="#{ChooseExportController.download}"/>
                        <br />
                        <br />
                        <br />
                   </h:form>
              </ui:define>
         </ui:composition>
    </f:view>But if I rewrite the facelet like this, the download works, and it works with the mimetype text/plain
    <html   xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:p="http://primefaces.prime.com.tr/ui"
         xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
    <f:view>
                   <h1><h:outputText value="Export">
                   </h:outputText></h1>
                        <h:outputText value="#{ChooseExportController.selectEvent}"/>
                                  <h:outputText value="#{ChooseExportController.selectRole}"/>
                   <h:form id="form" >
                   <h:outputText value="Velg Election event: "/>
                   <br/>
                   <h:selectOneMenu value="#{ChooseExportController.eventPk}"
                        onchange="this.form.submit();"
                        valueChangeListener="#{ChooseExportController.eventListener}">
                        <f:selectItem itemLabel="" itemValue="0"/>
                        <f:selectItems
                             value="#{ChooseExportController.electionEventList}" var="n"
                             itemLabel="#{n.name}" itemValue="#{n.pk}" />
                   </h:selectOneMenu>
                        <p:dataTable id="datatable" value="#{ChooseExportController.operatorRoleList}" rendered="#{ChooseExportController.selectRole}"
                             var="operatorRole" border="1" selectionMode="single"
                             selection="#{ChooseExportController.operatorRole}" paginator="true" rows="10">
                             <p:column sortBy="#{operatorRole.role.name}">
                                  <f:facet name="header">
                                       <h:outputText value="Name" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.role.name}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvArea.areaLevelString}">
                                  <f:facet name="header">
                                       <h:outputText value="OmrÃ¥desnivÃ¥" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvArea.areaLevelString}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvArea}">
                                  <f:facet name="header">
                                       <h:outputText value="OmrÃ¥deskontekst" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvArea}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvElection.electionLevelString}">
                                  <f:facet name="header">
                                       <h:outputText value="ValgnivÃ¥" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvElection.electionLevelString}" />
                             </p:column>
                             <p:column sortBy="#{operatorRole.mvElection}">
                                  <f:facet name="header">
                                       <h:outputText value="Valgkontekst" />
                                  </f:facet>
                                  <h:outputText value="#{operatorRole.mvElection}" />
                             </p:column>
                        </p:dataTable>
                         <br />
                         <p:commandButton value="Velg rolle" id="selectRole" action="#{ChooseExportController.download}"/>
                        <br />
                        <br />
                        <br />
                   </h:form>
    </f:view>
    </body>
    </html>

Maybe you are looking for

  • Animated Gif help

    I want to place an animated gif into an application. I want it to start of not animated then I click a button and it starts. I click another button and the animation stops? Where do I start? I have placed the gif into a JLabel and it starts animating

  • Display resolution conflict

    I tried to increase the resolution of my display beyond the limits of the monitor. How do I change back to a compatible resolution when the monitor won't show an image. Is there some key I can press during bootup to force some sort of safe mode?

  • Film wont play in iTunes

    Hi there, I'm new to Mac and have downloaded a film from iTunes, but when I try to play it, it is black screen and no sound. Other films play though... My account is authorised but I dont know what else to try. thank you!

  • Iphone 3GS - Sim wont activate

    So i recently bought a Iphone 3GS off someone, they reset it all before they gave it to me, when i got it home i plugged it in to set it up etcetc. I got to the part where i have to choose a language/country/location services/ and then wifi networks,

  • Attaching u0093material photou0094 on the user tab of the material master transacti

    All, We are exploring a solution for attaching “material photo” on the user tab of the material master transactions - MM01/MM02/MM03 in ECC6.0. Please review the questions outlined below from the client - - Is it feasible to attach a “photo” of mater