Hi all, I'm new to action scripting and have been tring to convert a fla file that was created in MX to Flash 8. I have been reading the Flash 8 Actionscript bible for help, but I just dont see what is wrong with this code. When I check the script no errors reported. Screen opens but no visible effect of the fireworks. Any help on this topic will be greatly appreiciated
frame1 code
//This action script duplicates the
//symbol instance myBeam1
//and rotates it to appear as the
//firework. It randomizes the//overall size of the firework, as
//well as the individual beam
//lengths. It also randomizes the
//color of each firework.
//Initialize variables
var i:Number = 0;
//Cf is the variable that counts the
//frame and aids in setting
//the alpha value so that the
//fireworks twinkle.
var cf:Number = 0;
//Number of beams regulates the
//fullness of each firework.
var numberOfBeams:Number = 40;
// Random sizes are set for a single
//firework on the screen
var myScale:Number = 20 + Math.random(80);
//Make the instance, myBeam1,
//visible. This is necessary because
//myBeam1 gets set to invisible
//below.
setProperty("myBeam1",_visible,true);
// A maximum random size is set for
//the next firework on the screen
var xyscalevar:Number = 20 + Math.random(80);
//Randomize the color of the next
//firework
colorArray=["FF","00","33","99","66","CC"]
myColor=new Color(myBeam1);
myColor.setRGB("0x"+colorArray[Math.random(6)]+colorArray[Math.random(6)]+colorArray[Math.random(6)]);
// The following lines create the
//firework from a single beam
// and give each beam a random length
//which does not exceed the maximum
//size
// set by the variable xyscalevar
//above
do {
myBeam1.duplicateMovieClip("beam" + i,this.getNextHighestDepth());
setProperty("beam" + i,_rotation,Math.random(360));
setProperty("beam" + i,_xscale,myScale+Math.random(myScale));
setProperty("beam" + i,_yscale,myScale+Math.random(myScale));
var i:Number = i + 1;
}
while (i <=numberOfBeams)
//Make the instance, myBeam1,
//invisible. This is necessary
//because myBeam1 was never resized
//for this particular
//firework and it would look odd if
//it were visible.
setProperty("myBeam1",_visible,false);
Frame 2 code
//This action script assigns the
//alpha value so that the
//fireworks twinkle. It counts the
//frames and assigns
//new alpha values depending on which
//frame the movie is in.
//Some beams do not twinkle at all.
//Increment the frame counter.
var cf:Number = cf+2;
//When the frame counter = 80, start
//a new firework.
if(cf>=80) {gotoAndPlay(1);}
//Set the new alphas for the twinkle.
//Don¡¯t twinkle until after
//the tenth frame.
if(cf>=10) {
setProperty("beam" +((cf/2)+1),_alpha,75);
setProperty("beam" + ((cf/2)+2),_alpha,50);
setProperty("beam" + ((cf/2)+3),_alpha,25);
setProperty("beam" + ((cf/2)+4),_alpha,0);
setProperty("beam" + ((cf/2)+5),_alpha,25);
setProperty("beam" + ((cf/2)+6),_alpha,50);
setProperty("beam" + ((cf/2)+7),_alpha,75);
setProperty("beam" + ((cf/2)+8),_alpha,100);
setProperty("beam" + ((cf/2)+9),_alpha,75);
setProperty("beam" + ((cf/2)+10),_alpha,50);
setProperty("beam" + ((cf/2)+11),_alpha,25);
setProperty("beam" + ((cf/2)+12),_alpha,0);
setProperty("beam" + ((cf/2)+13),_alpha,25);
setProperty("beam" + ((cf/2)+14),_alpha,50);
setProperty("beam" + ((cf/2)+15),_alpha,75);
setProperty("beam" + ((cf/2)+16),_alpha,100);
setProperty("beam" + ((cf/2)- 1),_alpha,75);
setProperty("beam" + ((cf/2)- 2),_alpha,50);
setProperty("beam" + ((cf/2)- 3),_alpha,25);
setProperty("beam" + ((cf/2)- 4),_alpha,0);
setProperty("beam" + ((cf/2)- 5),_alpha,25);
setProperty("beam" + ((cf/2)- 6),_alpha,50);
setProperty("beam" + ((cf/2)- 7),_alpha,75);
setProperty("beam" + ((cf/2)- 8),_alpha,100);
setProperty("beam" + ((cf/2)- 9),_alpha,75);
setProperty("beam" + ((cf/2)- 10),_alpha,50);
setProperty("beam" + ((cf/2)- 11),_alpha,25);
setProperty("beam" + ((cf/2)- 12),_alpha,0);
setProperty("beam" + ((cf/2)- 13),_alpha,25);
setProperty("beam" + ((cf/2)- 14),_alpha,50);
setProperty("beam" + ((cf/2)- 15),_alpha,75);
setProperty("beam" + ((cf/2)- 16),_alpha,100);
}
//Gradually fade the firework out in
//the last twenty frames.
//Initialize ii.
var ii:Number = 0;
if (cf>=61) {
myAlpha=100-((cf-61)*4);
do {
if(getProperty("beam"+ii,_alpha)>= myAlpha) {
setProperty("beam" + ii,_alpha,myAlpha);
}
var ii:Number = ii + 1;
}
while (ii <=numberOfBeams
)
}
Frame 3 code
gotoAndPlay(2);
frame1 code
//This action script duplicates the
//symbol instance myBeam1
//and rotates it to appear as the
//firework. It randomizes the//overall size of the firework, as
//well as the individual beam
//lengths. It also randomizes the
//color of each firework.
//Initialize variables
var i:Number = 0;
//Cf is the variable that counts the
//frame and aids in setting
//the alpha value so that the
//fireworks twinkle.
var cf:Number = 0;
//Number of beams regulates the
//fullness of each firework.
var numberOfBeams:Number = 40;
// Random sizes are set for a single
//firework on the screen
var myScale:Number = 20 + Math.random(80);
//Make the instance, myBeam1,
//visible. This is necessary because
//myBeam1 gets set to invisible
//below.
setProperty("myBeam1",_visible,true);
// A maximum random size is set for
//the next firework on the screen
var xyscalevar:Number = 20 + Math.random(80);
//Randomize the color of the next
//firework
colorArray=["FF","00","33","99","66","CC"]
myColor=new Color(myBeam1);
myColor.setRGB("0x"+colorArray[Math.random(6)]+colorArray[Math.random(6)]+colorArray[Math.random(6)]);
// The following lines create the
//firework from a single beam
// and give each beam a random length
//which does not exceed the maximum
//size
// set by the variable xyscalevar
//above
do {
myBeam1.duplicateMovieClip("beam" + i,this.getNextHighestDepth());
setProperty("beam" + i,_rotation,Math.random(360));
setProperty("beam" + i,_xscale,myScale+Math.random(myScale));
setProperty("beam" + i,_yscale,myScale+Math.random(myScale));
var i:Number = i + 1;
}
while (i <=numberOfBeams)
//Make the instance, myBeam1,
//invisible. This is necessary
//because myBeam1 was never resized
//for this particular
//firework and it would look odd if
//it were visible.
setProperty("myBeam1",_visible,false);
Frame 2 code
//This action script assigns the
//alpha value so that the
//fireworks twinkle. It counts the
//frames and assigns
//new alpha values depending on which
//frame the movie is in.
//Some beams do not twinkle at all.
//Increment the frame counter.
var cf:Number = cf+2;
//When the frame counter = 80, start
//a new firework.
if(cf>=80) {gotoAndPlay(1);}
//Set the new alphas for the twinkle.
//Don¡¯t twinkle until after
//the tenth frame.
if(cf>=10) {
setProperty("beam" +((cf/2)+1),_alpha,75);
setProperty("beam" + ((cf/2)+2),_alpha,50);
setProperty("beam" + ((cf/2)+3),_alpha,25);
setProperty("beam" + ((cf/2)+4),_alpha,0);
setProperty("beam" + ((cf/2)+5),_alpha,25);
setProperty("beam" + ((cf/2)+6),_alpha,50);
setProperty("beam" + ((cf/2)+7),_alpha,75);
setProperty("beam" + ((cf/2)+8),_alpha,100);
setProperty("beam" + ((cf/2)+9),_alpha,75);
setProperty("beam" + ((cf/2)+10),_alpha,50);
setProperty("beam" + ((cf/2)+11),_alpha,25);
setProperty("beam" + ((cf/2)+12),_alpha,0);
setProperty("beam" + ((cf/2)+13),_alpha,25);
setProperty("beam" + ((cf/2)+14),_alpha,50);
setProperty("beam" + ((cf/2)+15),_alpha,75);
setProperty("beam" + ((cf/2)+16),_alpha,100);
setProperty("beam" + ((cf/2)- 1),_alpha,75);
setProperty("beam" + ((cf/2)- 2),_alpha,50);
setProperty("beam" + ((cf/2)- 3),_alpha,25);
setProperty("beam" + ((cf/2)- 4),_alpha,0);
setProperty("beam" + ((cf/2)- 5),_alpha,25);
setProperty("beam" + ((cf/2)- 6),_alpha,50);
setProperty("beam" + ((cf/2)- 7),_alpha,75);
setProperty("beam" + ((cf/2)- 8),_alpha,100);
setProperty("beam" + ((cf/2)- 9),_alpha,75);
setProperty("beam" + ((cf/2)- 10),_alpha,50);
setProperty("beam" + ((cf/2)- 11),_alpha,25);
setProperty("beam" + ((cf/2)- 12),_alpha,0);
setProperty("beam" + ((cf/2)- 13),_alpha,25);
setProperty("beam" + ((cf/2)- 14),_alpha,50);
setProperty("beam" + ((cf/2)- 15),_alpha,75);
setProperty("beam" + ((cf/2)- 16),_alpha,100);
}
//Gradually fade the firework out in
//the last twenty frames.
//Initialize ii.
var ii:Number = 0;
if (cf>=61) {
myAlpha=100-((cf-61)*4);
do {
if(getProperty("beam"+ii,_alpha)>= myAlpha) {
setProperty("beam" + ii,_alpha,myAlpha);
}
var ii:Number = ii + 1;
}
while (ii <=numberOfBeams
)
}
Frame 3 code
gotoAndPlay(2);