cleanup a few warnings.
[gnash.git] / libcore / MovieClip.h
blob076761f3645e05e811732c4607903502edeb59ce
1 // MovieClip.h: Stateful live Sprite instance, for Gnash.
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
4 // Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 // Stateful live Sprite instance
22 #ifndef GNASH_MOVIECLIP_H
23 #define GNASH_MOVIECLIP_H
25 #ifdef HAVE_CONFIG_H
26 #include "gnashconfig.h" // GNASH_USE_GC, USE_SWFTREE
27 #endif
29 #include "ControlTag.h"
30 #include "movie_definition.h" // for inlines
31 #include "DisplayList.h" // DisplayList
32 #include "DisplayObjectContainer.h"
33 #include "as_environment.h" // for composition
34 #include "DynamicShape.h" // for composition
35 #include "snappingrange.h"
36 #include "dsodefs.h" // for DSOEXPORT
38 #include <boost/intrusive_ptr.hpp>
39 #include <vector>
40 #include <list>
41 #include <map>
42 #include <string>
44 // Forward declarations
45 namespace gnash {
46 class Movie;
47 class swf_event;
48 class drag_state;
49 class LoadVariablesThread;
50 class gradient_record;
51 class TextField;
52 class BitmapData_as;
53 class BitmapInfo;
54 class GnashImage;
55 namespace SWF {
56 class PlaceObject2Tag;
60 namespace gnash
63 /// A MovieClip is a container for DisplayObjects.
65 /// TODO: This class should inherit from Sprite
67 /// In AS3 is it distinguished from a Sprite by having a timeline, i.e.
68 /// more than one frame. In AS2, there is no Sprite class.
70 /// There are basically two types of MovieClip: dynamic and non-dynamic.
71 /// Dynamic clips are created using createEmptyMovieClip() or
72 /// duplicateMovieClip(). Non-dynamic MovieClips are parsed from a SWF file.
73 /// The isDynamic() member function is the only way to tell the difference
74 /// (see following paragraph).
76 /// The presence of a definition (the _def member) reveals whether the
77 /// MovieClip was constructed with an immutable definition or not. MovieClips
78 /// created using createEmptyMovieClip() have no definition. MovieClips
79 /// constructed using duplicateMovieClip() have the same definition as the
80 /// duplicated clip. They are "dynamic", but may have a definition!
82 /// A MovieClip always has an _swf member. This is the top-level SWF
83 /// (Movie) containing either the definition or the code from
84 /// which the MovieClip was created. The _url member and SWF version are
85 /// dependent on the _swf. Exports are also sought in this Movie.
86 class MovieClip : public DisplayObjectContainer
89 public:
91 typedef std::map<std::string, std::string> MovieVariables;
93 typedef std::list<const action_buffer*> ActionList;
95 typedef movie_definition::PlayList PlayList;
97 enum PlayState
99 PLAYSTATE_PLAY,
100 PLAYSTATE_STOP
103 /// Construct a MovieClip instance
105 /// @param def
106 /// Pointer to the movie_definition this object is an
107 /// instance of (may be a top-level movie or a sprite).
108 /// This may be 0 if there is no immutable definition.
110 /// @param root
111 /// The "relative" _swf of this sprite, which is the
112 /// instance of top-level sprite defined by the same
113 /// SWF that also contained *this* sprite definition.
114 /// Note that this can be *different* from the top-level
115 /// movie accessible through the VM, in case this sprite
116 /// was defined in an externally loaded movie.
118 /// @param parent
119 /// Parent of the created instance in the display list.
120 /// May be 0 for top-level movies (_level#).
121 MovieClip(as_object* object, const movie_definition* def,
122 Movie* root, DisplayObject* parent);
124 virtual ~MovieClip();
126 // Return the originating SWF
127 virtual Movie* get_root() const;
129 virtual bool trackAsMenu();
131 /// Return the _root ActionScript property of this sprite.
133 /// Relative or absolute is determined by the _lockroot property,
134 /// see getLockRoot and setLockRoot. May return this.
135 virtual MovieClip* getAsRoot();
137 /// Get the composite bounds of all component drawing elements
138 virtual SWFRect getBounds() const;
140 // See dox in DisplayObject.h
141 virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const;
143 // See dox in DisplayObject.h
144 virtual bool pointInVisibleShape(boost::int32_t x, boost::int32_t y) const;
146 /// return true if the given point is located in a(this) hitable sprite.
148 /// all sprites except mouse-insensitive dynamic masks are hitable.
149 /// _visible property is ignored for hitable DisplayObjects.
150 virtual bool pointInHitableShape(boost::int32_t x, boost::int32_t y) const;
152 /// Return 0-based index to current frame
153 size_t get_current_frame() const
155 return _currentFrame;
158 size_t get_frame_count() const
160 return _def ? _def->get_frame_count() : 1;
163 /// Return number of completely loaded frames of this sprite/movie
165 /// Note: the number is also the last frame accessible (frames
166 /// numberes are 1-based)
168 size_t get_loaded_frames() const
170 return _def ? _def->get_loading_frame() : 1;
173 /// Return total number of bytes in the movie
174 /// (not sprite!)
175 size_t get_bytes_total() const
177 return isDynamic() ? 0 : _def->get_bytes_total();
180 /// Return number of loaded bytes in the movie
181 /// (not sprite!)
182 size_t get_bytes_loaded() const
184 return isDynamic() ? 0 : _def->get_bytes_loaded();
187 const SWFRect& get_frame_size() const
189 static const SWFRect r;
190 return _def ? _def->get_frame_size() : r;
193 /// Stop or play the sprite.
195 /// If stopped, any stream sound associated with this sprite
196 /// will also be stopped.
198 DSOEXPORT void setPlayState(PlayState s);
200 PlayState getPlayState() const { return _playState; }
202 // delegates to movie_root (possibly wrong)
203 void set_background_color(const rgba& color);
205 /// Return true if we have any mouse event handlers.
207 /// NOTE: this function currently does not consider
208 /// general mouse event handlers MOUSE_MOVE, MOUSE
209 virtual bool mouseEnabled() const;
211 /// \brief
212 /// Return the topmost entity that the given point
213 /// covers that can receive mouse events. NULL if
214 /// none. Coords are in parent's frame.
215 virtual InteractiveObject* topmostMouseEntity(boost::int32_t x,
216 boost::int32_t y);
218 // see dox in DisplayObject.h
219 const DisplayObject* findDropTarget(boost::int32_t x, boost::int32_t y,
220 DisplayObject* dragging) const;
222 void setDropTarget(const std::string& tgt)
224 _droptarget = tgt;
227 const std::string& getDropTarget() const
229 return _droptarget;
232 /// Advance to the next frame of the MovieClip.
234 /// Actions will be executed or pushed to the queue as necessary.
235 virtual void advance();
237 /// Set the sprite state at the specified frame number.
239 /// 0-based frame numbers!!
240 ///(in contrast to ActionScript and Flash MX)
242 DSOEXPORT void goto_frame(size_t target_frame_number);
244 /// Parse frame spec and return a 0-based frame number.
246 /// If frame spec cannot be converted to !NAN and !Infinity number
247 /// it will be converted to a string and considered a
248 /// frame label (returns false if referring to an
249 /// unknwown label).
251 /// @param frame_spec
252 /// The frame specification.
254 /// @param frameno
255 /// The evaluated frame number (0-based)
257 /// @return
258 /// True if the frame_spec could be resolved to a frame number.
259 /// False if the frame_spec was invalid.
260 bool get_frame_number(const as_value& frame_spec, size_t& frameno) const;
262 /// Look up the labeled frame, and jump to it.
263 bool goto_labeled_frame(const std::string& label);
265 /// Display (render?) this Sprite/MovieClip, unless invisible
266 void display(Renderer& renderer);
268 void omit_display();
270 /// Swap depth of the given DisplayObjects in the DisplayList
272 /// See DisplayList::swapDepths for more info
273 void swapDepths(DisplayObject* ch1, int newdepth)
275 _displayList.swapDepths(ch1, newdepth);
278 /// Return the DisplayObject at given depth in our DisplayList.
280 /// @return NULL if the specified depth is available (no chars there)
281 DisplayObject* getDisplayObjectAtDepth(int depth);
283 /// Attach a DisplayObject at the specified depth.
284 DisplayObject* addDisplayListObject(DisplayObject* obj, int depth);
286 /// Place a DisplayObject or mask to the DisplayList.
288 /// This method instantiates the given DisplayObject definition
289 /// and places it on the stage at the given depth.
291 /// If the specified depth is already occupied, it results a no-ops.
292 /// Otherwise, a new DisplayObject will be created and onload handler
293 /// will be triggerred.
295 /// @param tag
296 /// A swf defined placement tag (PlaceObject, or PlaceObject2,
297 /// or PlaceObject3).
298 /// No ownership transfer, the tag is still owned by the
299 /// movie_definition class.
301 /// @param dlist
302 /// The display list to add the DisplayObject to.
304 /// @return
305 /// A pointer to the DisplayObject being added or NULL
306 DisplayObject* add_display_object(const SWF::PlaceObject2Tag* tag,
307 DisplayList& dlist);
309 /// Proxy of DisplayList::moveDisplayObject()
310 void move_display_object(const SWF::PlaceObject2Tag* tag,
311 DisplayList& dlist);
313 /// Proxy of DisplayList::replaceDisplayObject()
314 void replace_display_object(const SWF::PlaceObject2Tag* tag,
315 DisplayList& dlist);
317 /// Proxy of DisplayList::removeDisplayObject()
318 void remove_display_object(const SWF::PlaceObject2Tag* tag,
319 DisplayList& dlist);
321 /// \brief
322 /// Remove the object at the specified depth.
324 /// NOTE:
325 /// (1)the id parameter is currently unused, but
326 /// required to avoid breaking of inheritance from movie.h.
327 /// (2)the id might be used for specifying a DisplayObject
328 /// in the depth(think about multiple DisplayObjects within the same
329 /// depth, not tested and a rare case)
330 void remove_display_object(int depth, int /*id*/);
332 void unloadMovie();
334 /// Attach the given DisplayObject instance to current display list
336 /// @param newch
337 /// The DisplayObject instance to attach.
339 /// @param depth
340 /// The depth to assign to the instance.
342 /// @return true on success, false on failure
343 /// FIXME: currently never returns false !
344 bool attachCharacter(DisplayObject& newch, int depth, as_object* initObject);
346 /// Handle placement event
348 /// This callback will (not known to be a problem):
350 /// (1) Register ourselves with the global instance list
351 /// (2) Take note of our original target path
352 /// (3) Register as listener of core broadcasters
353 /// (4) Execute tags of frame 0
355 /// The callback will also (known to be bogus):
357 /// (1) Construct this instance as an ActionScript object.
358 /// See constructAsScriptObject() method, including constructing
359 /// registered class and adding properties.
360 virtual void construct(as_object* initObj = 0);
362 /// Mark this sprite as destroyed
364 /// This is an override of DisplayObject::destroy()
366 /// A sprite should be destroyed when is removed from the display
367 /// list and is not more needed for names (target) resolutions.
368 /// Sprites are needed for names resolution whenever themselves
369 /// or a contained object has an onUnload event handler defined,
370 /// in which case we want the event handler to find the 'this'
371 /// variable w/out attempting to rebind it.
373 /// When a sprite is destroyed, all its children are also destroyed.
374 ///
375 /// Note: this function will release most memory associated with
376 /// the sprite as no members or drawable should be needed anymore.
377 void destroy();
379 /// Add the given action buffer to the list of action
380 /// buffers to be processed at the end of the next
381 /// frame advance.
382 void add_action_buffer(const action_buffer* a)
384 if (!_callingFrameActions) queueAction(*a);
385 else execute_action(*a);
389 /// \brief
390 /// Execute the given init action buffer, if not done yet
391 /// for the target DisplayObject id.
393 /// The action will normally be pushed on queue, but will
394 /// be executed immediately if we are executing actions
395 /// resulting from a callFame instead.
397 /// @param a
398 /// The action buffer to execute
400 /// @param cid
401 /// The referenced DisplayObject id
402 void execute_init_action_buffer(const action_buffer& a, int cid);
404 /// Execute a single action buffer (DOACTION block)
405 void execute_action(const action_buffer& ab);
407 MovieClip* to_movie () { return this; }
409 /// The various methods for sending data in requests.
411 /// Used in loadMovie, getURL, loadVariables etc.
412 enum VariablesMethod
414 METHOD_NONE = 0,
415 METHOD_GET,
416 METHOD_POST
419 // See dox in DisplayObject.h
420 virtual void getLoadedMovie(Movie* newMovie);
422 /// \brief
423 /// Load url-encoded variables from the given url, optionally
424 /// sending variables from this timeline too.
426 /// A LoadVariablesThread will be started to load and parse variables
427 /// and added to the _loadVariableRequests. Then, at every ::advance_sprite
428 /// any completed threads will be processed
429 /// (see processCompletedLoadVariableRequests)
431 /// NOTE: the given url will be security-checked
433 /// @param urlstr: The url to load variables from.
435 /// @param sendVarsMethod: The VariablesMethod to use. If METHOD_NONE,
436 /// no data will be sent.
437 void loadVariables(const std::string& urlstr,
438 VariablesMethod sendVarsMethod);
440 /// Get TextField variables
442 /// TODO: this is unlikely to be the best way of doing it, and it would
443 /// simplify things if this function could be dropped.
444 bool getTextFieldVariables(const ObjectURI& uri, as_value& val);
446 // Set TextField variables
448 /// TODO: this is also unlikely to be the best way to do it.
449 bool setTextFieldVariables(const ObjectURI& uri, const as_value& val);
451 /// Search for a named object on the DisplayList
453 /// These are properties, but not attached as genuine members to the
454 /// MovieClip object. They take priority over DisplayObject magic
455 /// properties and inherited properties, but not over own properties.
457 /// @param name The name of the object. This function handles
458 /// case-sensitivity.
459 /// @return The object if found, otherwise 0.
460 DisplayObject* getDisplayListObject(string_table::key name);
462 /// Overridden to look in DisplayList for a match
463 as_object* pathElement(string_table::key key);
465 /// Execute the actions for the specified frame.
467 /// The frame_spec could be an integer or a string.
468 virtual void call_frame_actions(const as_value& frame_spec);
470 // delegates to movie_root
471 virtual void stop_drag();
473 /// Duplicate this sprite in its timeline
475 /// Add the new DisplayObject at a the given depth to this sprite
476 /// parent displaylist.
478 /// NOTE: the call will fail for the root movie (no parent).
479 /// NOTE2: any DisplayObject at the given target depth will be
480 /// replaced by the new DisplayObject
481 /// NOTE3: event handlers will also be copied
483 /// @param newname
484 /// Name for the copy
486 /// @param newdepth
487 /// Depth for the copy
489 /// @param init_object
490 /// If not null, will be used to copy properties over.
491 MovieClip* duplicateMovieClip(const std::string& newname,
492 int newdepth, as_object* init_object=NULL);
494 /// Dispatch event handler(s), if any.
495 virtual void notifyEvent(const event_id& id);
497 // inherited from DisplayObject class, see dox in DisplayObject.h
498 as_environment& get_environment() {
499 return _environment;
502 /// \brief
503 /// Set a TextField variable to this timeline
505 /// A TextField variable is a variable that acts
506 /// as a setter/getter for a TextField 'text' member.
507 void set_textfield_variable(const std::string& name, TextField* ch);
509 void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
511 const DisplayList& getDisplayList() const {
512 return _displayList;
515 /// Return the next highest available depth
517 /// Placing an object at the depth returned by
518 /// this function should result in a DisplayObject
519 /// that is displayd above all others
520 int getNextHighestDepth() const {
521 return _displayList.getNextHighestDepth();
524 /// Set the currently playing m_sound_stream_id
526 // TODO: rename to setStreamingSoundId
527 void setStreamSoundId(int id);
529 /// Remove this sprite from the stage.
531 /// This function is intended to be called by
532 /// effect of a removeMovieClip() ActionScript call
533 /// and implements the checks required for this specific
534 /// case.
536 /// Callers are:
537 /// - The ActionRemoveClip tag handler.
538 /// - The global removeMovieClip(target) function.
539 /// - The MovieClip.removeMovieClip() method.
541 /// The removal will not occur if the depth of this
542 /// DisplayObjects is not in the "dynamic" range [0..1048575]
543 /// as described at the following URL:
544 ///
545 /// http://www.senocular.com/flash/tutorials/depths/?page=2
547 /// A testcases for this behaviour can be found in
549 /// testsuite/misc-ming.all/displaylist_depths_test.swf
550 void removeMovieClip();
552 /// Render this MovieClip to a GnashImage using the passed transform
554 /// @return The GnashImage with the MovieClip drawn onto it.
555 virtual std::auto_ptr<GnashImage> drawToBitmap(
556 const SWFMatrix& mat = SWFMatrix(),
557 const cxform& cx = cxform(),
558 DisplayObject::BlendMode bm = DisplayObject::BLENDMODE_NORMAL,
559 const SWFRect& clipRect = SWFRect(),
560 bool smooth = false);
562 /// @name Drawing API
563 /// @{
565 void lineStyle(boost::uint16_t thickness, const rgba& color,
566 bool vScale=true, bool hScale=true,
567 bool pixelHinting=false,
568 bool noClose=false,
569 CapStyle startCapStyle=CAP_ROUND,
570 CapStyle endCapStyle=CAP_ROUND,
571 JoinStyle joinStyle=JOIN_ROUND,
572 float miterLimitFactor=1.0f)
574 _drawable.lineStyle(thickness, color, vScale, hScale,
575 pixelHinting, noClose,
576 startCapStyle, endCapStyle, joinStyle,
577 miterLimitFactor);
580 void resetLineStyle()
582 _drawable.resetLineStyle();
585 void beginFill(const rgba& color)
587 _drawable.beginFill(color);
590 void beginLinearGradientFill(const std::vector<gradient_record>& grad,
591 const SWFMatrix& mat)
593 _drawable.beginLinearGradientFill(grad, mat);
596 void beginRadialGradientFill(const std::vector<gradient_record>& grad,
597 const SWFMatrix& mat)
599 _drawable.beginRadialGradientFill(grad, mat);
602 void endFill()
604 _drawable.endFill();
607 void moveTo(boost::int32_t x, boost::int32_t y)
609 _drawable.moveTo(x, y);
612 void lineTo(boost::int32_t x, boost::int32_t y)
614 set_invalidated();
615 _drawable.lineTo(x, y, getDefinitionVersion());
618 void curveTo(boost::int32_t cx, boost::int32_t cy,
619 boost::int32_t ax, boost::int32_t ay)
621 set_invalidated();
622 _drawable.curveTo(cx, cy, ax, ay, getDefinitionVersion());
625 void clear()
627 set_invalidated();
628 _drawable.clear();
631 /// Set focus to this MovieClip
633 /// @return true if this MovieClip can receive focus.
634 virtual bool handleFocus();
636 /// @} Drawing API
638 /// Set all variables in the given map with their corresponding values
639 DSOEXPORT void setVariables(const MovieVariables& vars);
641 /// Enumerate child DisplayObjects
643 /// See as_object::enumerateNonProperties(as_environment&) for more info.
645 virtual void enumerateNonProperties(as_environment&) const;
647 /// Delete DisplayObjects removed from the stage
648 /// from the display lists
649 void cleanupDisplayList();
651 /// Queue the given action buffer
653 /// The action will be pushed on the current
654 /// global list (see movie_root).
656 void queueAction(const action_buffer& buf);
658 /// Construct this instance as an ActionScript object
660 /// This method invokes the constructor associated with our
661 /// definition, either MovieClip or any user-speficied one
662 /// (see sprite_definition::registerClass).
663 /// It will also invoke the onClipConstruct and onConstruct handlers.
664 void constructAsScriptObject();
666 /// Return true if getAsRoot() should return the *relative* root,
667 /// false otherwise.
668 bool getLockRoot() const { return _lockroot; }
670 /// Set whether getAsRoot() should return the *relative* root,
671 /// false otherwise. True for relative root.
672 void setLockRoot(bool lr) { _lockroot=lr; }
674 /// Return the version of the SWF this MovieClip was parsed from.
675 virtual int getDefinitionVersion() const;
677 protected:
679 /// Unload all contents in the displaylist and this instance
681 /// Return true if there was an unloadHandler.
682 virtual bool unloadChildren();
684 /// Mark sprite-specific reachable resources.
686 /// sprite-specific reachable resources are:
687 /// - DisplayList items (current, backup and frame0 ones)
688 /// - Canvas for dynamic drawing (_drawable)
689 /// - sprite environment
690 /// - definition the sprite has been instantiated from
691 /// - Textfields having an associated variable registered in this instance.
692 /// - Relative root of this instance (_swf)
694 virtual void markOwnResources() const;
696 // Used by BitmapMovie.
697 void placeDisplayObject(DisplayObject* ch, int depth) {
698 _displayList.placeDisplayObject(ch, depth);
701 private:
703 typedef std::vector<TextField*> TextFields;
705 /// A container for textfields, indexed by their variable name
706 typedef std::map<std::string, TextFields> TextFieldIndex;
708 /// Process any completed loadVariables request
709 void processCompletedLoadVariableRequests();
711 /// Process a completed loadVariables request
712 void processCompletedLoadVariableRequest(LoadVariablesThread& request);
715 /// Execute the tags associated with the specified frame.
717 /// @param frame
718 /// Frame number. 0-based
720 /// @param dlist
721 /// The display list to have control tags act upon.
723 /// @param typeflags
724 /// Which kind of control tags we want to execute.
725 void executeFrameTags(size_t frame, DisplayList& dlist,
726 int typeflags = SWF::ControlTag::TAG_DLIST |
727 SWF::ControlTag::TAG_ACTION);
729 void stopStreamSound();
731 /// Return value of the 'enabled' property cast to a boolean value.
733 /// This is true if not found (undefined to bool evaluates to false).
735 /// When a MovieClip is "disabled", its handlers of button-like events
736 /// are disabled, and automatic tab ordering won't include it.
737 bool isEnabled() const;
739 /// Check whether a point hits our drawable shape.
741 /// This is possible because the drawable does not have its own
742 /// transform, so we can use our own. The points are expressed in
743 /// world space.
744 bool hitTestDrawable(boost::int32_t x, boost::int32_t y) const;
746 /// Advance to a previous frame.
748 /// This function will basically restore the DisplayList as it supposedly
749 /// was *before* executing tags in target frame and then execute target
750 /// frame tags (both DLIST and ACTION ones).
752 /// In practice, it will:
754 /// - Remove from current DisplayList:
755 /// - Timeline instances constructed after target frame
756 /// - Timeline instances constructed before or at the target frame but no
757 /// more at the original depth
758 /// - Dynamic instances found in the static depth zone
759 /// - Execute all displaylist tags from first to one-before target frame,
760 /// appropriately setting _currentFrame as it goes, finally execute
761 /// both displaylist and action
762 /// tags for target frame.
764 /// Callers of this methods are:
765 /// - goto_frame (for jump-backs)
766 /// - advance_sprite (for loop-back)
768 /// See:
769 // http://www.gnashdev.org/wiki/index.php/TimelineControl
770 /// #Timeline_instances
772 /// @param targetFrame
773 /// The target frame for which we're willing to restore the static
774 /// DisplayList.
775 /// 0-based.
777 /// POSTCONDITIONS:
779 /// - _currentFrame == targetFrame
781 /// TODO: consider using this same function for jump-forward too,
782 /// with some modifications...
784 void restoreDisplayList(size_t targetFrame);
786 /// Queue actions in the action list
788 /// The list of action will be pushed on the current
789 /// global list (see movie_root).
791 void queueActions(ActionList& action_list);
793 /// Execute the actions in the action list
795 /// The list of action will be consumed starting from the first
796 /// element. When the function returns the list should be empty.
798 void execute_actions(ActionList& action_list);
800 /// Increment _currentFrame, and take care of looping.
801 void increment_frame_and_check_for_loop();
803 /// \brief
804 /// Returns a vector of TextField associated with the given variable name,
805 /// or NULL if no such variable name is known.
807 /// A TextField variable is a variable that acts
808 /// as a setter/getter for a TextField 'text' member.
810 /// Search is case-sensitive.
812 /// @todo find out wheter we should be case sensitive or not
814 /// @return a pointer inside a vector, will be invalidated by modifications
815 /// of the vector (set_textfield_variable)
817 TextFields* get_textfield_variable(const std::string& name);
819 /// Unregister textfield variables bound to unloaded TextFields
820 void cleanup_textfield_variables();
822 /// This is either sprite_definition (for sprites defined by
823 /// DefineSprite tag) or movie_def_impl (for the top-level movie).
824 const boost::intrusive_ptr<const movie_definition> _def;
826 /// List of loadVariables requests
827 typedef std::list<LoadVariablesThread*> LoadVariablesThreads;
829 /// List of active loadVariable requests
831 /// At ::advance_sprite time, all completed requests will
832 /// be processed (variables imported in this timeline scope)
833 /// and removed from the list.
834 LoadVariablesThreads _loadVariableRequests;
836 /// The SWF that this MovieClip belongs to.
837 Movie* _swf;
839 /// The canvas for dynamic drawing
840 DynamicShape _drawable;
842 PlayState _playState;
844 /// This timeline's variable scope
845 as_environment _environment;
847 /// We'll only allocate Textfield variables map if
848 /// we need them (ie: anyone calls set_textfield_variable)
850 std::auto_ptr<TextFieldIndex> _text_variables;
852 std::string _droptarget;
854 // 0-based index to current frame
855 size_t _currentFrame;
857 /// soundid for current playing stream. If no stream set to -1
858 int m_sound_stream_id;
860 // true if this sprite reached the last frame and restarted
861 bool _hasLooped;
863 // true is we're calling frame actions
864 bool _callingFrameActions;
866 bool _lockroot;
869 } // end of namespace gnash
871 #endif // GNASH_SPRITE_INSTANCE_H