Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
swf
DoInitActionTag.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3
// Free Software Foundation, Inc.
4
//
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
#ifndef GNASH_SWF_DOINITACTIONTAG_H
20
#define GNASH_SWF_DOINITACTIONTAG_H
21
22
#include "
ControlTag.h
"
// for inheritance
23
#include "
SWF.h
"
// for TagType definition
24
#include "
action_buffer.h
"
// for composition
25
#include "
MovieClip.h
"
// for inlines
26
#include "
SWFStream.h
"
// for inlines
27
28
// Forward declarations
29
namespace
gnash {
30
class
movie_definition;
31
}
32
33
namespace
gnash {
34
namespace
SWF
{
35
37
//
40
class
DoInitActionTag
:
public
ControlTag
41
{
42
public
:
43
44
DoInitActionTag
(
SWFStream
& in,
movie_definition
& md,
int
cid)
45
:
46
_buf(md),
47
_cid(cid)
48
{
49
read(in);
50
}
51
53
//
56
//
59
virtual
void
executeState
(
MovieClip
*
m
,
DisplayList
&
/*dlist*/
)
const
{
60
m->
execute_init_action_buffer
(_buf, _cid);
61
}
62
63
static
void
loader
(
SWFStream
& in,
TagType
tag,
movie_definition
&
m
,
64
const
RunResources
&
/*r*/
)
65
{
66
if
(m.
isAS3
()) {
67
IF_VERBOSE_MALFORMED_SWF
(
68
log_swferror(
"SWF contains DoInitAction tag, but is an "
69
"AS3 SWF!"
);
70
);
71
throw
ParserException
(
"DoInitAction tag found in AS3 SWF!"
);
72
}
73
74
in.
ensureBytes
(2);
75
const
boost::uint16_t cid = in.
read_u16
();
76
77
IF_VERBOSE_PARSE
(
78
log_parse(
_
(
" tag %d: do_init_action_loader"
), tag);
79
log_parse(
_
(
" -- init actions for sprite %d"
), cid);
80
);
81
82
// TODO: Currently, tags are only be executed for already parsed
83
// character ids. This is known to be wrong: a more accurate
84
// description is:
85
//
86
// The DoInitAction tag is executed only for characters on the stage
87
// or exported characters. It is only executed once.
88
//
89
// It's not known whether characters that were placed on the stage
90
// but then removed before the InitAction tag is encountered cause
91
// the actions to be executed.
92
//
93
// Gnash currently doesn't know which characters are on the stage, or
94
// which IDs have been exported.
95
boost::intrusive_ptr<ControlTag> da(
new
DoInitActionTag
(in, m, cid));
96
m.
addControlTag
(da);
// ownership transferred
97
}
98
99
private
:
100
102
//
103
void
read(
SWFStream
& in)
104
{
105
_buf.
read
(in, in.
get_tag_end_position
());
106
}
107
108
109
action_buffer
_buf;
110
111
// id of referenced DisplayObject definition
112
int
_cid;
113
};
114
115
}
// namespace gnash::SWF
116
}
// namespace gnash
117
118
119
#endif // GNASH_SWF_DOINITACTIONTAG_H
120
121
122
// Local Variables:
123
// mode: C++
124
// indent-tabs-mode: t
125
// End:
126
Generated on Mon Aug 26 2013 23:44:15 for Gnash by
1.8.4