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

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

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

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

David Vogeleer, Eddie Wilson, Lou Barber

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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






Chapter 14. Events


IN THIS CHAPTER


Back in Chapter 8, "Welcome to ActionScript 2.0," we went over the three basic elements that all objects in Flash have:

  • Properties .
    Information about an object, held within the object.

  • Methods .
    These are the "verbs" of objects; they are what the object does.

  • Events .
    Events tell Flash when something has occurred with that object.


For instance, with a movie clip, here are the three elements:

  • Property .
    _x

  • Method .
    gotoAndPlay(2)

  • Event .
    onEnterFrame


This chapter goes into more detail about the third thing that objects have, events.

An event, simply put, is when something happens. Every day you go through several hundred events. Every time you get email, that is an event. When you eat lunch, that's another event. And when you go home on Friday, you know that's an event.

So you see, events happen all the time in almost everything we do. So what's the big deal with events? Well, events in Flash are used to tell us when something occurs so that we can run a certain block of actions or go to a certain frame in the movie. To put it in real-world terms, sometimes people want to be notified when a certain event happens. For instance:

  • "Let me know when she calls."

  • "Let me know when lunch is here."

  • "Let me know when the next meeting is."


These are just a few events that people want to be notified about in everyday life. When these events occur, the individual who is notified will do something about it. For instance, if someone is notified when lunch arrives, that person will probably want to eat it. This is what that event would look like in ActionScript:


onLunchArrival = function(){
eatLunch();
}

That looks simple enough, and it is. In Flash, you have events, which we will cover in detail throughout this chapter, that you might want your movie or application to listen for so that it will know when to execute a block of code. But before we cover some of the events of different objects, it's important to know how to handle these events in Flash when they occur.


/ 318