Progress Event in class

Hi, I'm trying to get a grip on writing classes. I have a
simple preloader class which sort of works. When I trace
_percentLoaded from within the class the percentages are output
when I add the class to an fla. But, if I trace _percentLoaded from
the fla I get NaN. Is there a way to pass the progress event data
into the fla? Thanks

right, it's a little tricky. Offhand, you could choose from:
- place the event handler function on the main timeline (it
doesn't have to be in the same class)
- from within your class, create a dynamic handler function
on the timeline (which might be a pain)
- callback to the timeline with the data
- from within the present handler, broadcast a custom event
that gets handled in the main timeline
the communication might require instantiating like so:
new SimpleLoader(this)
from the main timeline so that your instance could then refer
back to the main timeline
which is the reverse of what you'd normally think of:
var loader:SimpleLoader = new SimpleLoader()
so that the loader can be accessed from the main timeline via
the var "loader".

Similar Messages

  • Events in classes LabVIEW 8.6

    i have class with some member (counter of something)
    and i want to generate a user event when this member has specific values.
    currently i manage to generate the event only if i register the event of the class
    in the Top Vi that use this class
    can i register the event inside the class itself, let say inside the initilize vi that i ave for the this class ?
    thanks
    Solved!
    Go to Solution.

    The question is a little confusing. You can register for the event anywhere you like, but somewhere you pretty much need to have an Event Structure in a running VI waiting for that event to occur.
    What should be aware of these events? Class members
    P.S. On second reading, it seems you might just be asking if you can register the event in a class VI, instead of having to register it in the top-level VI. If that's the case, then yes you can. Just have the Register for Events function inside the Initialize VI of your class and have it output the Event Registration Refnum corresponding to your event.
    Message Edited by Jarrod S. on 11-02-2008 08:48 PM
    Jarrod S.
    National Instruments

  • Creating a singleton Event Listener class

    A typical singleton OO design pattern involved a protected (or private)
    no-arg
    constructor and a public instance() method that manages a private static
    variable
    referencing the single instance, internally invoking the no-arg constructor.
    A class designated in web.xml as a <listener> must have a public no-arg
    constructor.
    (from http://e-docs.bea.com/wls/docs61/webapp/app_events.html#178593)
    Anyone thoughts on how to accomplish both goals?
    What I want to do: I'd like to set up a singleton to listen for session
    events.
    Other code will query this one-and-only-one session event listener for
    various
    information. Some of this info I can currently get from the runtime via
    MBeans but
    some I can't, hence my investigation into session event listeners.
    TIA, matt.

    Hi Matt,
    This sounds like a case where you will need to have two classes -- your
    singleton class, and then your session event listener class, which would use
    the singleton class.
    Dennis Munsie
    Developer Relations Engineer
    BEA Support
    "Matt Hembree" <[email protected]> wrote in message
    news:[email protected]..
    A typical singleton OO design pattern involved a protected (or private)
    no-arg
    constructor and a public instance() method that manages a private static
    variable
    referencing the single instance, internally invoking the no-argconstructor.
    >
    A class designated in web.xml as a <listener> must have a public no-arg
    constructor.
    (from http://e-docs.bea.com/wls/docs61/webapp/app_events.html#178593)
    Anyone thoughts on how to accomplish both goals?

  • JTabbedPane single event handling class.

    I have a list of proxyNames which are stored in a Vector.
    These proxy names are then displayed as Tabs accordingly.
    For every tab there is a specific action to be performed.
    I want to write a single event handling class for handling all events.
    What I have is this:
    while(eNum.hasMoreElements()){
    Object proxyName = eNum.nextElement();
    tabbedPane.addTab(proxyName.toString(), null, null, "Proxy");
    tabbedPane.addChangeListener(itemHandler);
    panel4.add(tabbedPane2);
    class ItemHandler implements ChangeListener{
    public void stateChanged(ChangeEvent e){
    for(int i=0; i < v.size(); i++){
    // Perform action on choosing the concerned tab...
    How do I have a single event listener?

    Yikes! Is that a minimal program? When I am trying to do something new, or facing a problem that causes me to get stuck for more than an hour, I create a short program to solve just that problem. In time, you create a directory of test programs that's useful, and with practice, solving a problem in isolation is a faster (and generally better) way to go about things that doing it all in a larger application.
    Any way, here is your code, with a change listener added in method makeSubpanel. If you don't want the listener called the very first time, add it at the end of this method. I also fixed some bugs in createProxyList.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TrialTabbed extends JPanel {
        // Will hold all file names read from the /config directory.
        private Vector v,v1;
        JTabbedPane tabbedPane,tabbedPane2;
        Object proxyName;
        public TrialTabbed(){
            tabbedPane = new JTabbedPane();
            // Instantiate the Vector.
            v1 = new Vector();
            Component panel1 = makeTextPanel("Blah");
            tabbedPane.addTab("Debug Mode", null, panel1, "Debug");
            Component panel2 = makeSubPanel();
            tabbedPane.addTab("Normal Mode", null, panel2, "Normal");
            // Add the tabbed pane to this panel.
            setLayout(new GridLayout(1, 1));
            add(tabbedPane);
        protected Component makeTextPanel(String text) {
            JPanel panel = new JPanel(false);
            JLabel filler = new JLabel(text);
            filler.setHorizontalAlignment(JLabel.CENTER);
            panel.setLayout(new GridLayout(1, 1));
            panel.add(filler);
            return panel;
        private Component makeSubPanel(){
            JPanel panel4 = new JPanel(false);
            panel4.setLayout(new GridLayout(1, 1));
            tabbedPane2 = new JTabbedPane();
            //new code - a change listener for pane2
            tabbedPane2.addChangeListener(new ChangeListener(){
                public void stateChanged(ChangeEvent e){
                    int tab = tabbedPane2.getSelectedIndex();
                    if (tab == -1)
                        System.out.println("no tab selected");
                    else {
                        String filename = tabbedPane2.getTitleAt(tab);
                        File file = new File("..", filename); //brittle!
                        if (file.isDirectory())  {
                            String[] contents = file.list();
                            int size = contents == null ? 0 : contents.length;
                            System.out.println(filename + " contains " + size + " files");
                        } else
                            System.out.println(filename + " has length " + file.length());
            //end of new code
            ItemHandler itemHandler = new ItemHandler();
            v = createProxyList();
            // Enumerate thru the Vector and put them as tab names.
            Enumeration eNum = v.elements();
            while(eNum.hasMoreElements()){
                proxyName = eNum.nextElement();
                tabbedPane2.addTab(proxyName.toString(), null, null, "Proxy");
                panel4.add(tabbedPane2);
            return panel4;
        // Display the file names in this directory as tab Names.
        //new code: changed dirName to "..", fixed some obvious bugd
        private Vector createProxyList(){
            String dirName = "..";
            File file = new File(dirName);
            if(file.isDirectory()){
                String[] s = file.list();
                for(int i=0; i< s.length; i++){
                    v1.addElement(s);
    } // End for.
    } // End of if.
    return v1;
    } // End createProxyList().
    class ItemHandler implements ChangeListener{
    public void stateChanged(ChangeEvent e){
    System.out.println(v.size());
    System.out.println("IN CHANGE LISETENER" + proxyName.toString());
    } // End actionPerformed.
    } // End Inner class ItemHandler.
    public static void main(String[] args) {
    JFrame frame = new JFrame("TabbedPaneDemo");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}
    frame.getContentPane().add(new TrialTabbed(),BorderLayout.CENTER);
    frame.setSize(500, 425);
    frame.setVisible(true);

  • How to use the PROGRESS Event?

    Can someone explain to me how to use the PROGRESS event, i looked at the docs but it never helped me?
    I want to use it to display the prgress of downloading data from a API, its a URL event. But i was told i can do this via a PROGREE Event

    copy and paste the trace output from:
    import flash.events.ProgressEvent;
    //var facebookAPI:String = "https://graph.facebook.com/ginorea1/feed?access_token=277830088900615|2.AQDUBMBocIw_QcqE.3600.1313856000.0-100001000396080|5bXT8Cj0OUxNpr7y NeqTsJfwADg";//
    var facebookAPI:String = "https://graph.facebook.com/100001000396080/statuses?access_token=14563 4995501895|2.AQAKdU4pcsdMmmBO.3600.1313859600.0-100001000396080|7uzAMoRdsg5kXLjc exS5bVaPhag";
    var loader:URLLoader = new URLLoader(new URLRequest(facebookAPI));
    loader.addEventListener(Event.COMPLETE, loadComplete);
    loader.addEventListener(ProgresEvent.PROGRESS,loadProgress);
    function loadProgress(e:ProgressEvent):void
    trace(e.bytesLoaded,e.bytesTotal);
    progress_txt.text = String(Math.floor((e.bytesLoaded/e.bytesTotal)*100));
    function loadComplete(e:Event):void{
    processData(e.target.data);
    function processData(data:String):void
    var facebookFeed:Array = JSON.decode(data).data as Array;
    for (var i:uint, feedCount:uint = 10; i < feedCount; i++)
    var tf2:TextField=new TextField();
    feed1.text = facebookFeed[i].message;
    feed2.text = facebookFeed[2].message;
    feed3.text = facebookFeed[3].message;
    feed4.text = facebookFeed[4].message;
    feed5.text = facebookFeed[5].message;
    feed6.text = facebookFeed[6].message;
    feed7.text = facebookFeed[7].message;
    feed8.text = facebookFeed[8].message;
    feed9.text = facebookFeed[9].message;
    feed10.text = facebookFeed[10].message;
    stop();

  • SwingWorker, setting progress from other classes

    Hi.
    I'm interested in SwingWorker. It's very good tool for long running task in GUI applications. I want to use progress feature, but I don't want to code the logic of my long running task into its doInBackground() method. I have some class (which creates some other classes) which reflects my problem in reality. I want to use this classes for other problems too. So I would like to update progress from this class. Ideal case would be if the method setProgress() in SwingWorker was public, so I can create optional constructor with additional parameter for SwingWorker class (and its subclasses) and call method setProgress from this class. Does anybody know about some solution? I'm still thinking over, but I cannot find ideal solution.
    Thx for help

    Your configuration remains incomprehensible.
    From the other thread you mention a Listener which gets asynchronous messages. Are we talking about a context listener which handles JMS messages or the like? From these message you get a value and set it in a bean property.
    Then we get lost. You say you want to pass this value to a Servlet, presumably by passing a reference to the bean. But how is a particular incoming message associated with a transaction going through the Servlet? How do you imagine the bean reference being passed. A ContextListener doesn't see the web transactions. Should these bean values affect all subsequent transactions? Is there some kind of key in the web transaction that makes it look for data from a particular JMS message?
    In general the way for a ContextListener to pass data to a Servlet is by setting attributes in the ServletContext, but you really haven't made clear what you're trying to achieve.
    Try explaining in a more general way what your project is trying to achieve. You're concentrating on details which almost certainly don't contain the problem.

  • Broadcast events between classes (objects)

    Hello,
    I'm can't figure out how to broadcast an event to another
    class.
    In actionscript 2 I created 2 classes. The first class called
    the second class to load a file from an url. When the file was
    loaded I used dispatchEvent({type: "fileLoaded", target: this,
    filename: sFilename})
    In the first I simply wrote addEventListener("fileLoaded",
    handleFile)
    But with AS3 this no longer works.
    Can anyone tell me how to accomplish this? Because I can't
    find a clear example and I don't know how to do this.

    In the defintion of your custom event I miss the isEnabled
    part (don't know if that has anything to do with the issue though).
    Below a custom event that works for me
    package Components {
    import flash.events.Event;
    public class ZoomEvent extends Event
    public var isEnabled:Boolean;
    public static const ZOOM:String = 'zoom';
    public var vertical:Boolean = true;
    public var minvalue:Number = 0;
    public var maxvalue:Number = 0;
    public var zoomfactor:Number = 0;
    public function ZoomEvent(type:String,
    isEnabled:Boolean=false) {
    super(type);
    this.isEnabled = isEnabled;
    public override function clone():Event {
    return new ZoomEvent(type, isEnabled);
    Furthermore I have somewhere read in the documentation that
    using custom event should go together with adding an embedded
    statement like: [Event(name="update",
    type="Components.UpdateEvent")] in the class where you use the
    event, but for me it also works without this embedding code (???)
    And is your class XMLData a subclass from a class that
    supports dispatchEvent. I do not know what classes support
    dispatchEvent, maybe all. Then this remark makes no sense.
    Good Lcuk

  • Events in classes.

    Hi all
    Can any one explain me the functionality about events and event handlers in ABAP OO??
    Thanks and Regards,
    Arun Joseph

    Hi there
    Whilst the SENDER doesn't know about the RECEIVER  the reverse is not true. Some people might (wrongly) infer from the comment about the sender that the receiver doesn't know either. I'm only adding the comment below  hopefully to clear this up for some people who perhaps a new to OO programming and OO ABAP in particular.
    By using the parameter SENDER the receiver can know what object triggered the event. This is of course useful where you have say multiple grid displays on the screen and an action needs to be performed depending on what object triggered it.
    class lcl_event_handler definition.
    * CLASS     cl_event_receiver
    * DEFINITION
      public section.
        methods:
    *--To add new functional buttons to the ALV toolbar
    handle_toolbar for event toolbar of cl_gui_alv_grid
    importing e_object e_interactive
              sender,
    *--To implement user commands
    handle_user_command
    for event user_command of cl_gui_alv_grid
    importing e_ucomm
              sender,
    class lcl_event_handler  implementation.
    *--Handle Toolbar
      method handle_toolbar.
    *    PERFORM handle_toolbar USING e_object e_interactive .
      endmethod .
    *--Handle Hotspot Click
      method handle_hotspot_click .
    *    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
    create object  go_handler.
        set handler  go_handler->handle_user_command
        for go_grid1.
    set handler  go_handler->handle_user_command
        for go_grid2.
    form handle_toolbar
    case g_sender
    when go_grid1
    etc
    sorry if this info is a case of "stating the obvious" but reading the forums there's quite a bit of confustion surronding event generation and handling in OO ABAP.
    Cheers
    jimbo

  • Could i use page unload event in Class Library (Web part)?

    Hi,
    I am creating Web Part using visual studio class library. I am going to deploy it in SharePoint environment.
    I want to do some functionality while page unload. Is there anything like that?
    Could anyone tell about it?
    Thanks & Regards
    Poomani Sankaran

    Hi,
    According to your description, my understanding is that you want to create a web part programmatically and then do some functionality in the page unload event.
    There is a web part method called WebPart.OnUnload method, you can override this method and add the custom code to the override method.
    Here are some detailed articles for your reference:
    https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart.onunload(v=office.14).aspx
    http://www.codeproject.com/Articles/25019/Developing-SharePoint-WebParts
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • Configure event of class to trigger workflow...

    Hi,
    When a material is created, the standard event CREATED gets triggered of BO 'BUS1001006'.
    But my client wants everything to be handled based on classes.
    So i have created a custom class and its custom event 'CREATED' which needs to be triggered once a material is created.
    So my question is how will i trigger this custom event of custom class. Is there any configuration that needs to be done for the same?
    For now, i am planning to trigger the custom event in a BADI or user exit using standard FM 'SAP_WAPI_CREATE_EVENT'.
    Kindly suggest your ideas.
    Regards,
    Guddan

    Hi- My suggestion is, let the WF be triggered using std BO and event. For additional custom methods, you create a new WF based class
    Also you need to decide, is it required to create an instance for the class (for instance method)
    Vinoth

  • Events in Class Constructors

    Hi All,
    I would like to know if events (instance/static) can be raised within class constructors. My understanding is that events can be raised but not of the same class as the class constructor belongs to.
    Please clarify.
    Thanks and Regards,
    Vidya.

    Hi Vidya,
    Welcome to SDN.
    see this link
    http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4eca79e11d1950f0000e82de14a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/0a/b552f7d30911d2b467006094192fe3/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4eca79e11d1950f0000e82de14a/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for Implementing constructor outside class implementation..  
    use this code
    codeREPORT zkarthik.
    CLASS counter DEFINITION
    CLASS counter DEFINITION.
    PUBLIC SECTION.
    *METHODS CONSTRUCTOR.
    CLASS-METHODS: set IMPORTING value(set_value) TYPE i,
    increment,
    get EXPORTING value(get_value) TYPE i.
    PRIVATE SECTION.
    CLASS-DATA count TYPE i.
    NO explicit constructor
    *METHOD CONSTRUCTOR.
    *WRITE:/ 'I AM CONSTRUCTOR DUDE'.
    *ENDMETHOD.
    ENDCLASS. "counter DEFINITION
    CLASS counter IMPLEMENTATION
    CLASS counter IMPLEMENTATION.
    METHOD set.
    count = set_value.
    ENDMETHOD. "set
    METHOD get.
    ENDMETHOD. "get
    METHOD increment.
    ENDMETHOD. "increment
    ENDCLASS. "counter IMPLEMENTATION
    DATA cnt TYPE REF TO counter.
    START-OF-SELECTION.
    Implicit constructor is called
    CREATE OBJECT cnt.
    CALL METHOD counter=>set
    EXPORTING
    set_value = 5.
    END-OF-SELECTION.[/code]
    happy learning.
    thanks
    karthik

  • About events of class cl_gui_alv_grid

    When the following two event gets trigger in execution.
    I mean by clicking what they get trigger or how we can triger them and how to use them.
    menu_button
    data_changed
    In general how one can understand that which event will be triigered when from the class event.

    Hello Amit
    In order to understand the event DATA_CHANGED in more detail you may have a look at Get edited data ou of grid back into internal tabel
    and the links provided therein (in particular my discussion with David Halitsky).
    Regards
      Uwe

  • Controlling events between classes

    hello
    i know i'm asking a lot, but i couldn't find anything. the problem is i've got a jframe and some panels with buttons.
    eg:
    class A extends JFrame
    getContentPane().add( B ) ;
    getContentPane().add( C ) ;
    class B extends JPanel
    add( button1 ) ;
    add( button2 ) ;
    class C extends JPanel
    add( button3 ) ;
    add( button4 ) ;
    where do i add ActionListeners? how do i pass information between classes? if button1 is clicked -> class A should know it.
    i tried to do this in class A: objectOfB.button1 (access button1 directly) - didn't work - why?
    if a button1 is clicked i want to remove the jpanel and replace it with another one. how should i do this?
    Thank You All

    Check out the java tutorials. There are great examples that show you how to do what you want to do

  • Interlaced render/export of Progressive event

    Footage shot in SD 30fps Progressive loaded into timeline.
    If rendered Progressive and exported, edges look jagged, lines striated.
    If rendered Interlaced and exported, looks good (both on computer screen via Quicktime, and on LED via BrightSign).
    What sense might this make, considering it was shot Progressive?
    Thanks.

    FAQ: What information should I provide when asking a question on this forum?

  • Remoting, LiveCycle & Progress Events

    So, one of the examples that Adobe provides is titled "Generating a PDF file from a Word file using LiveCycle Remoting". I am using variants of this and it works pretty well.
    When you upload a file to LC, you can of course set up some event handlers for the ProgressEvents so you can show status of the file upload.
    In a similar way, my question is, what happens when a person wants to convert a 450 page Word document. That could take a while. How do I inform the user of the status other than "Complete"?
    Is it possible to provide a % complete? Am I limited simply having a status field with 2 states, "Running" and "Complete"?

    clear your browser cache and retest.

Maybe you are looking for

  • How to use used backed up itunes on new computer?

    I've been searching and searching and I can't find a specific answer to what I need to do.  This is what I want to do.  I have a Macbook pro and I want to create a new itunes library for my husband to use for his library.  Easy enough, I found instru

  • Syncing to iPhone/iPod Touch - Disappointing Options

    Ok, so you've bought an iPhone or iPod Touch and you've bought Aperture, and now you want to sync your photos. So you open up iTunes and realise, there are actually fewer options for syncing with Aperture than for syncing with iPhoto. With Aperture y

  • Data Extraction  or IDOC to flat file

    hi, I have a project to create a flat file from SAP, for an external legacy system. There are 3 requirement. What approach should I take. Simple data extraction OR Idoc to flat file. There are 4 requirements: 1. first time extract all data. 2. on sub

  • File Export Variant in CRM Marketing

    Hi Group, Does anybody have idea on File Export Variant? I have basic concept, this is used to export business partner information to external file in campaign execution.I created personalized form and tried to run a campaign, I am getting only descr

  • After downloading album covers (some not found) itunes does not show most of the covers.

    After downloading album covers into iTunes iTunes does not show most of the covers. It showas blank white boxes except for those where "cover not found" (music notes). You have any idea how this happens, perhaps with location of the files.