recipeconsumeprompt.swf
A modal confirmation dialog shown when the player attempts to consume (learn) a recipe item. It lists one or more recipes with their icons and names, shows optional crafting requirements, and presents "Learn" and "Keep" (cancel) buttons. On console it defers setup until the playhead reaches the correct frame.
Document/main class: RecipeConsumePrompt (extends UIComponent)
SWF-specific classes: 3
Main class: RecipeConsumePrompt
RecipeConsumePrompt is the root UIComponent for the recipe-consume confirmation dialog. On construction it registers frame scripts for frames 1 and 11 (PC vs console), then either calls setup() immediately (PC) or defers it via an ENTER_FRAME listener until onTargetFrame() is true (console). setup() computes the button-row margin, hides the requirements fields, wires mouse-click listeners on the two LabelButton controls, and registers all ExternalInterface callbacks. The engine then populates the dialog by calling addRecipe() one or more times, optionally setRequirement(), and canLearn().
Public methods
setup() : *— initialises the dialog: computesresponseMargin, hides requirements fields, registers button listeners, registers all ExternalInterface callbacks, callssetupTranslation()andonSetupFinished().addRecipe(name:String, image:String, canLearn:Boolean) : *— instantiates aRecipeRowand adds it tostacklist; repositions the button row beneath the list and resizesbackgroundandself.heightto fit; callsExternalInterface.call("NOTIFY_RESIZED", w, h)after each addition.clearRecipes() : void— delegates tostacklist.clear(), resetting the list.canLearn(param1:Boolean) : void— enables or disableslearnButton.setRequirement(param1:String) : void— setsrequiresTextField.text, makes both requirements fields visible, and shiftsstacklist.ydown by the text field height.setConfirmText(param1:String) : *— overrides the learn button label.setCancelText(param1:String) : *— overrides the cancel button label.setHeader(param1:String) : *— setstitleHeader.text.hideCancel(param1:Boolean) : void— hidescancelButtonand re-centreslearnButton(andlearnControlon console) horizontally whentrue.onEnterFrame(param1:Event) : void— console-only deferred setup; removes itself and callssetup()onceonTargetFrame()is true.
Key fields
learnButton : LabelButton— "Learn" action button; default label key"$RecipeConsume_Learn"; click callsExternalInterface.call("onLearn").cancelButton : LabelButton— "Keep" / cancel button; default label key"$RecipeConsume_Keep"; click callsExternalInterface.call("onCancel").requiresPrefixTextField : TextField— static label prefix for the requirements line ($RecipeConsume_Requires, "Requires:"); hidden untilsetRequirement()is called.requiresTextField : TextField— dynamic requirement text; hidden untilsetRequirement()is called.stacklist : StackList— vertical list container that holdsRecipeRowchildren; grows downward as rows are added.background : MovieClip— background panel; itsheightis updated to match the computed dialog height after each recipe addition.titleHeader : TextField— dialog title; static default$RecipeConsume_Header("Add to your collection?"), replaced viasetHeader().learnControl : MovieClip— console controller-button hint for the learn action; repositioned alongsidelearnButton.cancelControl : MovieClip— console controller-button hint for the cancel action; repositioned alongsidecancelButton.responseMargin : uint— vertical gap between the stack list and the button row, computed from the initial layout insetup().
Frame scripts / timeline
Stage 508×600, 24 fps, 20 frames; root labels PC (frame 1) and Console (frame 11).
- frame 1 (
frame1) —stop(). PC layout frame;setup()is called directly from the constructor. - frame 11 (
frame11) —stop(). Console layout frame;setup()is deferred until this frame is reached via theENTER_FRAMElistener.
Runtime dependencies & integration
- ExternalInterface callbacks registered (in
setup()):"addRecipe"→addRecipe(name, image, canLearn)"clearRecipes"→clearRecipes()"canLearn"→canLearn(enabled)"setConfirmText"→setConfirmText(text)"setCancelText"→setCancelText(text)"setHeader"→setHeader(text)"setRequirement"→setRequirement(text)"hideCancel"→hideCancel(hide)
- ExternalInterface calls (out):
"onLearn"— emitted when the player clicks the learn button."onCancel"— emitted when the player clicks the cancel/keep button."NOTIFY_RESIZED"(width, height)— emitted after eachaddRecipe()call so the engine can resize the containing window."onSetupFinished"— emitted (console only) whensetup()completes, signalling the engine that the UI is ready for callbacks.
- Client side: the game drives this SWF from a screen class it names
CollectionConsumePrompt(its string table pairs that name withRecipeConsumePrompt.swf,onLearn,onSetupFinished,clearRecipes,setRequirement,addRecipeandcanLearn). Unlikemessagedialog.swfthere is no inbound "setup complete" call, so nothing marks the end of the engine'ssetHeader/addRecipe/canLearnburst. setupTranslation()— inherited; applies localisation to static text.IsConsole()— global function; controls constructor branching (deferred vs immediate setup, visibility oflearnControl/cancelControl).onTargetFrame()— inherited fromUIComponent; gating check in the console ENTER_FRAME loop.
Other game-specific classes
RecipeRow(extendsUIComponent, embedssymbol23) — single row in the recipe list. Constructor accepts(name:String, image:String, canLearn:Boolean); renders aSlot(icon, 46×46 px) and a word-wrappingnameTextField; greys out the name text (0x999999) whencanLearnis false; centres the slot+text group horizontally. Fixedheightof 46 px.configUI()setsslot.iconImageand matcheswidthto the parent.BtnGreen(extendsLabelButton, embedssymbol34) — green-styled label button with frame stops at frames 10, 20, 30, 40 (corresponding to the four button states: up, over, down, disabled). Used as the styled button skin in this SWF.
Asset wrappers (not individually documented)
11 bitmap asset classes — rarity_frame_common_png, rarity_frame_uncommon_png, rarity_frame_rare_png, rarity_frame_epic_png, rarity_frame_legendary_png, rarity_frame_relic_png, rarity_frame_resplendent_png, rarity_frame_shadow_png, rarity_frame_stellar, rarity_frame_radiant1_png — plus one additional _png frame class; all extend BitmapData and embed rarity-border PNG assets (77×77 px). They are used by Slot symbol rendering and carry no game logic.
Notable logic
- Dynamic height growth: each call to
addRecipe()appends aRecipeRowtostacklist, then recomputes the button-row Y asstacklist.y + stacklist.height + responseMargin, updateslearnButton.y,cancelButton.y(and console hint clips), and expandsbackground.heightandthis.height. After each resize it notifies the engine via"NOTIFY_RESIZED"so the host window can reposition the dialog on screen. - Requirements row shifting:
setRequirement()nudgesstacklist.ydown byrequiresTextField.heightafter making the requirements fields visible, ensuring the recipe list does not overlap the requirements text. This shift is permanent — there is no corresponding undo. - Console vs PC setup deferral: on console the constructor registers an
ENTER_FRAMElistener instead of callingsetup()directly, waiting foronTargetFrame()to be true before wiring callbacks. This ensures the Flash timeline has settled on the console layout frame (frame 11) before the engine starts sending data. - Centring on cancel hide:
hideCancel(true)re-centreslearnButtonusingbackground.x + (background.width - learnButton.width) / 2, accommodating variable button widths aftersetConfirmText()changes the label.