• 完全零基础入门——第一天


    1、 经典的Hello World

    Hello World.as

     package {
     import flash.display.Sprite;
     
     public class HelloWorld extends Sprite {
      public function NewClass(){
       trace("Hello World");
      }
     }
    }

     2、Label组件的使用

    LabelExample.as

    package {
     import fl.controls.Label;
     import flash.display.Sprite;
     import flash.text.TextFormat;
     
     public class LabelExample extends Sprite {
      public function LabelExample(){
       var label:Label = new Label();
       label.x = 100;
       label.y = 100;
       label.text = "这是Label组件。点击我,进入百度首页";
       label.wordWrap = true; //设置自动换行
       
       var textFormat:TextFormat = new TextFormat(); //实例化对象
       textFormat.size = 20;
       textFormat.color = 0xff0000;
       textFormat.url = "http://www.baidu.com";
       label.setStyle("textFormat", textFormat);
       addChild(label);
      }
     }
    }

    如果你将textFormat.url = "http://www.baidu.com"; 改成 textFormat.url = "file:///F:/软件/Adobe%20CS3.zip";这个是讲相对路径的,用来点击你的lable组件时打开F盘下软件文件夹下的Adobe%20CS3.zip文件,这个是相对个人的电脑来说的,你也可以把这个写成这样,比如打开你D盘下的某一个文件夹在点击label组件的时候,就这么写tt.url = file:///D:/**;
    注意:label组件在

    3、换行

    NewLine.as

    package {
     import fl.controls.Label;
     import flash.display.Sprite;
     import flash.text.TextField;
     import flash.text.TextFormat;
     
     public class NewLine extends Sprite {
      public function NewLine(){
       var textField:TextField = new TextField();
       textField.text = " 命名规则: 1.以字母、数字、下划线组成; 2.必须以字母或下划线开头; 3.命名区分大小写。";
       textField.width=200
       addChild(textField)
      }
     }
    }

    在NewLine.as中  “ ”  是换行  “ ”  是制表符  “ ”  是回车

  • 相关阅读:
    POJ 1673
    POJ 1375
    POJ 1654
    POJ 1039
    POJ 1066
    UVA 10159
    POJ 1410
    POJ 2653
    POJ 2398
    POJ 1556
  • 原文地址:https://www.cnblogs.com/yssgyw/p/2455128.html
Copyright © 2020-2023  润新知