How to send data to another class?

I have two classes, the main class and class data.
Main class creates multiple instances of data class, and it also has a variable to the collection of the messages in this case. If the code goes like this:


myData import;

main/public class extends MovieClip {}

report of the var: String;

public void main() {}
addEventListener (Event.ADDED_TO_STAGE, init);
}

private void init(event:Event):void {}
var a: myData = new myData ("file to process 1");
var b:myData = new myData ("process 2 file");
var c:myData = new myData ("file in 3");
}

}

Data class attempts to load the file specified from different locations, chargers, headphones, and others, and I would as as listener to report what happens during and after loading the data into the main class.

public class myData {}
public void myData(fname:String) {}
Charger code "fname".
COMPLETE and ERROR listeners
}

onError() {} function
Send message to the report in the main class
}

function onComplete() {}
Send message to the report in the main class
}

}

It is the normal way of doing things and how do I make it work?
I can not access the variable 'report' from inside the class, and I don't know if I can refer to the main class of inside the data class

For example:

package
{
     import flash.events.Event;
     import myData;
     public class main extends MovieClip{
          public var report:String;
          private var a:myData;
          private var b:myData;
          private var c:myData;
          public function main() {
               addEventListener(Event.ADDED_TO_STAGE,init);
          }

          private function init(event:Event):void {
               a = new myData("file to process 1");
               b = new myData("file to process 2");
               c = new myData("file to process 3");

               a.addEventListener(myData.COMPLETE, onComplete);
               b.addEventListener(myData.COMPLETE, onComplete);
               c.addEventListener(myData.COMPLETE, onComplete);

               a.addEventListener(myData.ERROR, onError);
               b.addEventListener(myData.ERROR, onError);
               c.addEventListener(myData.ERROR, onError);
          }

          private function onComplete(e:Event):void {
               removeListeners();
          }

          private function onError(e:Event):void {
               removeListeners();
          }

          private function removeListeners():void {
               a.removeEventListener(myData.COMPLETE, onComplete);
               b.removeEventListener(myData.COMPLETE, onComplete);
               c.removeEventListener(myData.COMPLETE, onComplete);
               a.removeEventListener(myData.ERROR, onError);
               b.removeEventListener(myData.ERROR, onError);
               c.removeEventListener(myData.ERROR, onError);
          }
     }
}

And in the data class:

package
{
     import flash.events.Event;
     import flash.events.EventDispatcher;
     public class myData extends EventDispatcher {
          public static var COMPLETE:String = "loadComplete";
          public static var ERROR:String = "loadError";
          public function myData(fname:String) {
               // 'fname' loader code
               // COMPLETE and ERROR listeners
          }
          private function onError(e:Event):void {
               // send message to report in main class
               dispatchEvent(new Event(COMPLETE));
          }
          private function onComplete(e:Event):void {
               // send message to report in main class
               dispatchEvent(new Event(ERROR));
          }
     }
}

Post edited by: Andrei1

Tags: Adobe Animate

Similar Questions

  • How to send data from the client to the server using tcp

    1. as I am new to watch I need help with sending data from client to server. I went through various examples of labview, but each of them also explains transfer of data to the client server. But I need help regardng send data from the server to the client.

    2.i would use the data type variant for sending my data.

    Can someone help me please. Thank you

    Regardless of the meaning. Once you have a connection each end allows it to send data to another. Just create what you want to look like interaction.

    Do you want the client sends a command that request data?
    How do you think the response data to look like?

    You can send variants, but probably not worth the effort.

    Mike...

  • How to send data in eloqua with using ajax?

    Hello

    someone tell me how to send data using ajax?

    Thank you

    Rahul

    Hi Rahul

    Using this code to send data to AJAX

    $.ajax({)

    URL: ' your action? elqformname = name of the form eloqua & elqSiteID = eloqua site ID',

    type: 'POST',

    data: "field name =" + document.getElementById('field_id').value + "="+ document.getElementById('field_id').value field name,

    success: {function (html)}

    }

    })

    Thank you

    edynamic expert Eloqua

  • (Question LVOOP) How one access the data of another class in another class?

    Hello-

    Ass title suggests, how do I access another class (or is it class?) data from another (different) class?  I will attach a picture showing where my problem is...

    I was told this:

    http://zone.NI.com/reference/en-XX/help/371361H-01/lvhowto/setting_scope_classes/

    May contain some helful info, but I can still understand how to unbundle Renault of classes inside the component class data (as seen in the attached photo).

    I think there could be something simple I'm missing here when it comes LVOOP or OBJECT-oriented programming in general... If any of you are willing to help me, it would be much appreciated!

    Thank you!

    -pat

    Personal data are always private, you can never set public. Unbundle cluster function can be used only on the thread of class when he is in the class. If you need to access private data, you must create accessors.

    It of simple, just the class right click and select new, VI for access data members. He invites you to a dialog box to fill you with what you want to create, elements of data and if you want them available through property nodes (recommended). Once completed, this will generate the Afterward screw., you can use in any other VI. The nice thing about making them nodes of property is that you can plop down a property node and it thread class, and all the created accessor functions will appear in the list.

  • How to send data back to office applications

    Hi guys, I want to know all the possible ways to insert data in CRM OnDemand for legacy systems also the integration of options packages, it is best if you can tell me how to do it via web services, but no idea would be great. I ve heard talk of web links, but I Don t like that option so... can I do with the events of integration?

    Thank you!!

    There are several ways to extract data from CRM On Demand, including:

    * Export - Manual of the process, generate the CSV file containing data On Demand CRM
    * List/Analytics - manual process, export the contents of a list report to a CSV file
    Services - programmatic Web, developing an application that queries data within the CRMOD
    * Events - programmatic integration, use workflow to trigger the creation of the event and then query for events, namely that an operation occurs on a record (i.e. Insert new record of account)

    As to enter these data into another system, this will depend on the system and the methods for inserting data it makes available.

    I hope this helps.

    Thank you
    Sean

  • How to send data to a Web service

    Hello everyone. I have a very simple example of sending data (2222) to an existing Web service as follows:

     topmostSubform.Page1.SEND::click - (JavaScript, client)
    var url="http://Localhost:8080/4DWSDL";
    var serv = SOAP.connect(url);
    app.alert("hello ");
    serv.MethodeSOAP(2222);
    app.alert("hello 2");
    
     
    

    However, it works fine in Acrobat, but not in the drive. Is it possible to make it work?

    In addition, although in this example, the data to be sent are only worth 2222, but my goal is to send all the information from the form to a Web service. Someone has tried it before, or is there an other way easier to do? I would appreciate any suggestion on your part thanks

    Hello

    Via web service calls data connections will not work in the drive, unless the form has been activated in LC Reader Extensions ES2 to drive:

    I have a summary here:

    http://www.assuredynamics.com/index.php/2010/11/using-LiveCycle-Forms-in-Acrobat-and-Reade r.

    Hope that helps,

    Niall

    Ensure the dynamics

  • How to send data from c ++ to qml to an another qml.

    Hello

    I'm quite confused about a simple problem, I'm sure. Let me put some of my code and then I'll ask my question

    hand. QML

    // Default empty project template
    import bb.cascades 1.0
    import bb.data 1.0
    
    // creates one page with a label
    
    TabbedPane {
        Menu.definition: MenuDefinition {
            actions: [
                ActionItem {
                    title: "Refresh"
                }
            ]
        }
        showTabsOnActionBar: true
        Tab {
            title: qsTr("Employee")
            NavigationPane {
                id: everyonePane
                Page {
                    id: everyoneFeed
                    ListView {
                        objectName: "FeedView"
                        id: FeedView
    
                        layout: StackListLayout {
                            headerMode: ListHeaderMode.Sticky
                        }
                        listItemComponents: [
                            ListItemComponent {
                                type: "item"
                                DetailFeed {
                                }
                            }
                        ]
                    }
                }
                attachedObjects: [
                    ActivityIndicator {
                        objectName: "indicator"
                        verticalAlignment: VerticalAlignment.Center
                        horizontalAlignment: HorizontalAlignment.Center
                        preferredHeight: 200
                        preferredWidth: 200
                    }
                ]
                onCreationCompleted: {
    
                }
            }
        }
        Tab {
            title: qsTr("TimeSheet")
            Page {
            }
        }
        Tab {
            title: qsTr("Calendar")
            Page {
            }
        }
    }
    

    detailView

    import bb.cascades 1.0
    
    Container {
        layout: StackLayout {
            orientation: LayoutOrientation.TopToBottom // this line stacks everything below
        }
        bottomPadding: 20
        Container { // single row
            id: row1
            // individual row container
            layout: DockLayout {
            }
            preferredWidth: maxWidth
            Container { // container for image
                preferredWidth: 150 //size of image if known
                preferredHeight: 150
                topPadding: 10
                leftPadding: 20
                horizontalAlignment: HorizontalAlignment.Left
                verticalAlignment: VerticalAlignment.Center
                ImageView {
                    preferredWidth: 150 //size of image if known
                    preferredHeight: 150
                    imageSource: "asset:///images/person.jpg" // some image
                }
            }
            // stack labels
            Container { // container for labels
                horizontalAlignment: HorizontalAlignment.Left // align this container to the left
                translationX: 200
                verticalAlignment: VerticalAlignment.Center
                layout: StackLayout {
                    orientation: LayoutOrientation.TopToBottom // this stacks the labels
                }
                Label {                objectName: "firstname"
                    text: "first label"
                }
                Label {
                    text: "second label"
                }
            }
        }
        Divider {
        }
    }
    

    Employee.cpp

    // Default empty project template
    #include "Employee.hpp"
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    #include 
    #include 
    
    using namespace bb::cascades;
    
    QString mQueryUri;
    
    Employee::Employee(bb::cascades::Application *app) :
            QObject(app) {
        // create scene document from main.qml asset
        // set parent to created document to ensure it exists for the whole application lifetime
        mQml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        mRoot = mQml->createRootObject();
    
        // Retrieving my activity indicator
        //mActivityIndicator = mRoot->findChild("indicator");
        //mActivityIndicator->start();
    
        // Retrieving my list from QML
        mListView = mRoot->findChild("dribbbleFeedView");
        GetFeed("everyone");
    
        // set created root object as a scene
        app->setScene(mRoot);
    }
    
    void Employee::GetFeed(QString feedType) {
        // First off we initialize our NetworkManager
        QNetworkAccessManager* netManager = new QNetworkAccessManager();
        if (!netManager) {
            qDebug() << "Unable to create QNetworkAccessManager!";
            emit complete("Unable to create QNetworkAccessManager!", false);
            return;
        }
    
        // First off we initialize our NetworkManager
        netManager = new QNetworkAccessManager();
        if (!netManager) {
            qDebug() << "Unable to create QNetworkAccessManager!";
            emit complete("Unable to create QNetworkAccessManager!", false);
            return;
        }
    
        mQueryUri = "http://mycompany" + feedType;
        // We setup our url
    
        QUrl url(mQueryUri);
        QNetworkRequest req(url);
    
        // Setup the reply and connect to the reply function
        QNetworkReply* ipReply = netManager->get(req);
        connect(ipReply, SIGNAL(finished()), this, SLOT(onReply()));
    }
    
    void Employee::onReply() {
        QNetworkReply* reply = qobject_cast(sender());
    
        QString response;
    
        bool success = false;
        if (reply) {
            if (reply->error() == QNetworkReply::NoError) {
    
                int available = reply->bytesAvailable();
                if (available > 0) {
                    int bufSize = sizeof(char) * available + sizeof(char);
                    QByteArray buffer(bufSize, 0);
                    int read = reply->read(buffer.data(), available);
                    response = QString(buffer);
                    success = true;
                    Q_UNUSED(read);
                }
            } else {
                response =
                        QString("Error: ") + reply->errorString()
                                + QString(" status:")
                                + reply->attribute(
                                        QNetworkRequest::HttpStatusCodeAttribute).toString();
                qDebug() << response;
            }
            reply->deleteLater();
        }
        if (response.trimmed().isEmpty()) {
            response = "Request failed. Check internet connection";
            qDebug() << response;
        }
    
        bb::cascades::GroupDataModel* dm = new bb::cascades::GroupDataModel(
                QStringList() << "id");
    
        dm->setGrouping(bb::cascades::ItemGrouping::None);
    
        // parse the json response with JsonDataAccess
        bb::data::JsonDataAccess ja;
        QVariant jsonva = ja.loadFromBuffer(response);
    
        QVariantList feed = jsonva.toMap()["employee"].toList();
    
        QVariantMap player;
    
        foreach (QVariant v, feed)
        {
            QVariantMap feedData = v.toMap();
            dm->insert(feedData);
        }
    
        mListView->setDataModel(dm);
        mListView->setVisible(true);
    }
    

    OK so here is my question. I load a listview, in my hand, calling another qml, detailview. Given that my PPC is load my json file how can I send what I receive in my datamodel in my detailfeed can I change we tell the label with objectName: "firstname" to change the text for datamodel.name?

    Hope I am clear enough.

    Thank you

    I think that you can access ListItemData in detailView.qml. Say ListItemData.id.

    Why do you add only a mapping in groupdata. I think you need to add all the necessary fields such as firstname and so on. Right?

    bb::cascades::GroupDataModel* dm = new bb::cascades::GroupDataModel(
                QStringList() << "id");
    
  • How to send data from CANOE to LABVIEW

    Hello

    I need to receive data from canoe in Labview.

    I prepared the VI (ex command.vi) sender and receiver VI (Simple UPD - receiver.vi) attached.

    My problem is:

    (1) when I run Canoe (arrested measure) and send the command start-> Canoe starts measurement. (OK)

    (2) when I run VI receiver and send the command Start-> receiver receives the command. (OK)

    (3) when I run the canoe, then run VI receiver and send the command start-> receiver VI receives command but DO NOT canoe starts measurement (canoe does not receive order). (NOK)

    I use the FDX Protocol (UDP-based) and it looks like canoe and receiver VI can work simultaneously on the same port (2809).

    How can I solve this problem?

    PS: Later I want to put the canoe in free run mode to control the Labview application so I need to work VI receiver with canoe.

    OK, now I get it.

    Is there a reason that you need three applications (transmitter + receiver + canoe) at the same time?

    Could not put the sender and receiver in a VI? That would solve your problem of port.

    Another way would be to send messages to general circulation, so canoe and the other VI can receive.

    A third option would be to send the message twice, once at canoe, once the receiver VI.

  • How to send data via TCP

    Hi all

    I am trying to write a very simple application that will transfer data via TCP to another computer running a TCP server. (About 3K of data)

    Although I followed the code example in the 4.6 Java Development Guide, page 101, on the use of the socket connections, (http://na.blackberry.com/eng/deliverables/3802/development.pdf) I've been running into questions that data transfer crashes after an undetermined number of bytes.

    Someone at - it sample code to open a TCP connection and sending the data? This seems to be a very common thing to do, so I don't know what is my problem.

    Thank you
    Daniel

    I'm not going to answer your first question, I think that we must resolve this problem before you watch something else (and I suspect they are all related).

    I would almost guarantee that you run your socket send and receive on the thread of events.  The thread of events, that's what treats your interaction Menu, trackball movement etc.  If you perform a long running or blocking on this Thread, your device will freeze.

    Look at the demo of Socket and move your network of transformation to a Thread separate, as does the sample.

    To confirm that the treatment of your socket is executed on the event Thread, you can add this code, run it in the Simulator and watch it in the output window of the debugger and set a breakpoint on the line to System.out.

    If {(Application.getApplication (), isEventThread ())}

    System.out.println ("running in the thread of events and should not be");

    }

  • How to send data from the Page with a form to fill out?

    How can I automatically include the page title or any text in my Web page when my client click on the Submit button in a form to fill out?

    This may seem obvious, but if you want to receive data from a form, and then place it in the form. A hidden form field with the title page and the text of your Web page will send these data on the form submission.

    best,

    Shocker

  • How to enter data on another web page using Java

    I'm just tarting out in Java, so I apologize if this question sounds stupid.

    I want to get entry (i.e. of MSFT stock symbol) to a web page (www.dividendinvester.com) with the help of a Java program. Is this possible and if so can provide you an example with me, tell me where I need research or the best expression of how a search for this type of problem. After a Google search for a few days, I have yet to find an example of this fact.

    Thank you!

    Hi, I assume you want to write a robot. This means you want to simulate the user enter data and submit the forms on a web page.
    It's simple, apache HttpComponents is a fantastic tool that allows you to authenticate, store and use of cookies, display data, or download them and the process of web resources.
    Download firefox and add addon Firebug.
    Visit the Web page you want to publish data on this subject, trace web applications page sends when you click on the "submit" button.
    Then, you can simulate these actions with your java program.
    Here you can see some examples:
    http://HC.Apache.org/HttpComponents-client-GA/examples.html

  • How to send data to a flash drive for windows 8

    I have a Toshiba Satellite laptop windows 8. I took the data from my old XP on a flash drive, but cannot find a way to transfer it to windows 8. When I plug the USB in, an ad for Clickfree appears and now at all nothing happens. Am I supposed to get the flash player will in another way? I only am not very PC to mind so would like a simple answer. Thank you.

    Hi Ruth,.

    1. what type of data you are trying to transfer using the flash player?

    2. using a Clickfree Traveler automatic backup flash drive?

    I seems that autoplays flash player when you plug in the appliance.  Instead of trying to Autorun flash drive, you can copy and paste the data to the PC Windows 8.

    You can also turn AutoPlay and check if it helps.
    a. in the start screen, type autoplay and click on AutoPlay in the list.

    b. now, under removable devices, click the menu drop down and choose non.

    c. click Save at the bottom of the window.

    Now, to copy the contents of the drive to the computer, follow these steps:
    a. plug the flash drive into an available USB port.

    b. navigate to Windows Explorer.  To open Windows Explorer, simply type computer from Windows 8 start screen and click (computer).

    c. here you can access your USB key. Double-click the device and display the data.

    d. now you can copy and paste the data to the location of your choice.

    Let us know if it helps. If you have any other questions, we will be happy to help you.

  • How to copy data to another hard drive

    In the last month, I realized that my hard drive happens to little for the rest of the year.

    So I bought two new big hard disks (for backup and work) and copied all the pictures for new readers.

    I started a new catalog and imported all the images in 2015.

    (For me, a catalogue is a year.)

    Now I have the old catalogue with all the information processing until September connected with your old hard drive.

    And I have a catalog with no information until September - but of Oktober-connected to your new hard drive.

    What I like to do is all the information in a catalog.

    Now the question:

    How can I connect all the Organization and data processing to a new catalog and photos?

    I think there must be a way to do it, but I don't know.

    The names of the images remained the same, that the path has changed.

    Thank you for helping.

    If there are errors, I apologize, I'm German.

    Marc

    Hello

    Check this video it will be very useful.

    LR - How: move & archive Images and export a catalog | Adobe evangelists - Julieanne Kost. Adobe TV

    Thank you

  • How to send data from 150 morethen FlashVars

    Hello

    I need to send the data to flashvars, size is more then 150kb. This data set will be created by javascript.

    Thanks in advance.

    Chavigny

    use a return in your js function to return data to actionscript.

    You can use a timer loop to repeatedly query the js function and check whether the data is available.  When this is the case, put an end to the loop and use the data.

  • How to send data from the GET method?

    Dear all,
    I am trying to send a value list to a web server. Add the function to determine the value, I do not have here. The method I use is as below. I would like to know how is the value of the shipment to the web server that is the form of http://mysite:8080/test1/test1.aspx?myMessage=outputToServer. How to achieve this format?


    Try
    {
    URL url = new URL ("http://mysite:8080/test1/test1.aspx"); ")
    HttpURLConnection connection = () (HttpURLConnection) url.openConnection;
    connection.setDoOutput (true);
    connection.setRequestMethod ("POST");
    OutputStreamWriter writer = new OutputStreamWriter (connection.getOutputStream ());

    If (connection.getResponseCode () is HttpURLConnection.HTTP_OK)
    {
    Writer.Write ("myMessage =" + outputToServer);
    Writer.Close ();
    }
    on the other
    {
    System.out.println ("connection not found :");
    }
    }
    catch (MalformedURLException e)
    {
    System.out.println ("MalformedURLException");
    }
    catch (IOException e)
    {
    System.out.println ("IOException");
    }

    Remove anything to do with the writer.

Maybe you are looking for