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

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

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

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

David Vogeleer, Eddie Wilson, Lou Barber

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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






Removing Movie Clips


Sometimes movie clips need to be removed from the stage because they are no longer necessary, and you prefer that your computer has its virtual memory and resources back for other objects on the stage to function more efficiently.

The method to use is the removeMovieClip() method.

The removeMovieClip() Method


The removeMovieClip() method is used to remove movie clips that have been created manually or with ActionScript.

It has two basic layouts:


myMovie.removeMovieClip(); //method
removeMovieClip(myMovie); //function

Both generic uses have myMovie either as a parameter or as the object the method is being called from. Both uses, when called, accomplish the same thingremoving myMovie from the stage.

Here is an example of removing movie clips from the stage:


1.

Create a new Flash document.

2.

Draw a square somewhere on the stage.

3.

Highlight the entire square, including the stroke, and convert it to a symbol by choosing Modify, Convert to Symbol.

4.

Give it a symbol name of

squareMC and make the behavior Movie Clip.

5.

On the main stage, give the square an instance name of

square_mc .

6.

Create a new layer and give it the name of

actions .

7.

In the first frame of the Actions layer, open the Actions panel and place these actions within it:


//create an empty movie clip
this.createEmptyMovieClip("test_mc",1);
//remove the square_mc movie clip
square_mc.removeMovieClip();
//remove the test_mc movie clip
removeMovieClip(test_mc);
//see if the test_mc movie clip is still available
trace(test_mc);


The preceding code creates an empty movie clip and then removes the square_mc movie clip we created manually. After that, it removes the test_mc movie clip we created with code, and finally it uses a trace action to check to see whether the test_mc movie clip is still available.

Test the movie and you should see nothing on the stage, and the Output window should say undefined, showing there isn't a test_mc movie clip available anymore.

So far in this chapter, we have covered how to create movie clips, manipulate movie clips, and remove movie clips. The final section will cover the Drawing API for movie clips.

/ 318