PDA

View Full Version : Position Actionscript Over Images



Lev
October 3rd, 2003, 08:19 PM
Flash MX.

I'm sure this is a fairly basic question, but I still haven't groked how to tell Flash to write my actionscript generated lines above the graphics. I would have thought just putting the actionscript in a layer above the graphics would have sufficed, but it continues to draw underneath my graphics in the lower level.

Here is my (partially-stolen) actionscript with resides in the first frame of a layer over the layer with the graphics:



x1=56;
y1=86;

this.onEnterFrame=function(){

if (_xmouse >= 88 && _xmouse <= 135) {
f=(_xmouse - 88);
if (_ymouse >= ((f * 0.666666666666667) + 16) && _ymouse <= ((f * 0.666666666666667) + ( 16 + 31))){
this.clear();
this.lineStyle(1,0,100);
this.moveTo(x1,y1);
this.lineTo(_xmouse,_ymouse);
}
}

}

kode
October 3rd, 2003, 09:47 PM
Create a movie clip in a higher depth that the graphics, and use that movie clip to draw the lines. ;)

var x1 = 56;
var y1 = 86;
this.createEmptyMovieClip("line_mc", 9876);
// change the depth (9876) to whatever you wish
line_mc.onEnterFrame = function() {
if (_xmouse>=88 && _xmouse<=135) {
var f = (_xmouse-88)*0.666666666666667;
if (_ymouse>=f+16 && _ymouse<=f+16+31) {
this.clear();
this.lineStyle(1, 0, 100);
this.moveTo(x1, y1);
this.lineTo(_xmouse, _ymouse);
}
}
};
And welcome to kirupa forum! :P

Lev
October 3rd, 2003, 11:25 PM
Ah, thanks! That worked just fine.

Thanks, also, for the welcome. I guarantee there will be many more questions in there future.

Now I just have to figure out what the proper formula to use is to calculate my isometric bounding box. The one in there now isn't quite right.

kode
October 3rd, 2003, 11:27 PM
Hehe - No problem. :)