in Education by
Ok, in hindsight this does seem to be a silly problem I got myself into and shouldn't have done in the first place. I have a class Debug with a function called trace inside it which puts a TextField on the stage and outputs the text. Now I am trying to get the Debug.trace() function to do a "normal" debug trace as well from within side itself. of course this causes a recursive loop. I am trying to figure out how I can access the top level separately. I tried using namespaces such as AS3::trace but to no luck. I know a solution is to rename my function to stop the conflict, but I would like that to be a last resort. So people suggesting a DIFFERENT solution would be helpful. It is being used in quite alot of places throughout my entire code so replacing it everywhere is going to be a ballache. Thank you for any "different" solutions to the one above. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Since trace() is a Top Level function and you're 'overriding' it in your Debug class I don't think it's possible to call it in another way. A possible workaround could be to create a private class beneath your public Debug class. In there you could place a static method you could call which does the actual trace() like so: public class Debug { static public function trace(value:*) : void { /* your textfield code */ DebugTrace.debugTrace(value); } } class DebugTrace { public static function debugTrace(value:*) : void { trace(value); } }

Related questions

0 votes
    I have a project i need to update form AS2 to AS3 as i need some of the new functions available ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    When a top-level function is entered, the LISP processor does? (a) It reads the function entered (b) It prints the ... (d) All of the mentioned Please answer the above question....
asked Sep 21, 2022 in Education by JackTerrance
0 votes
    What happens when we access the same variable defined in two interfaces implemented by the same class? (a) ... Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following function gives information about top level data? (a) head (b) tail (c) summary ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    In which process, a local variable has the same name as one of the instance variables? a) Serialization ... stackoverflow.com 🔗Source: Java Interview Questions and Answers...
asked Dec 19, 2020 in Technology by Editorial Staff
0 votes
    WRITE A PROGRAM TO READ DETAILS LIKE NAME, CLASS , AGE OF A STUDENT AND THEN PRINT THE DETAILS FIRSTLY IN ... THEN IN SEPERATE LINES Select the correct answer from above options...
asked Dec 30, 2021 in Education by JackTerrance
0 votes
    Which of the following is a method having same name as that of it's class? (a) finalize (b) ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of the following is a method having same name as that of its class? (a) finalize (b) delete ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    What is the process of defining two or more methods within same class that have same name but different ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    If super class and subclass have same variable name, which keyword should be used to use super class? ( ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of this access specifies can be used for a class so that its members can be accessed by a different class ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I am trying to understand Static methods in java. I have done a basic python before, so I am ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
...