Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ARTDM 170, Week 12: Flash Text Elements


Published on

  • Be the first to comment

  • Be the first to like this

ARTDM 170, Week 12: Flash Text Elements

  1. 1. ARTDM 170, Week 12: Flash Text Elements <ul><li>Gilbert Guerrero [email_address] </li></ul><ul><li> </li></ul>
  2. 2. Text in Flash <ul><li>There are several ways to add text to your Flash movies </li></ul><ul><ul><li>Using ActionScript </li></ul></ul><ul><ul><li>Placing text on the stage </li></ul></ul>
  3. 3. Text with ActionScript <ul><li>gameScore = new TextField(); gameScore.x = 10; gameScore.y = stage.stageHeight -30; gameScore.width = 300; var myTextFormat:TextFormat = new TextFormat(&quot;Arial&quot;, 18, 0x006600, true, false, false, null, null, &quot;left&quot;); gameScore.defaultTextFormat = myTextFormat; gameScore.selectable = false; gameScore.multiline = true; gameScore.wordWrap = true; gameScore.autoSize = TextFieldAutoSize.LEFT; gameScore.text = &quot;Your Score: 0”; addChild(gameScore); </li></ul>
  4. 4. Placing text on the stage <ul><li>Use the text tool to add text to the stage </li></ul>
  5. 5. Placing text on the stage <ul><li>Select dynamic text and give the text box and instance name </li></ul><ul><li>In your ActionScript refer to the instance name to update the text value </li></ul><ul><li>myScore.text = &quot;Your Score: &quot;+ numScore; </li></ul>
  6. 6. Updating the score <ul><li>In our jumping brick game, each time a collision is detected with the myBalloon object, we can update the score and pop (remove) the balloon </li></ul><ul><ul><li>if( myBrick.hitTestObject(myBalloon) ) { removeChild(myBalloon); numScore++; myScore.text = &quot;Your Score: &quot;+ numScore; } </li></ul></ul>
  7. 7. Homework, due Nov 11 <ul><li>Work on your final projects </li></ul><ul><li>Next week: Processing </li></ul>