Avatar of fugu
fugu

asked on 

Actionscript need dynamic gradient fill

I found this nice code for creating a gradient fill, but I want to be able to pull in an external text file or xml file so the two colors in the color variable are dynamic. Flash 8, AS2 please.

colors = [0x333366, 0x606BD2];

=======================

wSize = 740;
hSize = 206;
fillType = "linear";
colors = [0x333366, 0x606BD2];
alphas = [100, 100];
ratios = [0, 255];
matrix = {matrixType:"box", x:0, y:0, w:wSize, h:hSize, r:90/180*Math.PI};
_root.lineStyle(1,0xFFFFFF,0);
_root.beginGradientFill(fillType,colors,alphas,ratios,matrix);
_root.lineTo(wSize,0);
_root.lineTo(wSize,hSize);
_root.lineTo(0,hSize);
_root.lineTo(0,0);
_root.endFill();

Any ideas? Thanks!
Adobe Flash

Avatar of undefined
Last Comment
fugu
ASKER CERTIFIED SOLUTION
Avatar of go4ejjohn
go4ejjohn

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of fugu
fugu

ASKER

Perfect. Thanks!
Adobe Flash
Adobe Flash

Adobe Flash (formerly Macromedia Flash) is a cross-platform multimedia and software platform used to embed animations, video, and interactive applications into web pages and desktop and mobile applications and games. Flash displays text, vector and raster graphics to provide animations, video games and applications. It allows streaming of audio and video, and can capture mouse, keyboard, microphone and camera input. The ActionScript programming language allows creation of interactive animations, video games, web applications, desktop applications and mobile applications.

29K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo