• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 13. Drag-and-Drop Interactions > Providing Dynamic Feedback

Providing Dynamic Feedback

You're almost done with the drag-and-drop functionality. However, snapping into place is hardly sufficient feedback for users. In this task, you will add the Dynamic Text feedback that tells the user whether they dropped the monster in the correct target.

Select Frame 10 of the text layer in the timeline. Click in the gray area off-stage to set the focus back to the Document window, rather than the timeline.

You are preparing to create a new text area. You need to specify the frame into which you want to put it, but for the Property inspector to display the text settings, you have to change the focus back to the Document window after you've selected the correct frame.

Click the Text tool in the Tools panel. In the Property inspector, set the Text Type to Dynamic Text, the Font to Verdana, Size 12, and make the Text (fill) color a dark blue (#000099). Point the cursor below the text area in the Document window, and hold down the Shift key to drag out a text field that is four lines high and about as wide as the text area above it.

The dynamic text box you create in this step will contain the text feedback for users as they drag and drop monsters in various places.

With the new text field still selected, use the Property inspector to give it an instance name of drag_txt. The Line type should be Multiline. Render Text as HTML should be toggled on, while Selectable and Show Border Around Text should be toggled off.

These settings prepare the text field so it can be used to provide feedback.

Select Frame 10 of the actions layer, and enter the following line of script in the Actions panel, at the end of the existing code:

drag_txt.htmlText="Drag a monster to its designated post.";

This line gives the drag_txt text field a text string to display when the movie first loads. Again, it uses the htmlText property, which causes the field to render HTML tags, rather than plain text.

Test the movie to make sure the text loads.

When you test the movie, the text string should appear in the drag_txt field, in blue.

Return to the main movie, and click Frame 10 of the actions layer in the timeline. In the Actions panel, enter the following text, beneath the this._y=78; line:

_root.drag_txt.htmlText="<b>Correct</b><br>Chiron the Centaur guards the sinners immersed in the river of blood.";



This text can be found in the script_inferno_html.txt file, beneath the Chiron heading.

This line causes the drag_txt field to display a message confirming that the user dropped the chiron_mc instance on the correct target. Like the two lines above it, which snap the instance into place, this text is triggered to appear when the hitTest() expression evaluates to true.

Beneath the this._y=342; line, add the following line of code. Then test the movie to make sure it works.

_root.drag_txt.htmlText="<b>Incorrect</b><br>Please Try again!";

This line tells users that they placed the monster in an incorrect location.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint