Flash CS3 Documentation |
|||
| Using ActionScript 3.0 Components > Using the UI Components > Using the Label > Creating an application with the Label | |||
The following procedure explains how to add a Label component to an application while authoring. In this example, the label simply displays the text "Expiration Date".
text parameter.
var today:Date = new Date();
var expDate:Date = addDays(today, 14);
aTa.text = expDate.toDateString();
function addDays(date:Date, days:Number):Date {
return addHours(date, days*24);
}
function addHours(date:Date, hrs:Number):Date {
return addMinutes(date, hrs*60);
}
function addMinutes(date:Date, mins:Number):Date {
return addSeconds(date, mins*60);
}
function addSeconds(date:Date, secs:Number):Date {
var mSecs:Number = secs * 1000;
var sum:Number = mSecs + date.getTime();
return new Date(sum);
}
The following example creates a Label parameter using ActionScript. It uses a Label to identify the function of a ColorPicker component and it uses the htmlText property to apply formatting to the Label's text.
import fl.controls.Label; import fl.controls.ColorPicker; var aLabel:Label = new Label(); var aCp:ColorPicker = new ColorPicker(); addChild(aLabel); addChild(aCp); aLabel.htmlText = '<font face="Arial" color="#FF0000" size="14">Fill:</font>'; aLabel.x = 200; aLabel.y = 150; aLabel.width = 25; aLabel.height = 22; aCp.x = 230; aCp.y = 150;
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000443.html