Managing various event listeners in multi-frame movie

I'm working on a gunslinger game. I have numerous frames
which correspond to different stages of the game. The frame that
corresponds to the actual gameplay has a really involved
ENTER_FRAME function attached to particular item on the stage. When
the game is over (or an error occurs, or the network connection
fails) I want to leave the gameplay frame and move to some other
frame. When this happens, I would like the ENTER_FRAME function on
the gunslinger to be removed because the player may finish a game
and then re-enter the gameplay frame later after selecting a new
opponent.
QUESTION: Can anyone recommend a good way to manage the
keyboard event listeners, all the button event listeners, etc? As
you might imagine, I have no reliable way to determine which frame
might be entered after the gameplay frame because the frame change
could be triggered by a variety of different reasons.

I have tried using hasEventListener to check for an existing
ENTER_FRAME function before adding the event listener again but it
never seems to notice that there is an existing enterframe function
running. Furthermore, when I leave the frame, the enterframe
function (which is attached to a particular movie clip on frame 2)
continues to run even though that movie clip doesn't exist on any
other frame in the flash movie.
The first frame in my movie just has a button that takes the
movie to frame 2. frame 2 has a movie clip (myMovie) and a button
(btnFrame1) which goes back to frame 1. It also has the attached
actionscript.
I start the movie.
I click 'goto frame 2'
the enterframe listener is added and starts to output trace
statements of the current frame of myMovie (e.g., 1-2-3).
i click 'goto frame 1' on the main movie
although i am looking at frame 1 of my main movie which has
no instance of myMovie, the enterframe function keeps tracing the
current frame--interestingly, the frame of myMovie does not
advance...it stays on 1, 2, or 3 and announces that frame over and
over again.
Repeating the visit to frame 1 and frame2 over and over again
results in more listeners being added over and over again.
I have uploaded a sample FLA here:
http://jaith.net/questions/listenerExample.zip
I hope that you might help me determine how to remove the
listener upon exiting this frame. I don't want that enterframe
function running (and referring to movieclips that don't exist)
when I exit the frame where it is relevant. I'm wondering if I
should try adding the event listener to the root movie
instead.

Similar Messages

  • Removing Event Listeners - Are they needed all the time

    My goal is to increase the performance of my project so I would like to know if it is always a good idea to remove event listeners. More specifically, lets say I have a movie with severals scenes and several frames within those scenes. Each one of the frames has an event listener:
    Example:
    Scene 1
    Frame 1 (EventListener)
    Frame 2 (EventListener)
    Frame 3 (EventListener)
    Frame 4 (EventListener)
    Scene 2
    Frame 1 (EventListener)
    Frame 2 (EventListener)
    Frame 3 (EventListener)
    Frame 4 (EventListener)
    Questions:
    Does Flash continue to listen for an event in Scene 1/Frame 1 when the playhead has moved to Scene 1/ Frame 2?
    Or does Flash just listen for the events when the playhead is in a particular frame only?
    Should I remove the event listener once I leave a particular frame (should there be remove event listeners on each frame)?

    Just mentioning, the addEventListener comes with a parameter you can set to true or false called a weak reference. On desktop flash apps it can become time consuming to constantly remove listeners, especially when things drop off the display list frame to frame. You can mark them for automatic garbage collection by using the weak reference property.
    e.g.
    Credits_bnt.addEventListener(MouseEvent.CLICK, goCredits, false, 0, true); // set weak reference to true (e.g. remove when no references exist anymore automatically)
    Eventually garbage collection will remove that reference automatically when there's nothing left on the display list or in memory to use it.
    However, if this is targeted at mobile, you absolutely want to remove the reference as soon as possible when it's not needed for memory conservation. On a desktop it's not that big of a deal.

  • Is there a way to clear ALL event listeners, stop all movie clips, etc?

    Is there a syntax for this?
    I have a movie that has 15 frames. Each frame has embedded movie clips within movie clips, tons of animations and event listeners. None is needed except when they are on the stage, on the frame. However, the animations continue even when the frame is left.
    For instance, I have a frame that has a dynamically rendered animation of leaves falling from a tree. When the frame is left, the leaves continue to fall.
    There are many instances of this type of thing happening.
    Ideally, I would love to just be able to clear everything when a new frame is loaded, since none of the animations or event listeners need to carry over from one frame to another.
    Is there a way to do this without the thousands of lines of code it would take to manually remove every single animation and event listener and sound, etc, from the stage?
    Thanks so much!!
    Amber

    you have to manually do that.
    or, you could convert each frame to a swf.  load each swf when needed and, if you're publishing for fp 10+, you can apply unloadAndStop() to kill all streams in the loaded swf and ready those assets for gc.

  • Remove Child and Event.SOUND_COMPLETE not working inside movie clip. What's the problem?

    I have a movie clip that is called to the stage. The user then clicks a button and music plays. As the music starts, another movie clip is called, a simulation of  an equilizer. There are several things that should happen:
    1) When the user closes the movie clip the music is supposed to stop playing and the equilizer movie clip is removed. What actually happens is the music stops playing but  the equilzer movie clip is not removed.
    2) When the music is finished playing the equilzer is supposed to be removed from the stage and the play button is reactivated. But none of that happens. When I click on the movie clip a second time equilizer is still there and the play button is not reactivated.
    Here's the code that calls the movie clip to the stage.
    stage.addEventListener(MouseEvent.MOUSE_DOWN, goButtons);
    function goButtons(event:MouseEvent):void
        if (event.target == Song_bnt)
            SoundMixer.stopAll();
            addChild(myPlaySong);
            myPlaySong.x = 304;
            myPlaySong.y = 105;
            //event.stopImmediatePropagation();
    Here's the code in the movie clip:
    import flash.media.Sound;
    import flash.events.Event;
    stop();
    var playRayJaySong:RJSong;
    var playRayJaySongChannel:SoundChannel;
    var equilizer:Equilizer;
    equilizer = new Equilizer();
    playRayJaySong = new RJSong();
    //Plays music, inactivates buttons, and adds the equilizer to the stage.
    PlaySongRJClip.addEventListener(MouseEvent.MOUSE_DOWN, songPageButton);
    function songPageButton(event:Event):void
        playRayJaySongChannel = playRayJaySong.play();
        PlaySongRJClip.visible = false;
        ClicktoPlaySong.visible = false;
        addChild(equilizer);
        equilizer.x = 269;
        equilizer.y = 246;
    //Removes the equilizer from the stage when the music is complete.
    PlaySongRJClip.addEventListener(Event.SOUND_COMPLETE, rjSoundComplete);
        function rjSoundComplete(e:Event):void
        PlaySongRJClip.visible = true;
        ClicktoPlaySong.visible = true;
        removeChild(equilizer);
    //Removes the equilizer and event listeners from stage and calls dispatch event to close the movie clip.
    closeSong_bnt.addEventListener(MouseEvent.MOUSE_DOWN, CloseSong);
    function CloseSong(event:MouseEvent):void
        removeChild(equilizer);
        dispatchEvent(new Event("RemoveMSong"));
        PlaySongRJClip.removeEventListener(MouseEvent.MOUSE_DOWN, songPageButton);
        PlaySongRJClip.removeEventListener(Event.SOUND_COMPLETE, rjSoundComplete);
    //Removes the MovieClip from the stage when the user clicks on the close button inside the MovieClip.
    myPlaySong.addEventListener("RemoveMSong", RemoveSongClip);
    function RemoveSongClip(e:Event):void
        SoundMixer.stopAll();
        removeChild(myPlaySong);
    Any thoughts?

    I figured out the problem. Here's how I reorganized the code (all in one frame).
    //Code for Ray Jay song.
    var playRayJaySong:RJSong;
    var playRayJaySongChannel:SoundChannel;
    playRayJaySong = new RJSong();
    myPlaySong.equilizer_inst.visible = false;
    //Plays the song.
    myPlaySong.PlaySongRJClip.addEventListener(MouseEvent.MOUSE_DOWN, songPageButton);
    function songPageButton(event:Event):void
        playRayJaySongChannel = playRayJaySong.play();
        playRayJaySongChannel.addEventListener(Event.SOUND_COMPLETE, rjSoundComplete);
        myPlaySong.equilizer_inst.visible = true;
        myPlaySong.PlaySongRJClip.visible = false;
        myPlaySong.ClicktoPlaySong.visible = false;
    //Removes the MovieClip from the stage when the user clicks on the close button inside the MovieClip.
    myPlaySong.closeSong_bnt.addEventListener(MouseEvent.CLICK,RemoveSongClip);
    function RemoveSongClip(e:Event):void
        SoundMixer.stopAll();
        removeChild(myPlaySong);
        myPlaySong.equilizer_inst.visible = false;
        myPlaySong.PlaySongRJClip.visible = true;
        myPlaySong.ClicktoPlaySong.visible = true;
        playRayJaySongChannel.removeEventListener(Event.SOUND_COMPLETE, rjSoundComplete);
    //Resets all of the movieclips to their orginal state.
    function rjSoundComplete(e:Event):void
        myPlaySong.equilizer_inst.visible = false;
        myPlaySong.PlaySongRJClip.visible = true;
        myPlaySong.ClicktoPlaySong.visible = true;
    Thanks all for your suggests and input.

  • Loading/Unloading a .swf that adds event listeners to the Stage

    Hi all,
    Disclaimer
    Apologies if I suck so bad at using forum search that the answer to this is on page 1 somewhere; I tried...
    Question
    I am loading and unloading a .swf to which I do not have source code access. This .swf places several event listeners on the stage, as far as I can tell. When the .swf is unloaded, the event listeners placed upon the stage still seem to be in effect. Using unloadAndStop doesn't seem to do it, and I have to target Flash Player 9, anyway, so can't really use it. Is there any other way I can keep this external .swf from holding onto my main movie's stage?
    Additional info
    All eventListeners and references being set by my code are removed.
    I've managed a little contact with the author of the .swf:
    I've requested he provide a dispose() method I can call to get all the listeners removed, and send an updated .swf.
    He's suggested that I should be able to avoid the problem by loading into a unique ApplicationDomain. I'm not terribly familiar with this, but have given it a try without much success. Is this a valid solution - can I really protect my 'stage' by properly using ApplicationDomains - or do I need to persist in trying to get a public dispose() method built in?
    Thanks in advance!
    Cheers, John

    thanks for reply sir
    sir actually, i have not any problem with loading any file but i need to go back to intro.swf file when i click on clsbtn of main.swf, i want unload the main.swf file and panel.swf file
    actually i did was, i have intro.swf file and there is button by clicking load main.swf file (where is timeline controling butons) and in the main file automatically load panel.swf file ( where is all animation)
    its all play gud , no problem
    but my problem is there is a clsbtn in main.swf file and when i click on that button everything should be unload and it should return on the previous position in intro.swf
    i hope u understand what i am trying to say

  • Using Multiple Event Listeners

    Hi,
    I have a movielcip (A) class in which I have used a Tween class effect on a child movieclip (B) scrollRect. The (B) Movieclip in turn has several movieclips whose have tween class effect being executed on thier child movieclips.
    the tweens are all unique to each movieclip
    and the event listeners are taken off once completed.
    This works all well and good in FLASH IDE...
    My problem arises when I try to view this in a browser on a Windows XP
    it doesnt work in
    Opera Version 9.63
    Firefox 2.0
    and Google Chrome 2.0
    The only browser it works fluently in is
    Internet Explorer 7.0.5
    What is happening in most cases it that the animation appears to "stick" but i think what may be happening is the listening or removal of the event listeners. The animations are left incompleted.
    Is there any rule of thumb when using multiple event listeners?
    here is a snippet of some of my code
    on click event from movieclip (A)
    private function scrollToSlidePrev(e:MouseEvent) {
                   if (((slideIndex - 1) >= 0)) {
                        nextButton.mouseEnabled = nextButton.enabled = previousButton.enabled = previousButton.mouseEnabled = false;
                        var position:Number = 0-SLIDEAREA.width;
                        var slide1:TileListSlide = slides[slideIndex] as TileListSlide;
                        var slide2:TileListSlide = slides[--slideIndex] as TileListSlide;
                        scrollSlide(position,slide1,slide2);
    tween animation in movieclip (A) on (B)
    private function scrollSlide(pos:int,slide1:TileListSlide,slide2:TileListSlide) {
                   slide1.resizeSlideTo(0.6); // execute tween on child movie clips in B
                   slide2.resizeSlideTo(1); // same as above;
                   var rect:Rectangle = sliderMc.scrollRect;
                   var tween1:Tween = new Tween(rect,"x",Regular.easeOut,rect.x,rect.x + pos,3,true);
                   tween1.addEventListener(TweenEvent.MOTION_CHANGE,setSliderScroll,false,4);
                   tween1.addEventListener(TweenEvent.MOTION_FINISH,toggleButtonEnabled,false,3);
    tween animation in movieclip (B) children
    public function resizeSlideTo(sc) {
                   var m:Matrix = tileList.transform.matrix as Matrix;
                   var p:Point = new Point (m.a, 0);
                   var tween2:Tween = new Tween(p,"x",Regular.easeOut,p.x,sc,3,true);
                   if (numericStepper != null) {
                        if (sc != 1) {
                             numericStepper.visible = false;
                             tween2.removeEventListener(TweenEvent.MOTION_FINISH,showStepper);
                        if (sc === 1) {
                             tween2.addEventListener(TweenEvent.MOTION_FINISH,showStepper,false,2);
                   tween2.addEventListener(TweenEvent.MOTION_CHANGE,setScaleOnScroll,false,3);
    here is the link
    http://visual_admin.web.aplus.net/ticker/ticker_widget.html
    the effect disables and re-enables the buttons when its done.... then the listeners are removed.
    each one with the exception cretes its own unique tween (obviously this is a custom class built as each clip)
    i really don't know what to make of it guys         

    apparantly making the tween a property of the class rather than a random variable in a function worked.....go figure

  • [JS] Basic question about event listeners and event handlers

    I am very new to the whole topic of event listeners and event handlers.  I'd run the test for the following problem myself, but I don't know where to start, and I just want to know if it's impossible -- that is, if I'm misunderstanding what event listeners and event handlers do.
    Say I have an InDesign document with a text frame that is linked to an InCopy story.  Can I use an "afterImport" event listener on the text frame to perform some action any time the link to the InCopy story gets updated?  And will the event handler have access to both the story that is imported, and the pathname of the InCopy file?
    Thanks.

    Thank you, Kasyan.
    Both of those are good solutions.
    We are currently using InDesign CS4 and InCopy CS5.  I'm hoping to get them to purchase the whole CS5 suite soon, since I'd like to start writing scripts for InDesign CS5 as soon as possible, as long as I'm going to have to be doing it in the not too distant future anyway.  The greater variety of event handlers sounds like it might be something that is crucial to the project I'm working on, so that adds to the argument for getting CS5.
    Thanks again.  You have no idea how helpful this is.  I made some promises to my boss yesterday that I later realized were  based on assumptions of mine about the InDesign/InCopy system that didn't make any sense, and I was going  to have to retract my promises.  But after reading your response I think I can still deliver, in a slightly different way that I had been thinking before.
    Richard

  • Remove Event Listeners (at the right time)

    I have a app which loads multiple flv's, I also have a timer
    (digial) which shows how long the movie has been played for. The
    problem is that whenever i load and new move (through the same
    "loadVideos()" function, the timer variables ("lagTime", "endTime")
    are not reset (even though the correct variables are being passed.
    I believe it has something to do with the event listeners which are
    being used to load the movies. How can i clear all the listerner
    before reloading the movies?
    Here is a code snippet:
    Thanks in advance

    Thanks, kglad
    Yes it traces 'endTime' but what happens is that when i play
    the first movie is will display for example ("40,40,40,40" etc...)
    until the video stops playing. If i load another movie it will then
    trace ("40, 20, 40, 20, 40" etc...) so i need to kill the
    listereners and reload the variables.
    Jake

  • Coherence Event Listeners on Cache Data Expiry

    Hi,
    I'm working on a Fusion integration project with Coherence for caching solution. We have a scenario to update cache data(with Updated Key value) when it expires in Coherence.
    I came across topic on listeners for Coherence Events, would like if its possible to use MapListener to handle cache Expiry.
    I have created class that implements MapListener, but it doesn't get triggered at Cache Expiry.
    Appreciate if your thoughts on this.? Also, Please suggest me best practice/approach for using Coherence cache listeners.
    Thanks
    Dileep Kumar.

    Yes - when you click on the array/group widget in the form editor, there's an 'Event Listener' section with a property called "Method Invoked".
    I think you've figured this out on your own, but If you have trouble seeing a method in the dropdown, create a method that has one argument of type Fuego.Util.GroupEvent. If you look at this class, you can see the various event types that can be received (ADD, INSERT_DOWN, INSERT_UP, REMOVE, and REMOVE_LAST).
    Dan

  • Jerky and abrupt frame movement after rendering (Clip)

    Hello,
    Would anybody happen to know what's the reason of jerky and abrupt frame movement after rendering?
    Please go to the link http://www.youtube.com/watch?v=ANTpUzk3jYY and watch the clip.
    - I have a 4Core CPU (Intel i7)
    - Graphic Card: Quadro FX 4800 (with the latest 64-bit drivers installed)
    - The most recent version of Elemental Accelerator (with the latest drivers installed)
    - Adobe After Effects CS4, Adobe Premiere PRO CS4.2
    - Adobe Photoshop CS4 Extended
    - Windows 7 64-bit
    - RAM memory: 12GB
    Do you know why does this happen?
    Thank you!!
    Giannis

    I use a Full HD 1080i SONY Semi professional cam (2,930.00 $). I use AVCHD file format which is accepted by premiere and after effects. I could convert it but I would not like to spend time since this kind of format is accepted by the software.
    I don't have these problems all the time. Eventually I managed to export the clip properly. I think it has to do with temporal memory. I don't know. I have to check all the memory data for best peformance and best rendering. I think I have already done this but I will dig a little deeper in this..

  • How to remove an event listener of Enter Frame

    basically, i doing a three level game. 1st level is dodging the stone from sky, Secondly, samsh the wolf head. However, when i enter leve1 2 game, it show me an error.
    TypeError: Error #2007: Parameter hitTestObject must be non-null.as:113  Cant access to null object or reference.as.83
    I think due to when i enter level 2, the object is not available anymore, so happen this errors,izzit? how i gonna fix this?
    package
              import flash.display.MovieClip;
              import flash.events.KeyboardEvent;
              import flash.ui.Keyboard;
              import flash.events.Event;
              import flash.events.MouseEvent;
              import flash.ui.Mouse;
              import flash.utils.Timer;
              import flash.events.TimerEvent;
              import flash.events.Event;
              public class level1 extends MovieClip
                        var vx:int;
                        var vy:int;
                        var collisionHasOccurred:Boolean;
                        var score:uint;
                        public function level1()
                                  init();
                        function init():void
                                  //Initialize variable
                                  vx=0;
                                  vy=0;
                                  collisionHasOccurred=false;
                                  stone.stop();
                                  score=0;
                                  optionPage.visible=false;
                        //Add event listeners
                        stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
                        stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
                        addEventListener(Event.ENTER_FRAME, onEnterFrame);
                        wolf2.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
                        function onKeyDown(event:KeyboardEvent):void
                                  if(event.keyCode==Keyboard.LEFT)
                                            vx=-5;
                                  else if (event.keyCode==Keyboard.RIGHT)
                                            vx=5;
                                  else if (event.keyCode==Keyboard.UP)
                                            vy=-5;
                                  else if (event.keyCode==Keyboard.DOWN)
                                            vy=5;
                        function onKeyUp(event:KeyboardEvent):void
                                  if (event.keyCode==Keyboard.LEFT || event.keyCode==Keyboard.RIGHT)
                                            vx=0;
                                  else if (event.keyCode==Keyboard.DOWN || event.keyCode==Keyboard.UP)
                                  vy=0;
                        function onEnterFrame(event:Event):void
                                  trace(player);
                                  trace(cursor);
                                  trace(aaa);
                                  trace(wolf2);
                                  trace(wolf);
                                  //Move the player
                                  player.x+=vx;  <-------------------------------------------------------------this is line 83
                                  player.y+=vy;
                                  //collision detection
                                  if (stone.hitTestObject(player))
                                  player.gotoAndStop(3);
                                  health.meter.width-=2;
                                  if (! collisionHasOccurred)
                                            score++;
                                            messageDisplay.text=String(score);
                                            collisionHasOccurred=true;
                        else
                                  player.gotoAndStop(1);
                                  collisionHasOccurred=false;
                        if (health.meter.width <=1)
                                  New.text="Game Over!";
                                  stop();
                                  fl_CountDownTimerInstance_3.stop();
                        if (player.hitTestObject(wall))   <-------------------------------------------------this is line 113
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallA))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallB))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallC))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallD))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallE))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallF))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallG))
                                  player.x-=vx;
                                  player.y-=vy;
                        if (player.hitTestObject(wallH))
                                  player.x-=vx;
                                  player.y-=vy;
                        function fl_MouseClickHandler(event:MouseEvent):void
                        score++;
                        aaa.text=String(score);
                        trace("Mouse clicked");

    instead of:
    if (player.hitTestObject(wall))
    use:
    if(player&&wall){
    if (player.hitTestObject(wall))

  • Sending events from a child frame to a parent

    My application has a main Jframe which instantiates and launches sub-frames. I'd like to send a mouse event from a sub-frame back to the main frame (child to parent).
    For example imagine this simple program: jFrame1 has a text box and a button. When the button is pressed a new instance of a different frame (jFrame2) is launched. The user moves the mouse over to jFrame2 making it the active window, and then clicks somewhere in the frame. The text box back in jFrame1 gets set to the X coordinate of the mouse click over in the other frame.
    Thanks in advance for any responses.

    One way that could work would be to use the Observer pattern here:
    http://en.wikipedia.org/wiki/Observer_pattern
    Quick question though: why are you spawning child JFrames and not JDialogs? The dialogs would seem like a more natural fit.

  • How to block JTree key event listeners

    I have a JToolbar I am managing keyboards events for (e.g. PageUp, PageDown, right, left, up, down). I also have a JTree in another panel. I have to use 'Alt + PageUp' instead of PageUp because, if I use 'PageUp' (without also using the Alt key), and, the JTree gets the focus, then the JTree will respond to 'PageUp' instead of my JToolbar.
    I have my key actions in a 'getKeystrokeActions()' method which I pass the JToolbar into so I tried passing the JTree to the same method. This doesn't quite do what I want as both components now respond to a 'PageUp' key event.
    There must be some way to tell the JTree not to handle key events but I can't seem to find it. Any help much appreciated.

    Remove the key listeners?
    JTree tree = new JTree();
    for(KeyListener listener : tree.getKeyListeners()) {
        tree.removeKeyListener(listener);
    }Another option would be to just do
    tree.setFocasable(false);

  • Create generic event listeners

    I am trying to create generic event listeners {That should respond to mouse click, keyboard whether it happens on a frame, menus or command line }.
    Is it possible??

    It is not strictly speaking a listener, but you could override Component.dispatchEvent() to capture all events in one place.

  • Java event listeners. newbie

    hi guys
    i have this simple applet with 2 threads and a scrollpane in the first thread which scrolls some test data in a textarea.
    i need to add an event listener to capture the movement of the vertical scrollbar. the examples i have seen online all use a seperate class for event listening.
    i was wondering if i am able to incorporate it all into this 1 class below, or must i use a seperate event listening class?
    any code would be welcome! thanks in advance.
    import java.applet.Applet;
    import java.awt.*;
    import javax.swing.*;
    public class DisplayApplet extends Applet {
         public static JTextArea data = new JTextArea("", 20,100);
         public static JScrollPane dataScroll = new JScrollPane();
         public void refreshData() {
              System.out.println("refreshing data..");
         public void scrollDown() {
              System.out.println("scrolling down..");
         public void scrollUp() {
              System.out.println("scrolling up..");
         public void start() {          
              Runnable displayThread = new Runnable() {     
                   public void run() {
                        System.out.println("Hello from thread 1");                    
                        data.setFont(new Font("Courier", Font.PLAIN, 10));
                        for (int i=0;i<100;i++) {
                             data.append("test\n");
                        dataScroll = new JScrollPane(data);                    
                        DisplayApplet.this.add(dataScroll);
              Runnable dataThread = new Runnable() {
                   public void run() {
                        System.out.println("Hello from thread 2");                    
              new Thread(displayThread).start();
              new Thread(dataThread).start();
    }

    i understand your frustration, but you must also
    understand that i am a java newbie. there was a time
    when you didnt know any java.I only get frustrated if people don't listen to what I say, newbie or not.
    im just trying to work
    my way up to your knowledge and one of my initial
    tasks is to write a multithreaded application with
    event listeners.So go ahead.
    http://java.sun.com/docs/books/tutorial/uiswing/events/index.html
    may be easy for you, but it is a
    little overwhelming for me as a point of entry into
    java. thats all. thats why i asked if my classes were
    arranged in the correct structre. i didnt know. i
    need advice. i didnt say that was what i was going to
    use.
    any suggestions are welcome.I provided suggestions for structure. I provided suggestions for a listener to use. What else do you want?

Maybe you are looking for

  • XI Configuration incase of Java Proxy

    Hello I am trying Java Proxy scenario in which I generated Java Proxies of my XI interface.I used NetWeaver Developer Studio to implement my business logic using the generated classes from XI. But I guess its not connecting to XI when tried to execut

  • Parallel ledger accounting

    Hi SAP Guru's Can any body explain regarding the parallel ledger accounting? How to create allocation structre for Parallel ledger accounting? and on which basis we can do allocation (Cost center or Proft center)? Where we create the allocation struc

  • How do i make a array of user defined structure and creat a pointer for the same

    Function The prototype of the dll function is unsigned long PassThruIoctl(unsigned long A, unsigned long B, void *pvar1, void *pvar2); "void *pvar1" and "void *pvar2" are pointers to different Structures. The value of  "unsigned long B" will determin

  • [SOLVED] CUPS does not start

    I don't know if this issue is a bug or if I'am doing something terribly wrong. I've installed ArchLinux without GUI, just base, as a pure printserver a few weeks ago with only cups running and it worked. But when I try to do exactly the same installa

  • An Error Occurs When I Go To "Build Properties-- Icon" -- Custom Icon Build Fails

    LV 2011 Mac OS X 10.6.8 1. Create a new Build Specification using the Application Builder. 2. Click on the "Icon" tab. The following error occurs: Three possible outcomes from here: 1.  Usually LV2011 hangs when changing this option.  (i.e. "time to