[AS 3] Function for Creating Text Fields
No commentsNothing exciting today as I am getting sidetracked with another web project. Anyways I found this nice little function for creating text fields over at Adobe. I thought I would just add it here to my Actionscript library.
private function createTextField(x:Number, y:Number, width:Number, height:Number,border:Boolean=false):TextField {
[...]
[AS 3] Loading an External .HTML File
No commentsA little snippet of code to pull in an html file and place the html content to a text field.
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.net.*;
import flash.events.*;
public class loadHTML extends Sprite
{
private var txtField:TextField;
private var HTMLData:String;
private var myHTMLFile:URLLoader;
public function loadHTML()
{
myHTMLFile = new URLLoader();
myHTMLFile.addEventListener(Event.COMPLETE, onLoadHTML, false, 0, true);
myHTMLFile.addEventListener(IOErrorEvent.IO_ERROR, ioError, false, 0, true);
myHTMLFile.load(new URLRequest(”/path/to/html/file”));
}
private function onLoadHTML(e:Event):void
{
HTMLData = e.target.data;
initTextField();
}
private function initTextField():void
{
txtField = [...]
[AS 3] CSS and Flash: Adding Styles to a Text Field
No commentsI thought it was interesting that we could add some CSS to the content in our Flash movies. Although there aren’t a lot of styles that can be applied, the basic styles are applicable. Here is a little demo of adding styles to html tags and CSS classes.
Here is the [...]
[AS 3] Text Links calling Actionscript Functions
No commentsIn this demo I have utilized the Button and the Yahoo! AlertManager component. I simply created a textfield in the upper left corner with an html anchor tag that calls a function within the Actionscript code.
Here is my Document Class file TextHTMLLinks.as:
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flash.events.TextEvent;
import com.yahoo.astra.fl.managers.AlertManager;
[...]