How to pass the e: MouseEvent to another function?

How to pass the e: MouseEvent to another function?

public void onObjectFound(e:MouseEvent):void
{
var e = e:MouseEvent;
e.currentTarget.removeEventListener (MouseEvent.CLICK, onObjectFound);
var myTween:TweenLite = new TweenMax (e.currentTarget, 1, {scaleX:e.currentTarget.scaleX * 1.5, scaleY:e.currentTarget.scaleY * 1.5, onComplete:deleteObj});})
function deleteObj (): void
{
removeChild (DisplayObject (e.currentTarget));
deleteObjects (e.currentTarget.name);
dispatchEvent (new Event (Event.COMPLETE));
}
}

ArgumentError: Error #2025: the supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
to Function / com.enachedragos:Load_Objects/onObjectFound/com.enachedragos:deleteObj() [s\Blackcode\Desktop\Android game Project\com\enachedragos\Load_Objects.as:39 C:\User]
service / http://adobe.com/AS3/2006/builtin: applies ()
at com.greensock.core::TweenCore/complete() [C:\Users\Blackcode\Desktop\Android game Project\com\greensock\core\TweenCore.as:177]
at com.greensock::TweenMax/complete() [C:\Users\Blackcode\Desktop\Android game Project\com\greensock\TweenMax.as:779]
at com.greensock::TweenMax/renderTime() [C:\Users\Blackcode\Desktop\Android game Project\com\greensock\TweenMax.as:761]
at com.greensock.core::SimpleTimeline/renderTime() [C:\Users\Blackcode\Desktop\Android game Project\com\greensock\core\SimpleTimeline.as:79]
at com.greensock::TweenLite$/updateAll() [C:\Users\Blackcode\Desktop\Android game Project\com\greensock\TweenLite.as:629]

never nest named functions.

You can use:

public void onObjectFound(e:MouseEvent):void
{

e.currentTarget.removeEventListener (MouseEvent.CLICK, onObjectFound);
var myTween:TweenLite = new TweenMax (e.currentTarget, 1, {scaleX:e.currentTarget.scaleX * 1.5, scaleY:e.currentTarget.scaleY * 1.5, onComplete:deleteObj,onCompleteParams:[e.currentTarget]});})

}

function deleteObj(dobj:DisplayObject):void
{
dobj.parent.removeChild (dob);
not sure that what follows is logical
dispatchEvent (new Event (Event.COMPLETE));
}

Tags: Adobe Animate

Similar Questions

  • How to pass the dynamic parameter to a function of database in OBIEE

    Hello

    I have a requirement like this. I need to create a report in OBIEE which stood in the discoverer. Now in the Scout report there is a calculated item in the worksheet based on the pkg.functions database. The user setting which gives the runtime parameters are then passed to the discoverer calculated elements dynamically. But I am not able to do this in OBIEE answers.

    Can someone tell me step by step how I can able to transmit the values of user setting selected in the level of response OBIEE.

    The example:

    GET_COMM_VALUE_PTD ('cost AFE & commitment'. ID of the AFE,: ' name at that time (AFE) ', 'cost of the AFE & commitment '. Salt of data, 'cost of the AFE & commitment '. The org ID)

    GET_COMM_VALUE_PTD - database function
    ('Cost AFE & commitment'. ID of the AFE,: ' name at that time (AFE) ', 'cost of the AFE & commitment '. Salt of data, 'cost of the AFE & commitment '. org Id - settings...: "period Name (AFE)" is the dynamic setting of the execution by the user.


    Help, please.

    Thank you

    Titas

    Hello

    Please see this link.

    http://satyaobieesolutions.blogspot.in/2012/08/database-evaluate-function-database.html

    This can be help you.

    Thank you
    Satya

  • How to pass the value of the element from one form to another form?

    Hi all

    I need your help to complete this task.
    I have a form page named reserve form.i have some five fields selection list in the form of reserve, after I chose the first value from the selection list, I create a button in the form of reserve, when I click on the button create, it will open another form page named set form in this form page , I have a field selected, the list of values in configure the form depends on the values selected as a reserve, it means that I have to change the value of page of a form to another form.

    Please suggest a solution, how to pass the value?

    Thank you
    Robette.

    Check out the button create on Page 8.

    In the Action when the button is clicked, the configuration is

    The value of these P35_IT_PRODUCT
    With these values & P8_IT_PRODUCT.

    Kind regards

  • How to pass the parameters or values film double hollow?

    Hello

    I create a game in Flash 8 with 2 AS and I have some questions to ask.

    First of all, I'm stuck for 2 days to create a tower Laser beam to the target.

    I searched the internet for solutions but I can't really find one, so I'll try display of questions myself...

    First I tried to create, and the effectHolder in which each laser beam has been created, because it seems I can create only one line in each movieClip...

    _root.duplicateMovie(effectHolder_mc , "effectHolder_" + this, _root.getNextHighestDepth());
    v = a = _root["effectHolder_" + this];
    ray.onEnterFrame = function()
    {
    v.clear();
    v.lineStyle(1,0xFF0000,100);
    v.moveTo(this._x, this._y);
    v.lineTo(creep._x , creep._y);
    v.text = "True"

    }

    It's triggered eveytime, she was a target.

    With each turn that triggered a laser that I created, it became more than offset, so I tried selfdestructing after some time.

    this._alpha -= 10;

    if (this._alpha <= 0)

    {

         this.removeMovieClip();

    }

    But he did not actually work, so I tried another solution. I tried to give each MovieClip ("Laser"), duplicate code that creates the laser beam.

    onClipEvent(load)
    {
         this.fx = from._x;
         this.fy = from._y;
         this.tx = to._x;
         this.ty = to._y;
    }
    onClipEvent(enterframe)
    {
         _root.dmg.text = "From: " + fx + "," + fy + " To: " + tx + "," + ty; //I used this on a textbox to see if parameters are transmited. But they were all 'undefined'

            this.clear();
         this.lineStyle(1,0xFF0000,100);
         this.moveTo(from._x, from._y);
         this.lineTo(to._x , to._y);

         this._alpha -= 4;
         if (this._alpha <= 0)
         {
              this.removeMovieClip();
         }
                                 
    }

    The problem is that I did not know how to pass the coordinates of the tower and the target to the MovieClip so that it knows where to create the line.

    X++;
    duplicateMovieClip(_root.Laser, "Laser" + X, X,{from._x,from._y,to._x,to._y});         
    g = _root[_root.Laser + X];
    g.fx = from._x;
    g.fy = from._y;
    g.tx = to._x;
    g.ty = to._y;

    Please leave suggestions on how to send the parameters or values for the created clip, or an idea of the creation of this line ("beam") for each tower, without so much trolling.

    Thank you

    Chris

    What is the trigger of v's _alpha decrease?

  • How to pass the value of the item Application Javascript function.

    Hello

    I have the JavaScript in the properties attribute of the HTML Form element

    I'm on page 1 and passing the value of the item page P1_DEPT_NO. It is perferctly working very well and I am able to get the exact value of the element on the page
    onchange="javascript:function1($x('P1_DEPT_NO').value);"
    I'm on page 1 and passing the value G_DEPT_NO of the Application element .
    The problem here is, I don't get the point of Application inside the javascript function value.
    I tried to use alert(); and it gives me the undefined value
    onchange="javascript:function1($x('G_DEPT_NO').value);"
    I just want to know, How to pass the value of the Application in Javascript element.

    Thank you
    Deepak

    Deepak,

    I'm not a Javascript expert, but the suggestin I did was because the javascript is a case-sensitive... language and thats why onChange is not the same thing as onchange.
    Not sure if this is causing the problem.

    Application elements not associated with a page and have therefore no properties user interface.
    So, as mentioned in another post, the rendering would not work for the elements of the application.
    If it is for a single item, used only on this page, you might create a hidden page element and use it fo your goal

    If you want to keep watching objects application and AJAX, this page contains examples of using AJAX to solve problems like the one you mentioned.
    http://www.Oracle.com/technology/OBE/hol08/apexweb20/ajax_otn.htm#T1B

    Thank you
    Rajesh.

  • How to pass the Javascript function OBJECT

    Hello

    I have 2 items.

    P1_ITEM1
    onchange="javascript:function1(this); // here we are passing the object (THIS) for P1_ITEM1
    {code}
    
    
    P1_ITEM2
    {code}
    onchange="javascript:function2(this); // here we are passing the object (THIS) for P1_ITEM2
       
    // how can I pass the object of P1_ITEM1.
    onchange="javascript:function3(xxxx); // here I want to pass the object for P1_ITEM1
    {code}
    
    
    Thanks,
    Deepak                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Deepak

    Change the function definition for a pThis parameter to start - it's confusing otherwise.

    For your last example, modify the parameters for the function to be () (Nothing) and then have the first line of another function as

    var pThis = document.getElementById('P1_ITEM1');
    

    Then use pThis as object...

    See you soon

    Ben

  • How to pass the Visa Resource Name parameter to labview dll in labwindows/cvi

    Hello world

    I build a dll of labview, the prototype is: double getchannelpower (double f, uintptr_t * VISAResourceName);

    I don't know how to go from VISAResourceName to this function.

    Is it related to the ViPSession paremeter in function viOpen(REES ViSession, rn ViRsrc, ViAccessMode am, ViUInt32 ti,ViPSession vi)?

    BRs,

    lotusky

    Hey, guys:

    I figured out how to pass the parameter.

    In labview, you must replace the control of visa with string control. In this way, the generated dll function at the entrance of the string type.

    I hope this will help others!

    lotusky

  • How to pass the session IMAQ to the Subvi

    Hello

    My experience with LabView is neither very good nor extended. I am a scientist and I'm with IMAQ data acquisition. My current problem is that the people who wrote the script is modular, versatile, or clear initially structured. So I try to reduce the ridiculous number of tests in a simple flowchart to a level that people can actually understand it... and to make the more versatile script for future experiments.

    I'm introducing quite a few subVIs to be executed repeatedly. However, I can't know how to pass the IMAQ session on the Subvi. I constantly get the error messages. In this case, I want to acquire images with OIDE_CollectFrame.vi controlled by OIDE_TrialPhaseCollect.vi. I couldn't understand how to assign the refnum IMAQ session class, either.

    It is probably a newbie question, but usually I program with LabView.

    Dennis


  • HOW TO PASS THE HEX OF THE MAIN PROGRAM VI ENUM, SUB VI ENUM VALUE

    HOW TO PASS THE HEX OF THE MAIN PROGRAM VI ENUM, SUB VI ENUM VALUE.

    HOW THEN IT WILL CHOOSE CORRECT ON SUB VI HEXAGONAL ENUM VALUES.

    Enum values are strings, you must first convert the hexadecimal value to a hexadecimal value chain represtation.

    Then that convert from the enum.

  • How to pass the value?

    Hello.. I'm creating an application of streaming, in which I have a list field in a screen like this...

    1

    --------

    2

    --------

    3

    --------

    and when the item 1 is selected means a url must be passed to the video player...

    I created the list field screen in a package and a video player in other package... but I do not know how to pass the value of the field from the list to the player... Help, please... its URGENT...

    You can get the index selected by the listname.getSelectedIndex () method and compare that value with Vector data (data store URL) .that you will give a correct value from the URL and pass it.

  • How to pass the vcs - e License? A server to Server B.

    Hello

    my company has a vcs test server.  and we buy the new server.

    I need to spend vcs again server.   I backup and deploy using the vmware ovf file.

    deploy the success. but new server vcs poster license error.

    How to pass the license of vcs?

    Of his assignment, it is not necessary to use both servers at the same time.

    If I see, if you move the virtual computer between two servers and you used local storage the

    Serial number will change...

    Please remember useful frequency responses and identify useful or correct answers.

  • How to use the product key on another mac

    How to use the product key on another mac

    Exactly in the same way you did the first time... install and enter your serial number when Setup screen serial number

    You install exactly in the same way you did the 1st time... Put your disc in the drive, and enter your serial number when asked

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    -you will need to enter your original serial number during the installation for non-Cloud programs

    - or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

    - and also read https://forums.adobe.com/thread/1146459

  • How to pass the value of the run-time file .sh by Oracle procedure

    I have a file test.sh that contain

    #1/bin/bash

    exp test/test@orcl file=/home/oracle/dump/test.dmp log=/home/oracle/dump/test.dmp grants = Y = index constraints Y = Y = (test) owner statistics = none

    Exit 0

    I craete a work called Create_job_proc in this work, I want to pass the value of job_action is the location of the file test.sh to

    /U01/home/Oracle/dump/test.sh and want to spend the test/test@orcl as a variable...

    Please suggest me... how to pass the value of Job_Action which will replace the .sh file content test/test@orcl to the value of the time of execution as scott/tiger@hr

    Thank you much Parth... It works perfectly...

    Thank you all for your help...

  • I have one of my programs adobe on a mac pro, which is broken. How to pass the program over this i mac?

    I have one of my Macbookpros that has a broken screen. How to pass the program Adobe of it ti that I have Mac?

    Download/install the desktop application, connect and install applications subscription.

    https://helpx.Adobe.com/creative-cloud/help/download-install-app.html

  • It costs more to go to monthly payments?  How to pass the year to monthly payments?

    It costs more to go to monthly payments?  How to pass the year to monthly payments?

    Diane H,

    Yes, the month subscriptions are expensive as they come without see all annual contract, Adobe - General conditions of subscription

    To change your plan see, update or change your plan creative cloud

    Let us know if that helps.

    Kind regards

    Bani

Maybe you are looking for