How to check event.target type in "if" statement

Hi, i have "roll over" event listener and i would like to that works only with MovieClips (without textfields etc.). I would like to write something like that:
if(event.target == MovieClip){ do something }
else { do something else}
This doesn`t work properly.
How to check type of event.target in "if" statement?
Thanks for any help.


if(getQualifiedClassName(event.target) == "flash.display::MovieClip"){ do something }
else { do something else}
 .

Similar Messages

  • How to get event.target/event.currentTarget for HTML-5 canvas for click handler

    Hi,
    I hope everyone is doing great.
    I belong to Actionscript background and just started on Flash CC HTML-5 canvas.
    How to get event.target or event.currentTarget in Flash CC for HTML-5 canvas for click event.
    Like we used to do it in AS 3.0
    btn.addEventListener(MouseEvent.CLICK , go);
    function go(evt:MouseEvent){
       trace(" evt - "+evt.currentTarget); // It will let us know the clicked target
    For  HTML-5
    btn.addEventListener('click' , go.bind(this));
    function go(evt){
       console.log(" evt - "+evt.????t); // what is the correct syntax here?
    Thanks,

    Hey guys found the answer from stackoverflow
    it is - evt.target

  • AS 3.0 how to set event target?

    Hi,
    I am trying to execute an event on a specific target and I am
    not successful in doing this in AS 3.0 since event.target is read
    only. Here is the scenario:
    - I have a button and the path to this button is:
    DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104
    I know this because I did install a listener to and when I
    clicked I recorded the path.
    - I would like to execute a click programmatically on that
    path by just creating an event and setting the target to that
    button
    (DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104)
    however I don’t know how to set the target. Can anybody help
    or point me to the right direction so I can do this.
    Thanks…

    zoran,
    Sorry,I didn't explain what to do very clearly :).
    Básically, the event.taget parameter is set when you use the
    dispatchEvent function, so if you want an event to be dispatched
    from a Object you must call the dispatchEvent from this function.
    The line I gave you wont work by itself since I don't know
    how you reference
    DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104
    in your application.
    But what you need to do is call the dispatchEvent function in
    the Button104 object with the specific event you want to trigger.

  • How to check 2 condition types (kschl)

    Hi,
    READ TABLE i_komv WITH KEY kposn = ekPo-ebelp kschl EQ 'JEC1' OR
                                                  KSCHL EQ 'JMO1'.
    how to write this above stmt? I have to check 2 condition types with a single read stmt?
    regards,
    Star Shankar

    I guess Kishan wants to refer as:
    READ TABLE i_komv WITH KEY kposn = ekPo-ebelp .
    if <b>i_komv-</b>kschl EQ 'JEC1' OR
    <b>i_komv-</b>KSCHL EQ 'JMO1'.
    ....<code>
    endif.
    As KSCHL is part of internal table I_KOMV.
    or
    READ TABLE i_komv WITH KEY kposn = ekPo-ebelp .
    check i_komv-kschl EQ 'JEC1' OR i_komv-KSCHL EQ 'JMO1'.
    ....<code>
    Kishan,
    Correct me if i am wrong.
    Regards
    Eswar

  • Help,how to check a input type?

    Dear all experts,
    in the selection-screen,user need to key in the vendor consignment code ( vdrcsg  for mslb-lifnr ) some user key in storage location ( mseg-lgort ) in this field. Is there anyway tat i can do verification before procees to the start-of-selection? how to check if the user key in correct data type to the selection screen? thanks

    hi Joan,
            Check these links :
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a234d9b511d1950e0000e8353423/frameset.htm
    http://www.erpgenie.com/abap/selection_screens.htm
    http://www.sapdevelopment.co.uk/reporting/selscr/selscr_loopscreen.htm
    priyanka.

  • MRP run: how to check the target quantity of Schedule Aggreement

    Hello Gurus,
    We have a requirement when running MRP, creating schedule lines automatically in Schedule Aggreement.
    Currently, the MRP did NOT check the target quantity of Schedule Aggreement. But we need to check this, to make sure the schedule line quantity will not exceed the target quantity.
    I check some note and the solution is use quota arrangement. but quota can be limit the maximum quantity per vendor, not per S.A.
    Is there any way to fullfill this requirement?
    Configuration?
    Or any BAID/enhancement can be implemented?
    Or where to do the modification?
    Please advise, Thanks a lot!
    Regards,
    Charlie

    Hi Charlie
    This is the standard behavior: MRP does not check the target quantity.
    If you want to develop your own code to do that, the only option that I see is MD_MODIFY_SOURCE. This BAdI allows you to define your own logic for the source determination during the MRP run.
    Take a look on the following document for the most common BAdIs on MRP:
    BAdIs for MRP
    BR
    Caetano

  • How to check a text type if it is filled or not for specific user status

    Hello;
    I want to check if a text type in a notification is filled or not for a specific user status. I guess that can be done using the BADI "ORDER_SAVE", but not sure how to do that.
    Regards,
    Erkan Kaya

    Hello Erkan.
    You can use the function module CRM_ORDER_READ_OW in method check_before_save of BADI ORDER_SAVE.
    Fill the header_guid of the notification into the it_header_guid table parameter and get the returning table ET_TEXT.
    For performance reason you should provide importing parameter it_requested_objects.
    INCLUDE CRM_DIRECT.
    APPEND gc_object_name-texts TO it_required_objects.
    Then you can check in et_Text if the required text is maintained. If not, you can raise the exception DO_NOT_SAVE in the BADI.
    Regards,
    Timo.

  • How to get event target?

    I've registered the following Hide event: 
    app.notifiers.add("Hd  ", ...file path);
    Now, how can get object that triggered the event?  [app.active document.activeLayer]  only give me the 'selected' layer.  This obviously does not work in a scenario where the user hides a layer that is not selected.
    I would appreciate any help!

    Action Manager does not have direct access to objects in the Object Model. It has it's own classes and object. Sometimes there can be a more direct access than by name. If the event descriptor had the layer index or ID you could use that instead of the name.
    Sorry, when I threw this together for you I only tested hidding layers that were not the activeLayer. I don't think the reason the alert is empty is because the top layer was hidden. I think it's because the activeLayer was hidden so the actionReference is different.
    Try this( seems to work for me with both )
    try {
        if (arguments.length >= 2) {
        var desc = arguments[0];
        var event = arguments[1];
        // make sure it's the hide event
        if (event == charIDToTypeID('Hd  ')) {
            // get the list of what was hidden
            var list = desc.getList(charIDToTypeID('null'));
            // get the actionReferences from the list
            var ref = list.getReference(0);
            var psClass = ref.getDesiredClass();
            // make sure it was a layer that was hidded
            if(psClass == charIDToTypeID('Lyr ')){
                // check to see what is in the reference
                var dataEnum = ref.getForm();
                // should either be an enum if activeLayer
                if(dataEnum == ReferenceFormType.ENUMERATED) {
                        alert(app.activeDocument.activeLayer.name);
                }else{// or the layer name
                    alert(ref.getName());
    } catch (e) {
      alert( "Error: " + e + ":" + e.line );

  • How to check the data type dynamically

    hi all
    my requirement is like this  in one screen field which is of character type user is inputing data .
    now while saving to the database i have to apply one external check for this data if it is integer type or not
    as this data on the screen is refrenced to the database so i can not change the data type on the screen itself .
    i have to check it externally from PAI ....... would any one please help on this
    Thanks and regards
    Papps

    Hi
    Thanks again you are right i missed the space one ..
    but Now another problem...
    I have tried that but in that case even user can input data by mistake like this
    123 4  but this is not an integer it should also give error as this is also not a correct integer ...
    as par asi think . we have to aain check if there is any spaces in the data provided i guess or
    is there any other procedure ?

  • How to check which user type my Leopard is?

    i recently bought a leopard os x off my friend. im just interested in knowing if it is a single user or family pack. Just wondering how i can find that out.

    The Mac OS X Family Pack allows the installation of the Mac OS X DVD onto 5 Mac (max). There are restrictions on just what Macs are considered part of a Family's household (I think a college student living at school qualifies, but otherwise the Macs generally have to be in the same home).
    Besides that, there is no difference between a Mac OS X Family Pack and a single Mac license.
    There are no activation codes.
    However, the way you worded the question makes me wonder if you are asking whether you can create multiple accounts on your Mac. A separate account for different members of your family.
    If that is the question, then every Mac OS X installation allows multiple accounts for different users on the same Mac. You may make some Admin accounts, and some regular users. You can impose parental controls on some accounts and not on others.
    You can use Fast User Switching between accounts, without needing ot logout of an account.

  • How to check an iphone lock or unlock state with iphone imei?

    well i see a lot of people that can do this .
    but i dont know which site and how they can do it.
    can anyone plz tell me?

    Call AppleCare, as Apple maintains the database of officially unlocked iPhones.

  • Object does not match target type when raising an event from c# to VB6

    I have a c# .net DLL that I use from a VB6 app. It exposes an event,
    and the VB6 app is sinking it.
    The VB6 app is receiving the event, as long as it is raised from the
    main thread of the .net DLL.
    I have an aync task being handled inside the DLL (delegate BeginInvoke). Any
    attempt to raise the event from within that thread casuses the reported
    error, even from within the AsyncCallback function, when the thread is ending.
    I noticed that the delegate for the event is not declared inside the
    interface. It's in that module, but above the interface definition:
        [ComVisible(false)]
        public delegate void LoggingEventHandler( string logData );
    The event is declared in the class itself as:
        public class Processor : _Processor
            public event LoggingEventHandler        LogNotification;
    Finally, to raise the event:
    if ( this.Completed != null )
        this.Completed( true );
    If I open the tlb with OLEVIEW, I can see the public event just fine. Of course, I expected to, as it's working up until the helper thread kicks in.
    Now for the REAL WIERD PART! This DOES work on several servers that have
    been in production for months. It's just this one server that it won't work
    on. Same code. Resinstalled/registered it 1,000 times. It took me a while to
    find that an error was even occuring, since it was being raised in the
    seperate thread. In other words, I'm receiving the event just fine on a series of servers. This is a new machine we're trying to bring online. I suspect it's environmental, but I can't figure it out.
    I don't understand why the publisher would be expecting a certain type of
    subscriber in the first place... unless the error is really triggered by the client when the event reaches it. I've put logging into the client, though, and the first line of code inside the event is not being executed.
    For the VB6 app, I reference the tlb file that is automatically created when
    I compile (Interop is checked). I unregistered and re-registered the tlb on
    the server. I regasm'd the dll itself. All dlls are in the same folder - not
    in the GAC.
    The stack trace is as follows:
       at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
    invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
    culture, String[] namedParameters)
       at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
    Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
    CultureInfo culture, String[] namedParameters)
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
    BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
    msgData)
       at HPFS.Queue.IProcessorEvents.LogNotification(String logData))

    This is driving me nuts!
    I sure would appreciate any suggestions.
    I got this working on one of the two machines. The other machine had some other issues, so I had it re-imaged. It's been so long since I fixed the first one, that I can't remember exactly how I did it. Plus, I did so many things to it over two weeks, that I never really felt confident, anyway. But ... I could *swear* that the last thing I did back then to get this event to flow was to re-register the DLL's TLB.
    So ... This is win 2k with FW 1.1 + SP1.
    Completed is the delagate I'm trying to invoke.
    this.Completed.Target.GetType().Name = "__comobject"
    I've tried everything. Unregistered the .tlb. Unregistered the .net DLL. Verified that the app completely failed while unregistered. Created the TLB using RegAsm /tlb syntax.
    I tried using CLR SPY. It registers nothing. It only lets me pick an EXE. This is a DLL tring to raise to an EXE.
    I've looked at the TLB in OLE VIEW and I just don't know what I'm looking at.
    Is there any other tool or technique I can use to audit/monitor/trap this? .net is giving me *** for details about what's failing. I wish I could somehow debug into exactly what it's trying to do and get more details on the failure.
    Here's the error I'm getting:
    (Code -1) Object does not match target type.<Source:mscorlib>(Stack:    at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
       at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at HPFS.Queue.IProcessorEvents.Completed(Boolean success)
       at HPFS.Queue.Processor.RequestDone())
    Processor = the DLL I'm trying to raise the event from.
    IProcessor = the event interface that's exposed through COM.

  • How to define an event-pair by checking event description to create an event reset monitor?

    Hi there,
    We have one application which check connection status with sub component. If the connection is failed, an event will be created like the following
    ID: 53428
    Description: Connection to xxxx failed.
    xxxx is the name of the components. There are about 20 components in total.
    If the connection is restored, then another event will be created similar to the following
    ID: 53429
    Description: Successfully connected with xxxx.
    I want to create an event reset type monitor. The issue I am having now is the unhealthy and healthy event are not just simply paired by the event ID but also the component name in the event description. The monitor should trigger the alert when event
    53428 is detected, however the alert should only reset if event 53429 with the same component name is found.
    How to do this?
    I know this can be accomplished by using script. But is any SCOM native windows event monitor can handle this?
    Thanks!

    Thanks Roger. Your suggestion is also an option however it is not feasible. There are 15 servers in my case and each have about 20 components installed. In my first post, I just put the component names as illustration but in the reality, except the
    component name, the event message also contains the link name like ServerName1 connection to ServerName2. The pair of event has to match both component name and also the link name. If I create one monitor for each possible combination, it would end up
    as many as 300 monitors.
    Script monitor is one for sure working. I just want to confirm whether any native SCOM windows event monitor is capable to do this.

  • How do I use the event.target.name String with an external dispatchEvent?

    ...I hope the title question makes sense...
    On my stage I have an externally loaded SWF with a button. When clicked the button dispatches an event to the main stage.
    On the main stage a listener then loads an SWF into a loader called gallery.
    The gallery loader is also being shared by buttons on the main stage which use the event.target.name String to call in SWFs with corresponding names.
    I am using Tweens to fade-out and -in content to the gallery when a button is pressed.
    Loading the SWFs was working until I tried to create a universal button function for the dispatchEvent buttons...
    The problem I have is that I don't know how to define the String to tell the newSWFRequest where to find the SWF when triggered by the external buttons.
    (I may be doing this all wrong... but figured the best way to load an SWF on to the main stage from an external SWF was by using dispatchEvent??)
    My code triggers the Event and the gallery loader fades out, but then it cannot find the new SWF:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    Please can someone help me understand the way to make the String point in the right direction? (I think the only errors are in bold below)
    Code:
    var myTweenIn2:Tween;
    var myTweenOut2:Tween;
    var nextLoadS2:String;
    // Listen for external event dispatched from external btns
    addEventListener("contactStage", btnClickExtrnl);
    function btnClickExtrnl(e:Event):void {
    nextLoadS2 = ?????
    myTweenOut2=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOut2.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    // Btns Universal function
    function tweenOutCompleteF2(e:TweenEvent){
    myTweenOut2.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    myTweenOut2=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + nextLoadS2 + ".swf");
    myTweenIn2 = new Tween(gallery, "alpha", None.easeOut, gallery.alpha, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    Thank you.

    That works – thank you!
    I'm now using this code to fade in each of the SWFs:
    function contactStage(e:MouseEvent):void {
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
        myTweenIn = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But I cannot add the fade out function. I have amended the above code to create:
    var myTweenOutX:Tween;
    var myTweenInX:Tween;
    function contactStage(e:MouseEvent):void {
    myTweenOutX=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOutX.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    function tweenOutCompleteFX(e:TweenEvent){
    myTweenOutX.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    myTweenOutX=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
    myTweenInX = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But get this error:
    ReferenceError: Error #1069: Property name not found on fl.transitions.Tween and there is no default value.
    at ACOUSTIC_fla::MainTimeline/tweenOutCompleteFX()[ACOUSTIC_fla.MainTimeline::frame1:110]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.transitions::Tween/set time()
    at fl.transitions::Tween/nextFrame()
    at fl.transitions::Tween/onEnterFrame()
    Where am I going wrong?

  • How do I use event.target.name in AS2?

    Thanks to kglad I was able to see how event.target.name in AS3 could make a button load a movieclip with the same namesake.
    I'm doing the same thing now in AS2 but don't know what to write instead of event.target.name.
    And so at the moment each button pushes info into an array and then a function uses that to decide which movieclip to attach to a holder after it has faded out once, and then fades in again...
    // ***** IMAGE GALLERY START ***** //
    // Add image to holder
    imgholder.attachMovie("img0", "image0_0", 1)
    // Array
    var nextLoad = ["img0"];
    // Btn listeners
    img5.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img5"); btnClick() } // Written on 1 line
    img4.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img4"); btnClick() }
    img3.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img3"); btnClick() }
    img2.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img2"); btnClick() }
    img1.onRelease = function() {
    nextLoad.pop();
    nextLoad.push("img1");
    btnClick()
    img0.onRelease = function() {
    nextLoad.pop();
    nextLoad.push("img0");
    btnClick()
    // The btn function
    function btnClick() {
    trace ("click");
    var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true);
    myImgTween.onMotionFinished = function() {
    fadeOutImg();
    // The btn function part II
    function fadeOutImg() {
    trace ("fadeOutImg");
    imgholder.attachMovie(nextLoad, "image1_1", 1);
    var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true);
    I know I should be able to push the button name into the array, but am having to use a string... I'm sure my code is cumbersome!! But it works. I've tried pushing the button name but it end up including the full stage reference.
    Is there a cleaner way of doing this using event.target.name?
    Thanks for looking!

    There is no event.target in AS2. However since AS2 has no way of remembering the scope object where the target object resides, you can use this to your advantage to retrieve the name of the target by using the "this" command in the function whenever you use the above format "mc.onPress = myfunc". FYI, the popular workaround Delegate, made it possible that when you called "this" in the function, you could retrieve the scope object where the target instance resides. So without its use, "this" will return the name of the target object. Anyway this is the code you can use:
    imgholder.attachMovie("img0","image0_0",1);
    var nextLoad = ["img0"];
    img5.onRelease = onImgRelease;
    img4.onRelease = onImgRelease;
    img3.onRelease = onImgRelease;
    img2.onRelease = onImgRelease;
    img1.onRelease = onImgRelease;
    img0.onRelease = onImgRelease;
    function onImgRelease():Void {
       nextLoad.pop();
       nextLoad.push(this._name);
       btnClick();
    // The btn function
    function btnClick() {
       trace("click");
       var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true);
       myImgTween.onMotionFinished = function() {
          fadeOutImg();
    // The btn function part II
    function fadeOutImg() {
       trace("fadeOutImg");
       imgholder.attachMovie(nextLoad,"image1_1",1);
       var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true);

Maybe you are looking for

  • Blocking logistic invoice verification at company code level

    Dear all, May I know what is the system setup (SPRO) for this: Blocking logistic invoice verification at company code level ? Thanks tuffy

  • After 5 hours maverick won't load ?

    trying to load Maveric , after 51/2 hours got message "can't load try again" anyone know why?

  • DB2 jdbc code

    Hi i am writing code to get data from DB2 database using jdbc. do i need to include ; at the end to pass it to the database? String query =                     " DELETE FROM "                          + BMSDatabaseInfo.SCHEMA                         

  • Display balence amt in top of alv list

    Hi experts, I develop one report using ALV (normal alv means not OOALV).In this i want to display opening balance amt at the top of the list. I tried all possibilities but i didn't get.I wrote in this way. ALV_EVENT-NAME = slis_ev_top_of_page .     A

  • Full GC Occuring every 1 minute

    Hi there, My Weblogic 5.1 (service pack 10) seems to be running a full gc every 1 minute even though I have plenty of memory and there is not much traffic on my web site. The full gc is causing me ~9 seconds of pause time every minute for the ~300M o