speechbubble.swf
Displays a floating speech bubble for NPC or contextual dialogue. Trove draws this 600 × 480 surface in the world at the speaker, aiming the bottom centre of the surface at whoever is speaking, which is why the bubble is anchored to the bottom-centre of the stage. The bubble fades in and out on demand with a short alpha tween and redraws itself procedurally to fit the current text.
Document/main class: SpeechBubble (extends MovieClip)
SWF-specific classes: 2
Main class: SpeechBubble
Owns the two IggyTween instances that handle fade-in and fade-out, and exposes setText and show as ExternalInterface callbacks for the game engine. Because it extends MovieClip rather than UIComponent, the screen registers none of the UIComponent.* callbacks — setText and show are the whole inbound list. In non-Iggy (preview) mode it self-populates with test text. After every text change or tween completion, it requests a redraw via ExternalInterface.call("RequestRedraw") / ExternalInterface.call("TweenComplete") using a deferred Event.RENDER listener so the engine can composite the frame.
Public methods
setText(param1:String, param2:uint) : void— setsbubble.textandbubble.textColor, then callsrecenterBubble()and schedules aRequestRedrawon the next render event.show(param1:Boolean) : void— starts the appropriate fade tween (in or out). Guards against re-triggering an already-playing tween or a no-op alpha state; the engine callsshowrepeatedly with the same value.
Key fields
bubble : MovieClip— the embeddedBubblesymbol instance; holds the text field and drawn shape.fadeInTween : IggyTween— tweensalphafrom0to1overTWEEN_TIME(0.2 s);motionFinishCallback→tweenComplete.fadeOutTween : IggyTween— tweensalphafrom1to0overTWEEN_TIME(0.2 s);motionFinishCallback→tweenComplete.TWEEN_TIME : Number(const0.2) — duration of both fade tweens in seconds.
Runtime dependencies & integration
IggyFunctions.inIggy— branch guard; ExternalInterface callbacks are only registered when running inside the Iggy runtime.- ExternalInterface callbacks registered:
setText,show. - ExternalInterface calls made:
RequestRedraw(after text change and after tween finishes),TweenComplete(after fade tween finishes, to signal the engine). - Events:
Event.RENDERused as a deferred one-shot hook after text/tween changes; listener is always removed after firing.
Notable logic
recenterBubble()positionsbubbleso it is horizontally centered and bottom-aligned to the stage:x = (stageWidth - bubble.bubbleContainer.width) / 2,y = stageHeight - bubble.bubbleContainer.height.show()cross-stops the opposite tween before starting the requested one, preventing simultaneous fade conflicts.
Other game-specific classes
Bubble
A self-drawing speech-bubble component extending MovieClip. Embeds symbol symbol4 from /_assets/assets.swf.
Contains bubbleContainer : MovieClip (holds the procedurally drawn shape) and textField : TextField.
Shape constants — CORNER_WIDTH 30, CORNER_HEIGHT 20, STEM_WIDTH 38, STEM_HEIGHT 34, EDGE_MIN 4, WIDTH_MIN 98, HEIGHT_MIN 40.
When text is set, recalculateSize() expands the text field to fit content (respecting minimums), chooses CENTER alignment for single-line text and LEFT for multi-line, then calls drawBubble(w, h). drawBubble clears and redraws a rounded-rectangle with a downward stem using graphics.curveTo / lineTo on a Shape added to bubbleContainer. The fill is near-opaque black (0, alpha 0.9) with a 3-px white outline.
Properties: text : String (get/set via textField.htmlText), textColor : uint (get/set via textField.textColor).
Notable logic
- The bubble shape is entirely procedural — no bitmaps.
- The file's
DefineFont3"Open Sans Semibold" has an empty glyph table (a font reference; the game supplies the glyphs), and itsImportAssets2fromSharedLibraryControllerimports no assets. The 24btn_console_*icons placed by class name inside theBubblesprite therefore resolve to nothing — dead placements besidebubbleContainerandtextField. Rounded corners are drawn withcurveTo, the stem is a triangle protruding from the bottom edge, offset to appear center-left of the bubble bottom. - Text alignment is dynamic: single-line text is centered; multi-line wraps left-aligned.
bubbleContainer.numChildren == 0guard ensuresbubbleShapeis only added once; subsequentdrawBubblecalls just clear and re-draw the sameShape.