difference between _root and _level

Answer Posted / kunal

Differences between _root and _level0

At first glance it may seem that _root and _level0 refer to
the same thing. However, they are not identical.

The property _root refers to the main timeline of the movie
from which the property was referenced, or the top-most
timeline within the current hierarchy of timelines. If an
instance of the Flash Player has multiple levels, the main
or root timeline is on the level containing the currently
executing script.

The property _level0 references the main timeline of the
movie loaded into level 0. This property can be referenced
from any level and still reference the same timeline, that
on level 0.

When a SWF file is loaded into the Flash player, it's main
timeline is loaded into level 0. In this movie and this
movie only will _root and _level0 reference the same
timeline. Additional SWF files can be loaded into
additional levels using loadMovie or loadMovieNum.
References of _root in those files then reference the level
in which that SWF referencing _root was loaded. For
example, if a SWF is loaded into level 2, a reference to
_root in that SWF will reference the same timeline that
_level2 references, but will not reference the same
timeline as _level0. A reference to _root will only equal
_level0 in the SWF that was first loaded into the player
(level 0).

If you are working with levels in ActionScript, you should
always use _root to reference the main timeline in your
movies. Using _level0 may incorrectly reference the main
timeline of another SWF, the first movie loaded into the
player.

Note: ActionScript 3 no longer uses the concept of levels.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the steps is not required in order to test or deploy flash remoting? : Adobe flash

481


Can you explain what does the void function and object contain in actionscript?

475


what is the key purpose of using layers in a timeline? : Adobe flash

445


you have a dynamically loaded image that is larger than your stage. Which component would work best to accommodate this image? : Adobe flash

451


How to change background color and stage size?

493






Do you know what is the difference between an array and vector?

444


what is the key advantage of using loadvars instead of loadvariables? : Adobe flash

488


Explain what are the data types supported by actionscript?

484


Tell me what is the main purpose of actionscript?

471


which of the assumptions cannot be made when developing an application for intranet deployment? : Adobe flash

443


Explain what are the changes presented by actionscript?

446


in general, non-mp3 digital audio destined to be imported into the flash mx authoring environment should first be compressed how much? : Adobe flash

461


How to make synchronous data calls in actionscript?

455


What does the void function and object contain in actionscript?

480


which of the following is not a key benefit of usability testing? : Adobe flash

510