Okay, I have some flash A.S. code that I downloaded from Jim Bumgardners site. here is a link to the page with the sample .swf and download.
http://krazydad.com/bestiary/bestiary_clouds.html
I am trying to attach another movie clip (graphic) in the forground of the clouds and can’t seem to get the code right. When I call the movie clip it doesn’t show up. I am not sure how to layer the attachMovie function. I have removed my efforts form the original source below.
Can someone help me understand what I am not geting?
- And know a good place for me to start learning actionscript, I am considering paying an annual fee to http://www.lynda.com for the video training.
thanks,
here’s the code
// MW movie width
// MH movie height
// CW image width
// CH image height
MW = 780
MH = 177;
CW = 1024;
CH = 256;
FLY_RATE = .0002;
kMaxCloudLayers = 3;
function drawCloud()
{
var phase = this.startPhase + getTimer()*FLY_RATE;
var iphase = Math.floor(phase);
var rphase = phase - iphase;
if (iphase != this.phaseCtr)
{
this.phaseCtr++;
// trace(“Current x = " + this.clouds_mc._x);
this.clouds_mc._x = random(CW-MW)-(CW-MW)/2;
this.xs = random(2)? -1 : 1;
this.ys = random(2)? -1 : 1;
// this.swapDepths(0);
// trace(” changed to " + this.clouds_mc._x);
}
if (rphase < .5)
this._alpha = 50-Math.cos(rphase*2*Math.PI)*50;
else
this._alpha = 50-Math.cos((1-rphase)*2*Math.PI)*50;
/*
if (rphase < .5)
this._alpha = rphase*200;
else
this._alpha = (1-rphase)*200;
*/
// fix this to a constant zoom equation using log and rphase
// var zoom = 110+Math.pow(200,rphase);
var zoom = 110+200rphase;
this._xscale = zoomthis.xs;
this._yscale = zoomthis.ys;
this._rotation = rphase30;
}
function init()
{
for (var i = 0; i < kMaxCloudLayers; ++i) {
var nam = “clouds_” + i;
this.attachMovie(“tint_clouds”, nam, i);
this[nam]._x = MW/2;
this[nam]._y = MH/2;
this[nam].clouds_mc._x = random(CW-MW)-(CW-MW)/2;
this[nam].xs = random(2)? -1 : 1;
this[nam].ys = random(2)? -1 : 1;
this[nam].startPhase = i/kMaxCloudLayers;
this[nam].phaseCtr = 0;
this[nam].onEnterFrame = drawCloud;
}
}
init();