Event dispatcher question...

Hi guys... I have a question about sending the event. I am trying to write code for youtube player and find the following link...

http://www.codingcolor.com/AS3/AS3-YouTube-chromless-API/

There many dispatchEvent call similar to this:

 dispatchEvent(new YouTubeEvent(YouTubeEvent.ON_IOERROR,event));

To my understanding, event custom shipping usually as below:


 dispatchEvent(new Event(YouTubeEvent.ON_IOERROR));

I don't know why it can add ,event after On_IOERROR . I appreciate if someone could help me with this. Thank you.

Hello

Have you downloaded the source? If you did, then please go to com\YouTube\YouTubeEvent.as

It has the following code:

/****************************
* Manuel González *.
[email protected] *.
* www.stheory.com *.
* www.codingcolor.com *.
*****************************/
com of the packaging. {From YouTube
import flash.events.Event;

SerializableAttribute public class YouTubeEvent extends Event {}
public var data: *;

public static const = "ON_IOERROR" ON_IOERROR:String
public static const = "ON_CHANGE" ON_CHANGE:String
public static const = "ON_ERROR ON_ERROR:String."
public static const = "ON_READY" ON_READY:String
public static const = "ON_QUALITY_CHANGED" ON_QUALITY_CHANGED:String

public void YouTubeEvent (type: String, data: *) {}
This.Data = data;
Super (type);
}
}
}

You see it is a custom event and the second parameter passed to the constructor of the event is a non typed data. This means that this event holds differnet type of data in data while the distribution of different event types as photographed at static vars.

Now in flex, we used event metadata for access that of its parent.

If you are using as a component, you should not write the atg of metadata. Instead add the instance using code and add the event like this listener:

var myInstance:SomeInstance = new SomeInstance();

myInstance.addEventListener (MyEvent.TYPE, myEventHandler);

private void myEventHandler (event: MyEvent): void

{

var obj: * = event.data;//data is the public var in the custom event class

}

Best regards

Etienne Das

http://deepanjandas.WordPress.com/

Tags: Flex

Similar Questions

  • Flex Event Dispatcher Questions...

    Hi guys...

    I'm sending a custom of my Player.as and here YouTubeEvent my Main.as would listen to and create the video player... Apparently my eventHandler can't catch the event to create the videoplayer... My flex debug mode is so screw I can even use... My code is as follows... I appreciate really no response or help...

    My custom event...

    package com.youtube.events {}

    import flash.events.Event;

    /public class YouTubeEvent extends Event {}

    Public static const PLAYER_READY:String = "PLAYER_READY";

      

    public void YouTubeEvent(type:String) {}

    super (type);

    }

    }

    }

    My Main.as

    SerializableAttribute public class SearchYoutube extends Sprite

    {

    private var videoPlayer:Player;

    public void SearchYoutube()

    {

    loadPlayer();

    }

    private function loadPlayer (): void

    {

    videoPlayer = new Player();

    videoPlayer.addEventListener (YouTubeEvent.PLAYER_READY, playerReady);

    playReady will never be executed...

    }

    private void playerReady(event:YouTubeEvent):void

    {

    videoPlayer.createPlayer ();   This Manager was never going to be executed...

    addChild (videoPlayer);       This Manager was never going to be executed...

    }

    }

    Player.As

    display only part of the codes here

    public void Player() {}

    }

    public function createPlayer (): void

    {

    _loader = new Loader();

    _loader.contentLoaderInfo.addEventListener (Event.INIT, onLoaderInit);

    }

    private void onLoaderInit(event:Event):void

    {

    _loader. Content.addEventListener ("onReady", onPlayerReady);

    }

    private void onPlayerReady(event:Event):void {}

    dispatchEvent (new YouTubeEvent (YouTubeEvent.PLAYER_READY));

    }

    The is the top-level application. all events will be propagated to the application. So if you save events to the level of the aplcation, you need not worry about losing events.  Application.application will give you the reference application slot and you catch and listen to events at this level based on what I posted in my previous post.

  • Event Dispatching Thread

    Hello
    I'm a beginning student of java and I have trouble understanding how to manage the event Dispatching Thread.

    I have read many things on the internet; but I have not found anything that it be written in Italian (my language), so I'm afraid I did not understand what I read.

    Of course, I have not yet understood where to put the run() methos and how to call it.

    I need to set the text in a JLABEL after clicking on a JButton; where should I put the statement JLabel.setText ("bla bla") run() method? in the my JButton actionPerformed() method?

    After many attempts I still didn't get it. :(

    Thanks for your help.

    Published by: piratolo on 18-Dec-2012 0.54

    piratolo wrote:
    Should I do something like that?

    Not really, it's a very bad example. When would you like to add 100000 JLabels anywhere ever.

    He spoke as a situation

    public void actionPerformed(ActionEvent e) {
        loadDataFromDatabase();    // Loads a lot of data, while loading the GUI will be frozen since you're on the event thread
    }
    

    In this case, you must create another thread to load the data, instead of load on the EDT. The EDT is necessary if you make changes to the GUI.

  • Event dispatcher listener giving a ClassCast Exception in C++ 3.6.1

    Hello
    I enclose a NamedCache underlying event listener and when I update the cache entry I did not all alerts. But when I checked the
    Journal of consistency than exception available now, I found. But I don't do any kind of Casting as mentioned below.

    2012-01-17 11:12:55.793/0.320 Oracle Coherence for C++ RTC 3.6.1.0 < Info > (thread = hand): Socket connected to 169.52.37.237/169.52.37.237:9099
    2012-01-17 11:13:04.859/9.386 Oracle Coherence for C++ RTC 3.6.1.0 < error > (thread = ExtendTcpCacheService:coherence:component:util:TcpInitiator:coherence:component:util:Service:EventDispatcher): an exception has occurred when sending the following event:
    {[Coherence::Component:util:RunnableCacheEvent: coherence::util::MapListenerSupport::FilterEvent{coherence::component::net::extend::RemoteNamedCache::BinaryCache[source=coherence::component::net::extend::RemoteNamedCache::BinaryCache@0x69f090c4] update: key = Binary(length=19), old value = Binary (length = 713), value = Binary(length=713) new filters = [NULL]}
    2012-01-17 11:13:04.860/9.387 Oracle Coherence for C++ RTC 3.6.1.0 < error > (thread = ExtendTcpCacheService:coherence:component:util:TcpInitiator:coherence:component:util:Service:EventDispatcher): the following exception has been captured by the event dispatcher:
    2012-01-17 11:13:04.860/9.387 Oracle Coherence for C++ RTC 3.6.1.0 < error > (thread = ExtendTcpCacheService:coherence:component:util:TcpInitiator:coherence:component:util:Service:EventDispatcher): NULL
    coherence::lang:ClassCastException: try to cast from a 'gce::coherence:CoherenceEventHandler' to 'coherence::util:MapListener' sub coherence::lang:coh_throw_class_cast(const_std::type_info&,_const_std::type_info&) (ClassCastException.cpp:27)
    at coherence::lang:coh_throw_class_cast(std::type_info_const&,_std::type_info_const&)
    to coherence::lang:cast coherence::lang:TypedHandle < coherence::util:MapListener > < coherence::lang:TypedHandle < coherence::util:MapListener >, coherence::lang:Object > (coherence::lang:TypedHandle < coherence::lang:Object > const &, Boolean)
    to coherence::lang:cast coherence::lang:TypedHandle < coherence::util:MapListener > < coherence::lang:TypedHandle < coherence::util:MapListener >, coherence::lang:Object > (coherence::lang:TypedHolder < coherence::lang:Object > const &, Boolean)
    to coherence::lang:cast coherence::lang:TypedHandle < coherence::util:MapListener > < coherence::lang:TypedHandle < coherence::util:MapListener >, coherence::lang:Object > (coherence::lang:MemberHolder < coherence::lang:Object > const &, Boolean)


    When I wrote a sample application, it works without any problem. Only the difference of the program come above exception is this library c ++ is responsible for true NYI and relevant event listener is added during a JNI method call. Please explain to me why this exception is coming. I am attaching the relevant code as well.

    -----------------------------------------------------------

    CoherenceEventListener.hpp


    /*
    * File: CoherenceEventHandler.hpp
    * Author: srathna1
    *
    * Created January 5, 2012, 10:15
    */

    #ifndef COHERENCEEVENTHANDLER_HPP
    #define COHERENCEEVENTHANDLER_HPP

    #include "coherence/util/MapEvent.hpp".
    #include "coherence/util/MapListener.hpp".
    #include < iostream >
    #include < map >
    #include ' coherence/lang.ns.
    #include "mihelper.hpp".
    #include "MiCoherence.hpp".
    #include < String >
    #include "MICoherenceDataObject.hpp".

    using coherence::util:MapEvent;
    using coherence::util:MapListener;
    using namespace coherence::lang;
    /**
    * Implementation of MapListener which prints each event as it receives
    * them.
    */

    gce {} namespace
    namespace consistency {}

    class CoherenceEventHandler
    : public class_spec < CoherenceEventHandler,.
    extends < object >,
    implements < MapListener > > {}
    friend class factory < CoherenceEventHandler >;

    public:

    CoherenceEventHandler(CMiCoherence * miCoh): mi (miCoh), msgSeqNo (1) {}
    }

    virtual void entryInserted (MapEvent::View vEvent) {}

    Vcle Object::View = vEvent-> getKey();
    Key String::View = cast < String::View > (Vcle);
    Object::view vValue = vEvent-> getNewValue();
    subject of tank [100];
    strcpy (topic, key-> getCString());
    Managed < gce::coherence:MICoherenceDataObject >: discovers pos = cast < < gce::coherence:MICoherenceDataObject > Managed: View > (vValue);
    std::cout < < key < < '=' < < pos < < std::endl;

    }

    virtual void entryUpdated (MapEvent::View vEvent) {}

    Vcle Object::View = vEvent-> getKey();
    Key String::View = cast < String::View > (Vcle);
    Object::view vValue = vEvent-> getNewValue();
    subject of tank [100];
    strcpy (topic, key-> getCString());
    Managed < gce::coherence:MICoherenceDataObject >: discovers pos = cast < < gce::coherence:MICoherenceDataObject > Managed: View > (vValue);
    std::cout < < key < < '=' < < pos < < std::endl;
    GCE::coherence:MICoherenceDataObject msg = * pos;
    }

    virtual void entryDeleted (MapEvent::View vEvent) {}
    }

    private:
    CMiCoherence * mi;
    int msgSeqNo;

    };
    }
    }
    #endif / * COHERENCEEVENTHANDLER_HPP * /.


    ---------------------------------------------------------------

    Code for event registration

    NamedCache::Handle miCoherenceCache = NULL;

    try {}
    String::view cacheName = szConnect;
    miCoherenceCache = CacheFactory::getCache (cacheName);
    } catch (const std::exception & e) {}
    LOGERR ("error in cache for middleware consistency during initialization: %s", e.what ());
    Return MI_ERR_BADSTATE;
    }

    nConnectState = miCoherenceCache - > getCacheService()-> isRunning() == true? 1: 0;
    miCoherenceCache-> addFilterListener(gce::coherence::CoherenceEventHandler::create(this));)


    -------------------------------------------

    Please give me an idea why few internal event dispatcher giving exceptional...

    Thank you and best regards,
    Sura

    Hi Sura,

    That exception would seem to indicate that libcoherence.so was loaded several times. Specifically the exception indicates that a course was recorded twice with our infrastructure of class loader, and this loading occurs as part of the static initialization of the library, which in turn is part of the loading of the library. While I'm not sure that the library has been charged twice to 100%, so it seems quite likely. On a danger noted, the changes above with 3.7.1 and we reporter class registration is delayed until the first time you try to use the library. So with 3.7.1 you will see a different behavior, even if the loading of the library several times always seems to be fatal.

    Mark
    The Oracle coherence

  • Exception occurred during the event dispatching: java.lang.NoSuchMethodError

    Hello

    We have upgraded to the latest Oracle Application Server version 10.1.2.3.0 and webutil version 1.0.6.

    But we are facing the following error while accessing the web link. Message captured from the Java Console.
    Please suggest if you have a solution/idea about this error. Thank you!

    Oracle JInitiator: Version 1.3.1.22
    Using JRE version 1.3.1.22- internal Java hotspot Client VM
    Maximum size: 50 MB
    Compression level: 0 -.
    c: clear console window
    f: finalize objects on the finalization queue
    g: garbage collection
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: Hide console
    S: dump system properties
    t: dump thread list
    x: delete the cache of class loaders
    0-5: set the level of trace to < n >
    ----------------------------------------------------
    Download http://si02938.in.irt.com:7778/forms/java/frmall_jinit.jar to JAR cacheDownloading http://si02938.in.irt.com:7778/forms/java/frmwebutil.jar to JAR cacheDownloading http://si02938.in.irt.com:7778/forms/java/jacob.jar to JAR cacheDownloading http://si02938.in.irt.com:7778/forms/java/FileInformation.jar to JAR cacheDownloading cacheproxyHost = nullproxyPort = 0connectMode = HTTP, native.
    Version forms cmdlet is: 10.1.2.3
    Exception occurred during the event dispatching: java.lang.NoSuchMethodError at oracle.forms.webutil.common.VBeanCommon.init(VBeanCommon.java:281) at oracle.forms.handler.UICommon.instantiate (Unknown Source) at oracle.forms.handler.UICommon.onCreate (Unknown Source) at oracle.forms.handler.JavaContainer.onCreate (Unknown Source) at oracle.forms.engine.Runform.onCreateHandler (Unknown Source) at oracle.forms.engine.Runform.processMessage(Unknown Source) at oracle.forms.engine.Runform.processSet(Unknown Source) at oracle.forms.engine.Runform.onMessageReal(Unknown Source) at oracle.forms.engine.Runform.onMessage(Unknown Source) at oracle.forms.engine.Runform.processEventEnd(Unknown Source) at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source) at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl (unknown Source) at java.awt.Container.dispatchEventImpl (unknown Source) at java.awt.Component.dispatchEvent (unknown Source) at the java.awt.EventQueue.dispatchEvent (Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (unknown Source) at the java.awt.EventDispatchThread.pumpEventsForHierarchy (Unknown Source) at java.awt.EventDispatchThread.pumpEvents (unknown Source) at java.awt.EventDispatchThread.run (Unknown Source)

    Published by: user12233243 on November 16, 2009 22:28

    Published by: user12233243 on November 16, 2009 22:29

    Hello

    Your welcome, but you need to mark it as correct or relatively useful because other users will be able to solve their problems.

    Sarah

  • Event log question.

    Hello

    I know this is a silly question but I was wondering if anyone could tell me if newspapers windows still records events when the computer is off? There was something that was either a start to the top of the computer on his own or his things logging while shut down. Thanks in advance!

    Is there anyway that they can start a computer that is turned off?

    Depends on what you mean by 'stop' as well as some of the equipment installed in the computer.

    Some Ethernet (wired) network cards have a "Wake On LAN" function number of wireless cards have a similar feature.  If one of these features is present, a computer is 'off' but connected to a power source.  See, for example, http://www.howtogeek.com/70374/how-to-geek-explains-what-is-wake-on-lan-and-how-do-i-enable-it/ (no need to read much more far "what is Wake-on-LAN" unless you have nothing better to do).

    In Windows 7, go to network and sharing Center and click on the link at the top left of "change the map settings.  Right-click on your network adapters icon, and then select Properties.  Click on the "Configure" button just below the box under 'Connect using' where the name of your card.  Click on the tab "power management."  Uncheck the box for "allow this device to wake the computer".  Do this for each of your network adapters.

    In addition, if your computer is plugged into a power strip, after that you turn off your computer in the usual way, turn off the power strip.  If the computer is not connected to a power source, it absolutely remote start-up.  Of course, which does not apply to laptops unless you remove the battery.

    As your second question, Yes, you can configure a task to "wake up" the computer in sleep mode (and off).  Once again, however, the computer must be connected to an external power source (or internal energy (i.e. not the RTC or CMOS battery), so for this to happen.) As far as I KNOW, however, if the computer is effectively stopped, a scheduled task will not be able to turn it on.

    On the other hand, see http://www.enviprot.com/en/auto-shutdown-manager-product-details/remote-shutdown-and-wakeup.html

  • How can I hide submit them and disable button "on success" event for question slides?

    Hello

    I use the "successful" event on the question slides to show a caption for the image and text and a button of smart shape to allow the user to continue to his own time to the next question.  The problem is I can't hide submit and clear buttons and I cannot conceal their with a smart shape...

    Does anyone have advice?

    Thank you!

    It's just the way by default that work all the Captivate questionnaire slides.  The default slide elements of questionnaire, including the "submit" button and the Clear button, are always at the level of the top layer, no matter what YOU add to the slide.

    My suggestion would be that maybe you should consider using the actions on the success or on the last attempt to go to a different slide in total BEFORE then go to the next question quiz.  Then you can do what you want on this non-quiz slide.

  • Supersimple event dispatcher does not

    I have this simple event using an external .as file Dispatcher and does not trigger my event listener in the root timeline for some reason any. This code is almost identical to a code that I use and which works very well. Can you see the problem? First the code in the .as file. Then, the code on the root timeline.

    Thank you! Who got it. Very logical too I might add. Now, I just need to understand why everything has worked elsewhere in my old program. Very perplexed, but this will help me a lot.

  • BSM 9.24 - IMO event browser question

    Event browser is white and after 10 minutes (aprox) show:

    I tried with http://h30499.www3.hp.com/t5/Application-Perf-Mgmt-BAC-BSM/Event-browser-is-not-working/m-p/5851363#... solution, but didn t work. The returned value is 0, and I can't find anything to help me.

    1 GW, 1 DP, Windows, 64-bit environment

    The solution was a patch called HPBSM925OMI-ROLLUP-HOTFIXES-1

  • LNR0208C event registration question

    I have four ip CCTV camera: Foscam, Dahua, Vstarcam and IPC-Onvif. I want only save you with a movement of the camera. I won't be sending a tot of e-mail. The only thing I can do is constantly records. With the recording of the event. I only get one record at a time. With a new record is the last record annihilate. Any suggestions? The LNR0208C are triggert by the camera and how then where is the triggert of the record by the NVR itself by the movement of his auto?

    First download of FTP with Foscam creat in the public directory (void) you start by creat NVR, see picture.

    As you can see it works

  • Pretreat the Event Handler Question

    I developed a class according to the metalink notes 1262803.1 'Sample Code for A Custom event handler implemented for process prior to the course create user management look' it worked fine but I have the following problem:
    The algorithm must search for users in order to generate a user id, and this process uses the OIMClient Api which requires a connection to the IOM (Username, Passwor and provider_url). I don't want to encode any variable.
    OimClient has something like anonynous connection?
    Is necessary use a properties file to specify the connection information?

    Thank you

    Your event handlers, you can use Platform.getService () method instead of using oimClient. Platform is available inside the IOM and would go without credentials.

    HTH,
    BB

  • Project event billing question

    Hi friends,
    I created a new billing project. Created agreement, funding is, planned a budget, created an event. After you create the event, I had run the RPC request: generate invoices for project for a single project. We get the following error in the result of the query.

    Mistake1

    No data exists for this report *.

    Page: 1
    The generation of invoice report on eligibility project


    All amounts are in: USD

    ------------------------------------------------------------------------------------------------------------------------------------
    Reason for rejection project Num project Revenue Bill last billing Date
    Method of accrual accounting invoice
    Method at the top of the special page
    ------------------------------------------------------------------------------------------------------------------------------------
    Eligible expenses SO002925 event event no no, or events



    Error 2:


    No data exists for this report *.

    Page: 1
    The generation of invoice report on eligibility project
    Unprocessed event details

    All amounts are in: USD

    ------------------------------------------------------------------------------------------------------------------------------------
    Special Bill Num? Num Desc Type event event event event Date Hold? Recipes? Amount of the invoice
    ------------------------------------------------------------------------------------------------------------------------------------
    1.0 No Yes 1 Manual No 100,000.00 No.


    Please let me know where I am at fault.

    Thank you
    Tarun Chaturvedi.

    Hello

    Verify that you have entered a date on the event.
    Make sure that the Bill's Date is a date of the event.

    Check that the client is not waiting for the Bill.
    Check the invoice to the customer at the address and the address ship are active.

    Dina

  • Drag and drop events/data Question

    I'm dragging one datagrid to another line. When dumped the second grid that I want to run a query that returns more detailed data on the object to move. I created the following function to try to capture a specific part of the data of the object to drop I can then proceed to a .cfc for treatment.

    private void dragDrop_handler(event:DragEvent):void {}
    var myDragSource:DragSource = event.dragSource;
    var myStatus:String = String (myDragSource.dataForFormat ('Status'));
    Alert.Show (myStatus);
    }

    This is the function call in my second grid: dragDrop = "dragDrop_handler (event)" "

    The alert indicates a value 'null '. How can I capture the value of the 'Status' field that has been ignored on my second grid? If it makes a difference that the dragdrop object created flex. I did not create an object custom dragdrop.

    Thanks for the help with this.

    Mark F

    Atta,

    It's great. I dance all around him, but just couldn't. Thank you.

    Mark

  • question of event listener

    Hi all

    I'm sorry if this question could be very basic, but I'll go and ask him anyway.


    If I have a clip with a same listener attached to it, is the event listener are deleted automatically when the clip is removed from the scene or do I always have to remove the event manually listeners?

    Thank you all very much

    It all depends on how you set up your event listener.

    This is the method signature for the addEventListener method:

    addEventListener (type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
    The fourth parameter, useWeakReference, tells the EventDispatcher if we keep a strong or a weak reference to the event dispatcher.  If set to false, the EventDispatcher will not retain a reference to the sender once the dispatcher is removed.  If the value is true, it is your responsibility to explicitiy removeEventListener.
  • dispatching event... such of the trial...

    Hello
    .. .view next code... EventTrial object will be sending an event 'trialObjectCreated '. It is taken properly with the test method in the same object. The "MyFirstApplication" object that creates the EventTrial object listen also to the same event. But it seems that it is not 'hear' it generated. No idea what I was wrong...

    results in the console:

    shipped from eventTrial test
    event dispatch...
    [object EventTrial]
    [SWF] F:\FlexSourceData\myFirstApplication\bin\myFirstApplication-debug.swf - 1,854 bytes after decompression


    Thank you


    package {}
    import flash.events.Event;
    import flash.events.EventDispatcher;

    SerializableAttribute public class EventTrial extends EventDispatcher {}

    public void EventTrial() {}
    this.addEventListener ("trialObjectCreated", test);
    dispatchEvent (new Event ("trialObjectCreated"));
    trace ("event dispatch... ») ;
    }

    private void test(event:Event):void {}
    trace ("test shipped from eventTrial");
    }
    }
    }

Maybe you are looking for

  • Hard drive satellite A80 + weird sounds

    When running my hard driveis a weird noiseIt is not like the sound of the wind, but it's like something Daniel inside the hard drive.It does not affect my operating system or performance... for nowbut I don't know about the future...Anyone know what

  • MCB2300 and PID

    Hello!Can I use a regulator PID for MCB2300 programming?

  • Try to install sp2 to vista and...

    Download and install SP2 via windows update, after reboot, the machine hangs and it is on the screen: !! 0xc019002!  24941/99261 (F3ahovoas.dll) the machine hangs here forever, and it does not start in safe mode at all. Help!Thank you

  • How can lableted Searchplugin files, I get rid of them?

    With 'bProtectforwindows' folder I also get 'Searchplugin' or 'searchplugins' how can you get rid of these, I'm going crazy! If they are no threat, then I can live with it, (hope that 'windows' notes!) Tony

  • Compaq Presario CQ57-339WM: Compaq Presario CQ57-339WM randomly fails to start

    I had a very strange problem with my Compaq Presario CQ57-339WM laptop. My laptop suddenly, carefully and randomly last night, didn't start the operating system. It's all the way to the start screen, but who could not pass. Safe mode wouldn't work, n