Macromedia Flash Professional 8 UNLEASHED [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Macromedia Flash Professional 8 UNLEASHED [Electronic resources] - نسخه متنی

David Vogeleer, Eddie Wilson, Lou Barber

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Mapping to a Function


There are two basic ways of mapping to a function:

  • Using relative or absolute identifiers
    In this case, _

    root refers to the root timeline of the current level the script is run on, and _

    parent refers to the movie clip or object that contains the movie clip or object with the script. If a script using the _parent object is placed within a movie, the script looks to the movie containing itself. Also, _level

    N refers to the

    n th level in the standalone Flash player or the Flash movie.

  • Using direct movie names
    An example is myMovie.myFunction();. Notice that every movie object or movie name used in dot syntax is separated by a period.


NOTE

Although it is possible to call functions created on other timelines, it is good practice to keep all functions on the main timeline, or in an external .as file so that you will always know where to find them.

Now that you have seen some generic ways for using dot syntax to map to functions, let's look at a few examples of using them:


_root.myFunction () //invokes the function in the _root timeline
_parent.myFunction() //invokes the function in the _parent timeline
_parent._parent.myFunction() //invokes the function in the _parent of the
//_parent timeline
_root.myMovie.myFunction() //invokes the function in myMovie which is
//located on the _root timeline

As mentioned before, using dot syntax is no longer a necessity when trying to reach a function from a timeline that's different from the one it was created on because of the _global identifier.

/ 318