What is more efficient

Posted on 2011-05-11
Last Modified: 2013-11-11

Can somebody tell me what is more efficient performance wise - using _global variables or referencing a variable on the root with _parent._parent all the time? Taking note that I cannot use _root as it is an embeded SWF file.

Question by:andrewkhan
    LVL 29

    Expert Comment

    Is this for ActionScript 2?
    As I know in AS3 we cannot use _root or _global variables
    Anyway I will recommend to use _global, because if you declare your values as _global you
    will able to access to values from loaded external SWF
    Usually when we are loading SWF into SWF we are using _lookroot = true;
    In this case you may not able to access to _root values
    LVL 2

    Author Comment

    Yes, unfortunately I am tied to ActionScript 2 as the system I am using relies on that. (See

    Just looked up _lockroot. If that does what I think it does it is going to be very useful and save me a lot of headaches...

    Will get back if it works.

    LVL 29

    Accepted Solution

    Nice design I like it!
    LVL 2

    Author Comment

    No, no that's not my design! ( I wish ;) ) Just the system i'm using. The magazines use flash in which you can place Flash to 'enhance' the design.
    LVL 2

    Author Comment

    I managed to solve the problem caused by optimization through the another means (turns out it wasn't my bad coding, few!)

    But this _lockroot is going to be very useful and would of solved my problem if that was the cause.

    So thanks, dgofman!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now