Can pass you an event to a "global defined class function"?

I have a class file that is defined in my package as MyGlobals.as.

I have several functions defined in this way:

public void myFunctionName(e:TouchEvent):void {}

do things

}

(I tried add/remove 'static' and 'dynamic' to no effect).

I try to call an event of button on the main timeline in this way:

myObject.addEventListener (TouchEvent.TOUCH_BEGIN, MyGlobals.myFunctionName);

(I tried to remove the class name to no effect).

When I compile I get error 1046: Type was not found or is not a constant of compilation: TouchEvent. This error occurs on the function definition in the class file.

What syntax/concept hurt me? The functions have been working well when I was using constants in the timeline panel, but I need to be able to reuse these functions over and over again, so I wanted them to be able to contact event variable so that I didn't have to write a different function for each key event.

I tried Googling "error 1046" but I can't find anything useful. I guess that I do not understand some basic concept. Can you point me in the right direction or tell me what I should be Googling for the answer I'm looking for?

Thank you very much!
Amber

Hello

seems that you have to add: import flash.events. TouchEvent; to the top of your MyGlobals to get rid of the 1046 error class.

and add static front public void myFunctionName(e:TouchEvent):void { }

Tags: Adobe Animate

Similar Questions

  • I see in the 3.2 release notes that you can disbale all alert events. Is it

    I see in the 3.2 release notes that you can disbale all alert events. That's both the version open source or just for the Enterprise version?

    Is for both version.

    http://support.Hyperic.com/Confluence/display/doc/Alerts+overview#AlertsOverview-disable

  • Passing Parms of event click the function and 'child '.

    With the help on this Forum, I'm able to pass the parms in a custom context menu based on TitleWindow created with the PopUpManager to a click event.  Now, I would also spend parms to change a Manager click on the PopUp itself event.  Is this possible?  Here is the code for the click event in the context menu:

    From main MXML file - creates the PopUp:

    private

    var popup: owPopUp = new owPopUp();

    protected function owPopUpWindow (event: MouseEvent, title: String, url1:String):Sub

    {

    PopUpManager.addPopUp (popup,

    ce , true );

    Popup.title = title;  title = '{text}' in the tag < s:TitleWindow... >.

    Popup.x = 200;

    Popup.y = 125;

    }

    Code for the click (a text in a text box) event

    a click = "owPopUpWindow (event, '.

    ' New EBS: order writer - queue of Milestone 1' "lessons/EBS_new_Milestone1.swf" ) "//third parm is what I want to pass to the function in the PopUp TitleWindow (underline) .

    In the TitleWindow PopUp created by the above code:

    ...

    [

    Bindable [ ] public var titleText:String =""; .

    [Bindable] public var url1:String = "";

    protected

    function textarea1_clickHandler(event:MouseEvent):

    Sub

    {

    ce .move (1,1);

    Loader.Load)

    'url1' );  This URL is where I would like to pass in a parm to the event click above 'url1 '.

    }

    protected function pdfLoader(event:MouseEvent):Sub

    {

    navigateToURL (new URLRequest (url2));  I would also like to pass parm for this URL 'url2.

    }

    The role of title works, but does not work part url1.  No error, just no load.  Any suggestions?

    Thank you.

    Create your own event accommodating more parms.

    This is possible by creating a class that extends MouseEvent.  Add some parms you need for this event and be sure to call super.

    You can then send this event as need and also get the parms that you must listen to

    http://StackOverflow.com/questions/426540/how-to-create-custom-MouseEvent-click-event-in-a s3 pass parameters of function

    #4 comment should help you.

  • Can merge is more events in pictures. any ideas what may be wrong?

    Can merge is more events in pictures. any ideas what may be wrong?

    Of course - Photos has no events, so there are no everts to merge

    You can combine the albums (which your iPhoto events have been converted to) easily (not command fusion but easy to do) - display the sidebar (menu display ==> see the sidebar) and open the source album, then drag the photos into the destination album and if wanted to remove from the source album

    LN

  • can update you an ios7.1 to an ios8.1 phone

    can update you an ios7.1.1 to an ios8.1 phone

    If you have an iPhone 4, it cannot be improved beyond 7.1.2. All the newer models can pass to 9.2.

  • How can I make my event reminders appear on my screen at 06:00 rather than 09:00?

    How can I make my event reminders appear on my screen at 06:00 rather than 09:00?

    Im not sure if there is an empirical "remind me about 06:00" setting, however when you set up a singular event you can tell him to remind you about it at times in front of it... like an hour, 2 hours, 2 days etc.

    Could give you some flexibility over

  • Can I create an event to show when someone connects to a required program file, such as our timing?

    Can I create an event to show when someone connects to a required program file, such as our timing?

    Hello

    Thanks for posting your query on the Microsoft Community.

    I suggest you re-post your query on The MSDN Forums , because we have experts working on this type of questions and for you help the better.

    Check out the link:

    https://social.msdn.Microsoft.com/forums/en-us/home

    Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.

  • When is it OK for looping while you wait event?

    Newbie question: in a world of logic non-blocking, when is it a good idea to loop waiting for something finish?

    For example, I am told to check to END_OF_MEDIA (via PlayerListener) to see if a song I played with ToneControl is finished. So is it possible to just create a loop and wait for it be triggered?

    Here is a very simple (albeit artificial) example. I want to play a melody (using ToneControl) twice. I play once, wait until it's done, then play again. END_OF_MEDIA tells me it's done. But have I not need to sit in a loop, then waiting for END_OF_MEDIA? Is it OK? It looks bad, but I don't know what would be the 'right' way.

    Thank you.

    Roricka

    The code I used was something called an anonymous inner class Java. Here's another version that does not use this construction somewhat obscure:

    void startTune() {    Player p = Manager.createPlayer(...);    p.addPlayerListener( new MyPlayerListener() );    p.start();}
    
    class MyPlayerListener implements PlayerListener {    public void playerUpdate(Player player, String event, Object eventData) {        if (event == END_OF_MEDIA) {            processEndOfMedia();        }    }}
    

    Note This class myplayerlistener is declared inside the MyScreen, right as well as the methods of the class and variable fields. All this has done is to convert an anonymous inner class in an inner class with a name.

    Now, it might look like you can move then comes from the MyPlayerListener class in a separate file named MyPlayerListener.java. But this does not work, at least not directly. The reason is related to one of the strange features of inner classes in Java (anonymous or not): an instance of an inner class carries with it an implicit reference to an instance of the containing class. That's why playerUpdate() can call processEndOfMedia() as if it was a MyPlayerListener member function, even if it is a member of MyScreen function. Somehow, an instance of MyPlayerListener lives a dual identity as an instance of MyScreen.

    If you want that myplayerlistener has stated in its own file (or if you want her to be a top-level class, not public in MyScreen.java or a static inner class of MyScreen), the rules of the language to say that there can be more than double-identity of nature. At this time, you cannot call the processEndOfMedia() in the same way as a MyPlayerListener instance does not have a reference to an instance of MyScreen. (In fact, it has no way of knowing that processEndOfMedia() is a function in the class MyScreen!) The way out of this is to give MyPlayerListener a way to refer to a particular instance of MyScreen. Here's one way:

    class MyPlayerListener implements PlayerListener {    private MyScreen client;    public MyPlayerListener(MyScreen client) {        this.client = client;    }    public void playerUpdate(Player player, String event, Object eventData) {        if (event == END_OF_MEDIA) {            client.processEndOfMedia();        }    }}
    

    Then, back in MyScreen, you need to change the call to the constructor:

        p.addPlayerListener( new MyPlayerListener(this) );
    

    And if you put MyPlayerListener in another package that MyScreen, you must also change the visibility of public processEndOfMedia().

    Anonymous inner classes are very convenient for these listener classes little, but they do not have the code a bit difficult to read. Put them in their own compilation units are more work, but it makes the code a little easier to manage, especially when come back you after a few months and try to understand what made you the way back when.

  • BlackBerry Smartphones can save you a SMS text and send it?

    I was wondering if there is a way to record the entire conversation SMS text and send it to someone? Thank you

    No, you can pass one by one as emal.

  • Can spin you the Board of art in Adobe Draw?

    Can spin you the Board of art in Adobe Draw?

    I constantly turn my iPad to adjust the angle of the drawing is. There are pinch to move or zoom, would be unwise to turn the jury of art at the same time?

    Hello

    Currently, the only way to rotate the canvas is to select this option by clicking the gear icon then turn canvas on the shortcut menu. We frequently get this request. And, it's actually a great. I don't know, however, what the future plans are that integrate into the app.

    But... I'll pass your comments along to the team.

    Sue.

  • I get an error message that says that my subscription has expired, even though its April 2016 expiration date. Can help you?

    I get an error message that says that my subscription has expired, even though its April 2016 expiration date. Can help you?

    There is a billing problem, the payment is not passed through last month, you have changed the map, please wait 24 hours and get the updated status.

    Concerning

    Stéphane

  • How can I see more events in the VMware View 4 Administrator?

    Hello

    in the events section of the VMware View 4 Administrator, I see that all the events of the day.

    Where can I search for events two or three days ago?

    Kind regards

    André

    On the events tab it is that a message contains the field.  If you hit the drop down it will allow you to specify how many days to go back.

    If you have found this device or any other useful post please consider the use of buttons useful/correct to award points

  • How can I write the trigger for the global temporary Table

    Hi Grus,
    How can I write the trigger for the global temporary Table.

    I created the TWG with trigger using the script below.


    CREATE A GLOBAL_TEMP GLOBAL TEMPORARY TABLE
    (
    EMP_C_NAME VARCHAR2 (20 BYTE)
    )
    ON COMMIT PRESERVE ROWS;


    CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
    BEFORE DELETE, UPDATE OR INSERT
    ON GLOBAL_TEMP
    REFERRING AGAIN AS NINE OLD AND OLD
    FOR EACH LINE
    BEGIN
    INSERT INTO VALUES EMPNAME (: OLD.) EMP_C_NAME);
    END;
    /


    trigger was created successfully, but her would not insert EMPNAME Table...

    Please guide if mistaken or not? If not wanting to give a correct syntax with example


    Thanks in advance,
    Arun M M
    BEGIN
    INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
    END;
    
    you are referencing old value in insert stmt.
    
    BEGIN
    INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
    END;
    

    then run your app, it works very well...

    CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
    (
    EMP_C_NAME VARCHAR2(20 BYTE)
    )
    ON COMMIT PRESERVE ROWS;
    
    CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
    BEFORE DELETE OR UPDATE OR INSERT
    ON GLOBAL_TEMP
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
    INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
    dbms_output.put_line(:OLD.EMP_C_NAME);
    END;
    /
    
    create table EMPNAME as select * from GLOBAL_TEMP where 1=2
    
    insert into GLOBAL_TEMP values('fgfdgd');
    commit;
    select * from GLOBAL_TEMP;
    select * from EMPNAME;
    
    output:
    1 rows inserted
    commit succeeded.
    EMP_C_NAME
    --------------------
    fgfdgd               
    
    1 rows selected
    
    EMP_C_NAME
    --------------------
    fgfdgd               
    
    1 rows selected
    

    He got Arun

    Published by: OraclePLSQL on December 28, 2010 18:07

  • Can we capture the event of show/hide layer in PS?

    Hi all..!!!

    I have a request to all the coders of Photoshop! We can capture the click event of show/hide layers in Photoshop... ? I need to know my code if the user clicked on the eye of show/hide layer... !!

    Pls answer soon... !!

    Thank you!

    http://forums.Adobe.com/thread/858391?TSTART=0

  • I can pass a pl/sql table as a parameter for a database adapter

    Hello

    I'm moving mutiple files back to a pl/sql stored procedure using a BPEL database adapter. Does anyone know if it is possible to make pl/sql tables to bpel as a parameter?

    The version of the database that we use is 8.1.7 and so I do not think that we use XMl types for transmitting data.

    Yes you can not spend the function PL/SQL nested tables in JDBC. You can pass simple values such as VARCHAR2, NUMBER and Oracle SQL object types (VARRAY, nested TABLE, OBJECT).

    Types defined in PL/SQL are simply not supported by the JDBC driver (except the basic support for the index per table, but 1 level of depth). PL/SQL types are not very good to use, because then you can not use them in SQL in PL/SQL statements, SQL types do not have these limitations.

Maybe you are looking for