I have been trying to modify this actionscript file I saw on the net which creates a button. The code in its original state works fine and displays “RSS FEED” when run. I have been trying to modify this into a package but CANNOT get the text to display. Everything else works fine with no errors. What am I doing wrong? The code is below and the FLA file is just a flash file with the “class” option in the published section set to “com.bigrich.button.bicButClass”. I am using flash CS5
THE CODE
package com.bigrich.button
{
import flash.events.Event;
import flash.geom.*
import flash.display.*
import flash.display.DisplayObject;
import flash.filters.GlowFilter;
import flash.filters.DropShadowFilter;
import flash.display.MovieClip;
import flash.geom.Matrix;
import flash.text.*;
public class bicButClass extends Sprite
{
public var radius:Number; // = 24;
public var btnW:Number;// = 200;
public var btnH:Number;// = 70;
public var labelText:TextField = new TextField();
public var web20Glow:GlowFilter = new GlowFilter(0xF7A95C, 100, 6, 6, 3, 3, true, false);
public var web20Filters:Array = [web20Glow];
public var myRssButton:MovieClip;
public var buttonText:String;
public var myRssFormat:TextFormat;
public function bicButClass()
{
myRssButton = new MovieClip();
myRssButton.buttonMode = true;
myRssButton.x = 20;
myRssButton.y = 10;
addEventListener(Event.ENTER_FRAME, backGround);
addEventListener(Event.ENTER_FRAME, backShine);
addEventListener(Event.ENTER_FRAME, backText);
addEventListener(Event.ENTER_FRAME, backIcon);
addChild(myRssButton);
}
public function backGround(e:Event):void
{
removeEventListener(Event.ENTER_FRAME, backGround);
var fillType:String = "linear";
var colors:Array = [0xF7A553, 0xCF4010];
var alphas:Array = [1, 1];
//var alphas:Array = new Array(1, 1);
btnH = 70;// 70;
btnW = 200;// 200;
radius = 24;
var ratios:Array = [0, 245];
//var matrix:Object = {matrixType:"box", x:0, y:0, w:btnW, h:btnH, r:90/180*Math.PI};
var mytrix:Matrix = new Matrix(0, 0, btnW, btnH, 90 * Math.PI / 180);
var buttonBkg:MovieClip = new MovieClip();
buttonBkg.filters = web20Filters;//I did this just now
buttonBkg.graphics.lineStyle(0, 0xE88A41, 100, true, "none", "square", "round");
buttonBkg.graphics.beginGradientFill(fillType, colors, alphas, ratios, mytrix);
buttonBkg.graphics.moveTo(radius, 0);
buttonBkg.graphics.lineTo((btnW-radius), 0);
buttonBkg.graphics.curveTo(btnW, 0, btnW, radius);
buttonBkg.graphics.lineTo(btnW, (btnH-radius));
buttonBkg.graphics.curveTo(btnW, btnH, (btnW-radius), btnH);
buttonBkg.graphics.lineTo(radius, btnH);
buttonBkg.graphics.curveTo(0, btnH, 0, (btnH-radius));
buttonBkg.graphics.lineTo(0, radius);
buttonBkg.graphics.curveTo(0, 0, radius, 0);
buttonBkg.graphics.endFill();
myRssButton.addChild(buttonBkg);
}
public function backShine(e:Event):void
{
removeEventListener(Event.ENTER_FRAME, backShine);
var shineRadius:Number = radius - 8;// 16;
var shineW = btnW - 16;
var shineH = btnH - 38;
//var shineFillType:String = "linear";
var shineFillType:String = GradientType.LINEAR;
var shineColors:Array = [0xFFFFFF, 0xF7A553];//0xFFFFFF
var shineAlphas:Array = [1.0, 0.0];
var shineRatios:Array = [0, 255];
var shinemytrix:Matrix = new Matrix()
//var shinemytrix:Matrix = new Matrix(0, 0, shineW, shineH, 90*Math.PI/180);
shinemytrix.createGradientBox(shineW, shineH, 90*Math.PI/180, 0, 0);
var shine:MovieClip = new MovieClip();
shine.x = 8;
shine.y = 3;
shine.graphics.lineStyle(0,0xFFFFFF,0,true,"normal")
shine.graphics.beginGradientFill(shineFillType, shineColors, shineAlphas, shineRatios, shinemytrix);
shine.graphics.moveTo(shineRadius, 0);
shine.graphics.lineTo((shineW-shineRadius), 0);
shine.graphics.curveTo(shineW, 0, shineW, shineRadius);
shine.graphics.lineTo(shineW, (shineH-shineRadius));
shine.graphics.curveTo(shineW, shineH, (shineW-shineRadius), shineH);
shine.graphics.lineTo(shineRadius, shineH);
shine.graphics.curveTo(0, shineH, 0, (shineH-shineRadius));
shine.graphics.lineTo(0, shineRadius);
shine.graphics.curveTo(0, 0, shineRadius, 0);
shine.graphics.endFill();
myRssButton.addChild(shine);
}
public function backText(e:Event):void
{
removeEventListener(Event.ENTER_FRAME, backText);
myRssFormat = new TextFormat();
myRssFormat.align = "left";
myRssFormat.font = "Verdana";
myRssFormat.size = 16;
myRssFormat.bold = true;
myRssFormat.color = 0xFFFFFF;
labelText.setTextFormat(myRssFormat);
labelText = new TextField();
labelText.x = 5;//65; 70;
labelText.y = 2;// 22;26;
labelText.alpha = 0.0;
labelText.textColor = 0xFF0000;
labelText.background = true;
labelText.backgroundColor = 0xFFFFFF;
labelText.width = 120;
labelText.height = 40;
labelText.text = "RSS Feeds";
labelText.embedFonts = true;
labelText.selectable = false;
labelText.antiAliasType = "advanced";
myRssButton.addChild(labelText);
}
public function backIcon(e:Event):void
{
removeEventListener(Event.ENTER_FRAME, backIcon);
var iconM:MovieClip = new MovieClip();
iconM.x = 30;// btnW - 170;
iconM.y = 23;// btnH - 47;
iconM.graphics.lineStyle(5, 0xFFFFFF, 100, true, "normal", "none");
iconM.graphics.curveTo(26, 0, 26, 26);
iconM.graphics.moveTo(0, 9)
iconM.graphics.curveTo(17, 9, 17, 26);
iconM.graphics.moveTo(5, 21)
iconM.graphics.lineStyle(7, 0xFFFFFF, 100, true, "normal", "round");
iconM.graphics.lineTo(4, 21);
myRssButton.addChild(iconM);
}
}
}