2
* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
* Zou Lunkai, zoulunkai@gmail.com
22
* Test destruction of nested movieClips.
25
* frame2: Define a nested movieclip mc1(mc1.mc11.mc111.mc111)
26
* frame3: attach the nested movieclip to stage with a name 'nestedMovieClip'
27
* frame10: nestedMovieClip get removed by one of its child(mc111)
35
.flash bbox=800x600 filename="movieclip_destruction_test3.swf" background=white version=7 fps=12
40
_root.as_order = '0+';
43
// Define 3 shapes(b1, b2, b3)
44
.box green_square fill=green width=100 height=100
50
.put green_square x=300 y=300
54
_root.as_order += '1+';
63
_root.note("nestedMovieClip removed at frame " + _root._currentframe);
65
_root.as_order += '2+';
66
_parent._parent['removeMovieClip']();
67
_root.note("actions here should not be executed");
68
_root.x = 'as_should_be_discarded';
78
_root.as_order += '3+';
89
_root.as_order += '4+';
96
_root.attachMovie("mc1", "nestedMovieClip", 10);
97
check_equals(typeof(nestedMovieClip), 'movieclip');
98
check_equals(nestedMovieClip.getDepth(), 10);
99
check_equals(typeof(nestedMovieClip.mc11), 'movieclip');
100
check_equals(typeof(nestedMovieClip.mc11.mc111), 'movieclip');
101
check_equals(typeof(nestedMovieClip.mc11.mc111.mc1111), 'movieclip');
104
#define DEFINE_ONUNLOAD
105
#ifdef DEFINE_ONUNLOAD
107
// Define onUnload(for deduction)
108
nestedMovieClip.onUnload = function () {};
109
nestedMovieClip.mc11.mc111.onUnload = function () {};
110
nestedMovieClip.mc11.mc111.mc1111.onUnload = function () {};
115
// Check 'nestedMovieClip' has unloaded but not destroyed
116
check_equals(nestedMovieClip.getDepth(), -32779);
123
check_equals(_root.x, 300);
124
check_equals(typeof(nestedMovieClip), 'undefined');
125
check_equals(_root.as_order, "0+1+2+");
131
_root.createEmptyMovieClip("mcA", 10);
133
mcA.onUnload = function () {
134
_root.check_equals(mcA['_root'], _level0);
136
mcA['removeMovieClip']();
137
_root.check_equals(mcARef.getDepth(), -32779);
138
_root.check_equals(mcARef['_root'], _level0);