ARTDM 170, Week 12: Flash Text Elements

  • 262 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
262
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. ARTDM 170, Week 12: Flash Text Elements
    • Gilbert Guerrero [email_address]
    • gilbertguerrero.com/blog/artdm-170/
  • 2. Text in Flash
    • There are several ways to add text to your Flash movies
      • Using ActionScript
      • Placing text on the stage
  • 3. Text with ActionScript
    • gameScore = new TextField(); gameScore.x = 10; gameScore.y = stage.stageHeight -30; gameScore.width = 300; var myTextFormat:TextFormat = new TextFormat("Arial", 18, 0x006600, true, false, false, null, null, "left"); gameScore.defaultTextFormat = myTextFormat; gameScore.selectable = false; gameScore.multiline = true; gameScore.wordWrap = true; gameScore.autoSize = TextFieldAutoSize.LEFT; gameScore.text = "Your Score: 0”; addChild(gameScore);
  • 4. Placing text on the stage
    • Use the text tool to add text to the stage
  • 5. Placing text on the stage
    • Select dynamic text and give the text box and instance name
    • In your ActionScript refer to the instance name to update the text value
    • myScore.text = "Your Score: "+ numScore;
  • 6. Updating the score
    • 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
      • if( myBrick.hitTestObject(myBalloon) ) { removeChild(myBalloon); numScore++; myScore.text = "Your Score: "+ numScore; }
  • 7. Homework, due Nov 11
    • Work on your final projects
    • Next week: Processing