Call function inside running class

Hey All,
i have a two question in classes.
1- i have class and i called its before and its running on runtime. i need to call function inside this class from another class, but without call the first one again, because if i called it, it will run default class function again
is this doable ?
2- What super() mean ?
Thanks a lot.

this is the default call, and when i call the method by this way its will run the default class function before call the method.
here my example:
i need to call checkboxes  function in ChannelsMain class without pass by the grey script.
Note: the call_cb is working and the trace is working
so i now the class is running, i need to call the checkboxes without ( var ci:YourClass = new YourClass(); )
package com.link
     import fl.controls.CheckBox;
     import flash.events.*;
     public class ChannelsMain
          var cbLength:uint = Main.PV.channel_id.length;
          public function ChannelsMain()
               // constructor code
               for (var i:int = 0; i < cbLength; i++)
                    var cb:CheckBox = new CheckBox;
                    cb.name = Main.PV.channel_id[i];
                    cb.label = Main.PV.channel_name[i];
                    cb.x = 50;
                    cb.y = 50 + i * 30;
                    cb.addEventListener(Event.CHANGE,call_cb);
                    Main.MS.addChild(cb);
                    //call xml function
                    if(i == cbLength - 1)
                         new ChannelsXML();
          private function call_cb(evt:Event)
               trace(evt.currentTarget.name,evt.currentTarget.selected);
          public function checkboxes(evt)
               trace(evt);

Similar Messages

  • Calling a function inside another class

    I have the following two classes and can't seem to figure to figure out how to call a function in the top one from the bottom one. The top one get instantiated on the root timeline. The bottom one gets instantiated from the top one. How do I call functions between the classes. Also, what if I had another call instantiated in top one and wanted to call a function in the bottom class from the second class?
    Thanks a lot for any help!!!
    package
         import flash.display.MovieClip;
         public class ThumbGridMain extends MovieClip
              private var grid:CreateGrid;
              public function ThumbGridMain():void
                   grid = new CreateGrid();
              public function testFunc():void
                   trace("testFunc was called");
    package
         import flash.display.MovieClip;
         public class CreateGrid extends MovieClip
              public function CreateGrid():void
                   parent.testFunc();

    kglad,
    Although I agree that utilizing events the way you attempted in your suggestion is better for at least a reason of eliminating dependency on parent, still you code doesn't not accomplish what Brian needs.
    Merely adding event listener to grid instance does nothing - there is no mechanism in the code that invokes callTGMFunction - thus event will not be dispatched. So, either callTGMFunction should be called on the instance (why use events - not direct call - in this case?), or grid instance needs to dispatch this event based on some internal logic ofCreateGrid AFTER it is instantiated - perhaps when it is either added to stage or added to display list via Event.ADDED. Without such a mechanism, how is it a superior correct way OOP?
    Also, in your code in ThumbGridMain class testFunc is missing parameter that it expects - Event.
    Am I missing something?
    I guess the code may be (it still looks more cumbersome and less elegant than direct function call):
    package
         import flash.display.MovieClip;
         import flash.events.Event;
         public class ThumbGridMain extends MovieClip
             private var grid:CreateGrid;
             public function ThumbGridMain():void
                 grid = new CreateGrid();
                 grid.addEventListener("callTGMFunction", testFunc);
                 addChild(grid);
            // to call a CreateGrid function named cgFunction()
             public function callCG(){
                 grid.cgFunction();
             public function testFunc(e:Event):void
                 trace("testFunc was called");
    package
         import flash.display.MovieClip;
         import flash.events.Event;
         import flash.events.Event;
         public class CreateGrid extends MovieClip
             public function CreateGrid():void
                 if (stage) init();
                 else addEventListener(Event.ADDED, callTGMFunction);
             // to call a TGM function
             public function callTGMFunction(e:Event = null):void
               // I forgot this one
                removeEventListener(Event.ADDED, callTGMFunction);
                this.dispatchEvent(new Event("callTGMFunction"));
            public function cgFunction(){
                 trace("cg function called");
    I think this is a case of personal preference.
    With that said, it is definitely better if instance doesn't rely on the object it is instnatiated by - so, in this case, either parent should listen to event or call a function directly.

  • How to call a function inside a class? 

    Hello, i am trying to fire a function onPress .. this
    function is inside a class.
    In this function i refer to another function inside the calss
    to call a Tween. It never arrives in the second function.
    I tried to make an example.
    In the fla file i have:
    var test:makeMovie = new makeMovie(this);
    You will see a red squere and you can press on it. It should
    run the tween class. Am i using the delegate class wrong?

    I always have to use test movie and trace a couple of times
    each time I start to use Delegate.
    It wraps function.apply I think, which I tend to use more
    often.
    try using:
    Container.onPress = Delegate.create(this,setAlpha);
    and then just
    setTween()
    inside your setAlpha....
    That's conceptually how I think I would try it above if I was
    doing something similar.
    I'm not sure it would have the desired effect even if the
    delegate was executed as you have it coded. Unless you want
    setTween's execution scope to be the Container clip in which case
    you might need to do what kglad said and change the Container
    reference to 'this'.
    The way you have it at the moment inside setAlpha the
    Delegate.create is simply creating a function...and not excuting
    it.
    its like : function something(){trace('what')}
    and not like : something();
    Below is some quick code that helps show how things work.
    Notice that I assigned the delegate function to mainFunc....so that
    along with the last example might provide a clue. Just paste it on
    a frame and take a look at what's happening.

  • Performance issue: CALL FUNCTION inside a Loop.

    Hi Friends
    I have a Performance Issue. That is, inside a loop...endloop a CALL FUNCTION has been used which gets data from another database table. Finally it's appended into another internal table. Please see this :
      LOOP AT i_mdkp.
        REFRESH lt_mdtbx.
        CLEAR lt_mdtbx.
        CALL FUNCTION 'READ_MRP_LIST'
          EXPORTING
            idtnum        = i_mdkp-dtnum
            icflag        = 'X'
          tables
            mdtbx         = lt_mdtbx
        APPEND LINES OF lt_mdtbx TO i_mdtb.
      ENDLOOP.
    It happens for each record available in i_mdkp. Suppose, i_mdkp have around 50000 records, it needs to call the function module till that much time.
    So, I want to split it. Can I?
    Please give me your valueable suggestions.
    Regards
    Senthil

    If internal table i_mdkp has 50,000 records it does not mean that you need to run 50,000 iterations. You just need dtnum from internal table i_mdkp so you number of iterations should be eqaul to the unique number of dtnum in the internal table. Sort the internal table by dtnum and delete adjacent duplicates from the internal table comparing dtnum before looping. Look at the code below.
    DATA i_mdkp_tmp LIKE TABLE OF i_mdkp.
    IF NOT i_mdkp[] IS INITIAL.
      i_mdkp_tmp[] = i_mdkp[].
      SORT i_mdkp BY dtnum.
      DELETE ADJACENT DUPLICATES FROM i_mdkp COMPARING dtnum.
      REFRESH i_mdtb.
      LOOP AT i_mdkp.
        CALL FUNCTION 'READ_MRP_LIST'
          EXPORTING
            idtnum = i_mdkp-dtnum
            icflag = 'X'
          TABLES
            mdtbx = lt_mdtbx.
        APPEND LINES OF lt_mdtbx TO i_mdtb.
        REFRESH lt_mdtbx.
      ENDLOOP.
      i_mdkp[] = i_mdkp_tmp[]
    ENDIF.

  • Help Please ... with calling functions inside listener events

    I need the window to update itself before another method inside my listener is called. When I make the call to updateUI() it preforms it's function once my listener event is compelete while I would like to to happend.
    paw.updateHasMoved();
    temp.updateUI();// -->Want the update to occure before the next line is called
    piece.CB.board = ComputersMove(piece.CB.board);

    okidoi Mr Helpy!
    let me try with this
    just one more question, the button should be created at
    runtime or inside my
    movieclip?
    Regards
    Rick
    "Mr Helpy mcHelpson" <[email protected]>
    escribió en el mensaje
    news:f46tjk$lg1$[email protected]..
    > flooring.onLoad = function(success) {
    > if (flooring.firstChild.hasChildNodes()) {
    >
    > you can just do
    >
    > flooring.onLoad = function(success) {
    > if (success) {
    >
    > you'll need to create a button on top of your image.
    This for me is most
    > easily done with a predefined custom class, and on the
    instantiation of
    > your
    > image(movieclip) you can define the button actions
    contained in the movie
    > clip.
    >
    > make sense?
    >
    > HmcH
    >

  • Call function inside of call function in back ground task

    Hi Friends,
       I am calling one function in back ground task. that is executing after save of the transaction. And inside of that transaction i am calling one more function but in debugging the cursor is not going inside of that function. What could be the reason. Please help me.
    Thanks a lot in advance.

    Hi,
        Inside of the first function any way i will come after save
    using update task debugging. Once it reach inside of firt function and if i press f5 then second function is coming and if i press f5 there then it is coming out of the function and it is not going inside. The second function is called directly not in back ground.
    Thanks..

  • Problem calling function inside a procedure

    I have a procedure that simply calls a function, but I'm not sure how to declare it.
    When I run my script oracle returns an error:
    CREATE OR REPLACE PROCEDURE pr_entrada_close(
         var_id_entrada int)
    AS
    BEGIN
         fn_criaJobAnalise(var_id_entrada);
    END;
    ERROR at line 5: PL/SQL: Statement ignored3. AS
    4. BEGIN
    5.      fn_criaJobAnalise(var_id_entrada);
    6. END;

    As far as I know, that structure worked in at least 8.0 and possibly earlier. I actually saw something similar in production code on that version of Oracle. The actual function took several parameters, and using those paramters did a series of statements along the lines of:
    BEGIN
       SELECT 1 INTO l_var
       FROM table1
       WHERE <predicates>
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RAISE APPLICATION_ERROR (-20001, 'Error');
       WHEN TOO_MANY_ROWS THEN
          RAISE APPLICATION_ERROR (-20002, 'Error');
    END;
    BEGIN
       SELECT 1 INTO l_var
       FROM table2
       WHERE <predicates>
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RAISE APPLICATION_ERROR (-20003, 'Error');
       WHEN TOO_MANY_ROWS THEN
          RAISE APPLICATION_ERROR (-20004, 'Error');
    END;
    -- About 4 or 5 more tables checked
    RETURN 1;and the caller looked kind of like:
    DECLARE
       NO_ROWS_TABLE1 EXCEPTION;
       DUP_ROWS_TABLE1 EXCEPTION;
       NO_ROWS_TABLE2 EXCEPTION;
       DUP_ROWS_TABLE2 EXCEPTION;
       PRAGMA EXCEPTION_INIT (NO_ROWS_TABLE1, -20001);
       PRAGMA EXCEPTION_INIT (DUP_ROWS_TABLE1, -20002);
       PRAGMA EXCEPTION_INIT (NO_ROWS_TABLE2, -20003);
       PRAGMA EXCEPTION_INIT (DUP_ROWS_TABLE2, -20004);
       l_v NUMBER;
    BEGIN
       BEGIN
          l_v := test_tables(<parameters>);
       EXCEPTION
          WHEN NO_ROWS_TABLE1 THEN
             <do something about it>
          WHEN DUP_ROWS_TABLE1 THEN
             <do something about it>
          WHEN NO_ROWS_TABLE2 THEN
             <do something about it>
          WHEN DUP_ROWS_TABLE2 THEN
             <do something about it>
       END;
       <Continue normal processing>
    END;and, yes, <Continue normal processing> occasionally failed for mysterious reasons when more than one of the checks would have failed had the function got to them, and l_v was never ever used.
    This was one of the clevererbits of code in that app.
    John

  • Hang Calling function after Document Class' Event.ADDED

    I was trying to load an external SWF (that contains the below code in its document class) with the Loader class but i keep on receiving Error #1009: Cannot access a property or method of a null object reference. So i tried to use the event listener Event.ADDED in MyDocumentClass constructor of the external SWF to let the document class be part of the display list before i invoke createRandomGraph. But when i place createRandomGraph( ) inside onStageReady, The compilation process hangs. When i leave the createRandomGraph( ) inside the constructor, it works perfectly as stand alone but will produce Error 1009 if loaded within the loader SWF. Any ideas?
    public function MyDocumentClass( )
        this.addEventListener(Event.ADDED, onStageReady);
        createRandomGraph( )
    private function onStageReady(oEvent:Event):void
        this.removeEventListener(Event.ADDED, onStageReady);
    private function createRandomGraph( ):void
        var cRandomGraph:RandomGraph = new RandomGraph();
        cRandomGraph.x = 10;
        cRandomGraph.y = stage.stageHeight - nH - 25;
        cRandomGraph.setDimensions(nW,nH);
        cRandomGraph.createGraphBackground();
        this.addChild(cRandomGraph);

    use:
    public function MyDocumentClass( )
        this.addEventListener(Event.ADDED_TO_STAGE, onStageReady);
    private function onStageReady(oEvent:Event):void
        this.removeEventListener(Event.ADDED, onStageReady);
    createRandomGraph();
    private function createRandomGraph( ):void
        var cRandomGraph:RandomGraph = new RandomGraph();
        cRandomGraph.x = 10;
        cRandomGraph.y = stage.stageHeight - nH - 25;
        cRandomGraph.setDimensions(nW,nH);
        cRandomGraph.createGraphBackground();
        this.addChild(cRandomGraph);

  • Query Report Error ( Call function inside Query report )

    Hello every body,
    I'v database Oracle 11g R2 and i have Apex 4.1 , when i run my report with a simple query :
    select gydb_wf_id,
    gydb_workflow_name,
    gydb_work_flow_owner,
    FUNC_GET_NBR_LAST_STEPS ( gydb_workflow_id) NBR
    from gybd_workflow ;
    I got the following message error :
    Query cannot be parsed within the Builder. If you believe your query is syntactically correct,
    check the ''generic columns'' checkbox below the region source to proceed without parsing.
    ORA-00904: "FUNC_GET_NBR_LAST_STEPS": invalid identifie
    Note that i have all privilages on my function (FUNC_GET_NBR_LAST_STEPS) ,
    Any issues
    Tnahkyou

    Hi Yosof      ,
    concatenate schema name with your function
    for example
    select gydb_wf_id,
    gydb_workflow_name,
    gydb_work_flow_owner,
    ABC.FUNC_GET_NBR_LAST_STEPS ( gydb_workflow_id) NBR  // here i have written ABC as schema name
    from gybd_workflow ;try and see it is working or not.
    hope it works,
    Thanks,
    Jitendra

  • Calling function from deferint classes

    Dear all
    Am working in multiple classes application and i need to use from another class how i can
    Do that like :
    Function name sendBye in class SipMessage and i need to use that function in class callBox
    I try to use this code
    SipMessage sipM = new SipMessage();{
    sipM.callBox; but am receiving many Exceptions

    Javarcle wrote:
    but am receiving many ExceptionsThat sucks, dude. Maybe if you fix the problem, you'll stop getting the exceptions

  • Calling a private function when inside another class?

    Can't help it but im curious how classes seem to be able to
    call private functions inside other classes. I'm mainly thinking
    about the addEventListener() here. When adding a listening function
    to a class, that function can be private, and yet it seems to be
    called magically somehow. Or maybe its all internal? I dunno.
    Anyone? :D

    Hi Kenchu1,
    You can grab a copy of the open source API here:
    http://www.baynewmedia.com/download/BNMAPI10.zip
    (feel free to drop by
    the main site for documentation as well :) ). The main class
    is the
    Events class, "broadcast" method. This method broadcasts
    events in a
    decoupled fashion, meaning that listeners can listen to
    messages that
    aren't bound to a specific sender. The AS3 version works in
    much the
    same way except that I still haven't fully fleshed out the
    cross-SWF
    communication that this version can do (broadcast across all
    movies on
    the same computer using LocalConnection).
    Basically, the broadcaster works like this:
    1. Add event listener and bind to function A (called from
    within the
    class so the reference is available)
    2. Event listener pushes this into the listener array. It was
    provided
    by the class so the reference is valid and is now a part of
    the events
    class as well.
    3. Broadcast runs through all associated events when it comes
    time to
    broadcast and calls the function by using the array
    reference:
    this.listeners[message].call(classInstance,someParameter);
    In other words, the class that adds the listener "allows"
    the event
    broadcaster to use the reference because it passes it out.
    You can do
    the same thing by calling:
    someOtherclass.functionRef=this.privateFunction
    someOtherClass is the class that will store the private
    reference,
    functionRef is some variable to hold the reference, and
    privateFunction
    is the private function. Then, in someOtherClass, you can
    call:
    this.fuctionRef(someParameter);
    Hope this helps.
    Patrick
    Kenchu1 wrote:
    > Patrick B,
    > exactly! Something like that is what im looking for. I
    have my own rather
    > simple system right now with listeners and classes
    calling these, but since i
    > dont know how to call a private function, i had to make
    all the listening
    > classes functions public - something id rather avoid.
    Exactly how did your
    > event broadcasting system work? Oh, and we're talking
    AS3 btw.
    >
    > How do i call a function via a reference? (to the
    function? To what?)
    >
    http://www.baynewmedia.com
    Faster, easier, better...ActionScript development taken to
    new heights.
    Download the BNMAPI today. You'll wonder how you ever did
    without it!
    Available for ActionScript 2.0/3.0.

  • Calling a function inside an iFrame

    I have a app I'm building that plays videos through an iFrame (src is our server). I want to have buttons in my client that when clicked can call functions inside the iFrame (e.g. play, pause). Obviously the problem is with doing this is browser security will not allow it. I understand AIR provides extra parameters for an iFrame to achieve this. I have been reading up on this and seen to get the impression that calling functions in the iFrame can only be done before the page loads?
    Has anyone any basic examples of how I could achieve this?

    Not all built-in functions can be used directly in an assignment.
    SQL> CREATE PROCEDURE p (p_val IN VARCHAR2) AS
      2  l_v VARCHAR2(10);
      3  BEGIN
      4     l_v := DECODE(p_val,'YES','TRUE','FALSE');
      5  END;
      6  /
    Warning: Procedure created with compilation errors.
    SQL> show error
    Errors for PROCEDURE P:
    LINE/COL ERROR
    4/4      PL/SQL: Statement ignored
    4/11     PLS-00204: function or pseudo-column 'DECODE' may be used inside
             a SQL statement onlyTTFN
    John

  • Call function or class from a loaded MC

    Hi,
    Can anyone tell me if its possible to call a function or class from within a loaded MC?
    mainMovie loads MC > MC calls function in a class of mainMovie
    if so, what is the best method?
    I've tried this from loaded MC but (of course) an error pops:
    movieClip(parent.parent).DO_THIS();
    Thanks for any "light" on this.

    It works fine!
    I'll try now to "sniff" into some class in main movieClip...
    Thanks

  • CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'

    I am newbie to ABAP.
    To get the characteristic values I am using following FM inside a BADI called Batch_Master.
    When I test this FM in se37 I get the desired values in t_class with one entry and t_objectdata with 4 entries.
    I know what to fill in for class, classtype, object.
    <b>Now when I call this FM in BADI how do I read my data from t_class and t_objectdata ??</b>
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    EXPORTING
    class = i_class
    classtype = i_classtype
    object = i_objek
    TABLES
    t_class =
    t_objectdata =
    *EXCEPTIONS
    *no_classification = 1
    *no_classtypes = 2
    *invalid_class_type = 3
    *OTHERS = 4

    This is the sample code
    FORM voorraden_in_output TABLES xmchb STRUCTURE wa_xmchb
                            CHANGING wa_vart04_charg
                                     STRUCTURE wa_vart04_charg.
       SORT xmchb BY werks lgort matnr.
    * charge tabel lezen
       LOOP AT xmchb INTO wa_xmchb WHERE matnr = wa_vart04_charg-matnr.
         l_wa_mchb = wa_xmchb.
         wa_vart04_charg-werks   = l_wa_mchb-werks.
    * magazijn
         wa_vart04_charg-lgort   = l_wa_mchb-lgort.
    * charge
         wa_vart04_charg-charge  = wa_xmchb-charg.          "LCMG PD 20070712
    * bepaal batchclassificatie
         PERFORM clear_class_fields CHANGING wa_vart04_charg.
         IF NOT wa_xmchb-charg IS INITIAL.                  "LCMG PD 20070712
           PERFORM get_classificatie_batch TABLES ta_object_data
                                            USING wa_vart04_charg-matnr
                                                  wa_vart04_charg-charge.
    *  vul wa_vart04_charg met gegevens uit ta_object_data
           PERFORM kenmerken_in_output TABLES ta_object_data
                                              ta_class
                                       USING  wa_vart04_charg
                                              wa_xmchb.     "LCMG PD 20070712
         ENDIF.
         PERFORM check_kenmerken USING wa_vart04_charg
                              CHANGING sy-subrc.
         IF sy-subrc <> 0.
           CHECK 1 = 2.
         ENDIF.
    *  gereserveerde voorraad bepalen
         PERFORM gereserveerde_voorraad  CHANGING l_wa_mchb
                                                  wa_vart04_charg.
    *  voorraden charge regel bepalen
         PERFORM charge_voorraden           USING l_wa_mchb
                                                  wa_vart04_charg.
    * charge regel is volledig bepaald
         APPEND wa_vart04_charg TO ta_vart04_charg.
       ENDLOOP.
    ENDFORM. 
    * lokale data vullen
       l_object(18)    = artikel.
       l_object+18(10) = charg.
       l_classtype     = c_023.
       l_obtab         = 'MCH1'.
    FORM get_classificatie_batch TABLES  ta_object_data STRUCTURE clobjdat
                                   USING  artikel TYPE mara-matnr
                                          charg   TYPE mchb-charg.
       DATA: l_object TYPE ausp-objek,
             l_classtype  TYPE  klah-klart,
             l_obtab TYPE  tcla-obtab.
    * lokale data vullen
       l_object(18)    = artikel.
       l_object+18(10) = charg.
       l_classtype     = c_023.
       l_obtab         = 'MCH1'.
    * schonen interne classificatie tabellen
    *  REFRESH: ta_class, ta_object_data.                  "LCMG PD 20070712
       CLEAR  : ta_class, ta_object_data.
       CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
         EXPORTING
           classtype          = l_classtype
           language           = sy-langu
           object             = l_object
           objecttable        = l_obtab
           key_date           = sy-datum
           no_value_descript  = 'X'                              " 467394GVE
           initial_charact    = ' '
         TABLES
           t_class            = ta_class
           t_objectdata       = ta_object_data
         EXCEPTIONS
           no_classification  = 1
           no_classtypes      = 2
           invalid_class_type = 3
           OTHERS             = 4.
    ENDFORM. 

  • How to initialize a function in another class

    Hello,
    I have one class 'run.as'
    In this class i add an movieclip to the stage with it's own
    class.
    So in the constructor of run.as i have:
    _ElevatorDoors = new ElevatorDoors (200,200);
    _ElevatorDoors .name ="liftdeuren";
    addChild(_ElevatorDoors );
    Oke, that works.. the doors appear on the stage.
    In this run.as i also have a function that will open these
    doors.
    _ElevatorDoors.OpenCloseDoors();
    This is a function in the ElevatorDoors class. In this class
    i have an motionTween.
    And when the tween is finished i want to initialize a
    function in the run.as
    I don't know how to do that. I know if you extend the run.as
    class you could use super. and then the function.
    But the ElevatorDoors class has been extended to the
    MovieClip.
    Does anyone has a suggestion how to do this?
    Thanks in advance.

    I have 3 classes:
    run.as (main class)
    elevatorDoors.as (extends MovieClip)
    elevator.as (extends MovieClip)
    In the run.as i added the 2 classes (elevatorDoors.as and
    elevator) with addChild..
    From the run.as i can call functions from these classes.
    But when i want to call a function from the elevatorDoors.as
    to it's main class it works.
    And in the mainclass (run.as) i call a function in the
    elevator.as class.
    Altough i can call the function trough the mainclass i can't
    set the properties of the elevator.as movieclip.
    I don't know how to set it's properties.

Maybe you are looking for