AlphaSunny
Technical User
I have encountered another problem passing variables into Flash (mx 2004 pro).
Simply create a flash document, in the 1st frame, write the following script for gradient fill:
var H = Stage.height;
var W = Stage.width;
var gradColorA;
var gradColorB;
if (gradColorA == undefined || gradColorA == "") {
gradColorA = 0xffff00;
}
if (gradColorB == undefined || gradColorB == "") {
gradColorB = 0x0000ff;
}
colors = [gradColorA, gradColorB];
alphas = [100, 100];
ratios = [0, 255];
rotation = 90*(Math.PI/180);
matrix = {matrixType:"box", x:0, y:0, w:300, h:300, r:rotation};
beginGradientFill("linear", colors, alphas, ratios, matrix);
moveTo(0, 0);
lineTo(W, 0);
lineTo(W, H);
lineTo(0, H);
lineTo(0, 0);
endFill();
The published movie draws the gradient-colored square perfectly using the default colors for the 2 variables - gradColorA and gradColorB. However, it fails to do so when I try to pass the 2 variables by adding a line of code to the published html like this:
<param name="flashVars" value="gradColorA=0xffff00&gradColorB=0x00ffff" />
No matter what colors I assign to the variables, they always appear as black.
Anyone finds any problems here? Please advise, thank you in advance!
AlphaSunny
Simply create a flash document, in the 1st frame, write the following script for gradient fill:
var H = Stage.height;
var W = Stage.width;
var gradColorA;
var gradColorB;
if (gradColorA == undefined || gradColorA == "") {
gradColorA = 0xffff00;
}
if (gradColorB == undefined || gradColorB == "") {
gradColorB = 0x0000ff;
}
colors = [gradColorA, gradColorB];
alphas = [100, 100];
ratios = [0, 255];
rotation = 90*(Math.PI/180);
matrix = {matrixType:"box", x:0, y:0, w:300, h:300, r:rotation};
beginGradientFill("linear", colors, alphas, ratios, matrix);
moveTo(0, 0);
lineTo(W, 0);
lineTo(W, H);
lineTo(0, H);
lineTo(0, 0);
endFill();
The published movie draws the gradient-colored square perfectly using the default colors for the 2 variables - gradColorA and gradColorB. However, it fails to do so when I try to pass the 2 variables by adding a line of code to the published html like this:
<param name="flashVars" value="gradColorA=0xffff00&gradColorB=0x00ffff" />
No matter what colors I assign to the variables, they always appear as black.
Anyone finds any problems here? Please advise, thank you in advance!
AlphaSunny