# {FLASH 8} Help Beginner with attachMovie

**URL:** <https://forum.kirupa.com/t/flash-8-help-beginner-with-attachmovie/176189>\
**Category:** flash\
**Created:** [January 21, 2006, 7:38am UTC](https://forum.kirupa.com/t/flash-8-help-beginner-with-attachmovie/176189 "2006-01-21T07:38:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NovaGiant](https://avatars.discourse-cdn.com/v4/letter/n/d07c76/32.png) [@NovaGiant](https://forum.kirupa.com/u/NovaGiant)\
**Post date:** [January 21, 2006, 7:38am UTC](https://forum.kirupa.com/t/flash-8-help-beginner-with-attachmovie/176189/1 "2006-01-21T07:38:47Z")

</div>

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](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](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 &lt; .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+200_rphase;  
this.\_xscale = zoom_this.xs;  
this.\_yscale = zoom_this.ys;  
this.\_rotation = rphase_30;  
}

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();
