Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6884275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:29:14+00:00 2026-05-27T05:29:14+00:00

I would like to access an ActionScript 3.0 top level function from a class

  • 0

I would like to access an ActionScript 3.0 top level function from a class of mine, in which a symbol with the same name (trace) as the top level function is already defined:

class A {
  public static function trace():void {
  }
  trace("Test");
}

I would like to call the global ActionScript trace function with trace("Test"), but this is not possible as another symbol function trace() is defined.

In a case where the external definition which I would like to access would be located in a package (flash.utils or so), I could access that external definition with flash.utils.[definitionName], as I do here with ByteArray:

import flash.utils.*;
class ByteArray {
  var data:flash.utils.ByteArray;
}

Is there a similar syntactical expression in ActionScript 3.0 that would allow me to access the trace function in the first example without changing the name of my class method trace?

This is a hypothetical question, please do not consider workarounds. I need to solve the problem exactly as asked above. Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:29:15+00:00Added an answer on May 27, 2026 at 5:29 am

    trace is in the public namespace so it could be reached calling public::trace , however here the problem is that you are redefining another public trace, so you can’t call the previous one.

    What you can do is :

    1 – if your method trace have not to be public made it protected or private and then you will be able to call the original trace:

    public class Main extends Sprite 
    {
        protected function trace(...args):void {
            public::trace(args) // access to the public function trace
        }
        public function Main():void 
        {
            trace("hello world")
        }       
    }
    

    2 – if you can’t change the signature assign the original trace into a static var/const so you can use it later :

    public class Main extends Sprite 
    {
        // here save the original trace function
        private static const _trace:Function = trace
    
        public function trace(...args):void {
            _trace(args) // call the original trace
        }
        public function Main():void 
        {
            trace("hello world")
        }       
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to access a soap webservice from a class in a Flex
i would like to access an variable, which is in an class (not as
I would like to access the name field from the array items and print
Say I've got a utility class in which I would like to access the
I would like to access a class everywhere in my application, how can I
I would like to access the ActionController::Request from within the environments/development.rb file so that
I would like to access a bazaar repository and pull code from it with
I would like to access a web page from a python program. I have
I have a byte array which I would like to access by Int32 pointer
I would like to bind a variable from my ActionScript to a property of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.