# (Flash 8) Crazy coding need some help pleas

**URL:** https://forum.kirupa.com/t/flash-8-crazy-coding-need-some-help-pleas/273773
**Category:** flash
**Created:** [October 20, 2008, 4:37pm UTC](https://forum.kirupa.com/t/flash-8-crazy-coding-need-some-help-pleas/273773 "2008-10-20T16:37:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Matchbox](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Matchbox](https://forum.kirupa.com/u/Matchbox)
#### Post date: [October 20, 2008, 4:37pm UTC](https://forum.kirupa.com/t/flash-8-crazy-coding-need-some-help-pleas/273773/1 "2008-10-20T16:37:03Z")

</div>

So far I have this code using my own images in the cube this works fine… I just need to turn each face into a button that does a loadMovie(something.swf, /holder); function

I just cant figure out how to do this, I’ve tried actionscript linkage with buttons and MC’s neither of which works…

any help would be really REALLY appreciated  
Thanks in Advance.

Stage.scaleMode = ‘noScale’;

var rotations = {x:0, y:0, z:0};

var boxPoints = [{x:-100, y:-100, z:-100}, {x:100, y:100, z:-100}, {x:-100, y:100, z:-100}, {x:-100, y:-100, z:100}, {x:100, y:-100, z:100}, {x:100, y:100, z:100}];

this.createEmptyMovieClip(“theScene”,1);  
theScene.\_x = 200;  
theScene.\_y = 200;

focalLength = 300;

createImages();

theScene.onEnterFrame = function() {

```
rotations.x -= this._ymouse/2000;
rotations.y += this._xmouse/2000;

var points2d = pointsTransform(boxPoints, rotations);

movieClip3PointTransform(this.image0,points2d[2],points2d[0],points2d[3]);
movieClip3PointTransform(this.image1,points2d[5],points2d[1],points2d[2]);
movieClip3PointTransform(this.image2,points2d[0],points2d[2],points2d[1]);
movieClip3PointTransform(this.image3,points2d[4],points2d[3],points2d[0]);
movieClip3PointTransform(this.image4,points2d[3],points2d[4],points2d[5]);
movieClip3PointTransform(this.image5,points2d[1],points2d[5],points2d[4]);

```

};

function createImages() {

```
var i = 6;
while (i--) {
	theScene.createEmptyMovieClip("image"+i,i);

	theScene["image"+i].createEmptyMovieClip("contents",i);

	theScene["image"+i].contents.attachBitmap(flash.display.BitmapData.loadBitmap("image"+i),1,false,true);
}

```

}

function pointsTransform(points, rotations) {  
var tpoints = new Array();  
var sx = Math.sin(rotations.x);  
var cx = Math.cos(rotations.x);  
var sy = Math.sin(rotations.y);  
var cy = Math.cos(rotations.y);  
var sz = Math.sin(rotations.z);  
var cz = Math.cos(rotations.z);  
var x, y, z, xy, xz, yx, yz, zx, zy;

```
var i = points.length;
while (i--) {
	x = points*.x;
	y = points*.y;
	z = points*.z;

	xy = cx*y-sx*z;
	xz = sx*y+cx*z;

	yz = cy*xz-sy*x;
	yx = sy*xz+cy*x;

	zx = cz*yx-sz*xy;
	zy = sz*yx+cz*xy;
	tpoints* = {x:zx, y:zy};
}
return tpoints;

```

}

function movieClip3PointTransform(mc, a, b, c) {

```
mc._visible = pointsIsVisible(a, b, c);

if (!mc._visible) {
	return;

}
var m = mc.transform.matrix;
m.tx = b.x;
m.ty = b.y;
m.a = (a.x-b.x)/mc.contents._width;
m.b = (a.y-b.y)/mc.contents._width;
m.c = (c.x-b.x)/mc.contents._height;
m.d = (c.y-b.y)/mc.contents._height;
mc.transform.matrix = m;

```

}

function pointsIsVisible(c, b, a) {  
var db = b.x-a.x;  
if (!db) {  
return (a.y\>b.y == c.x\>a.x);  
}  
var dc = c.x-a.x;  
if (!dc) {  
return (a.y\>c.y == b.x\<a.x);  
}  
return ((b.y-a.y)/db\<(c.y-a.y)/dc) != (a.x\<b.x == a.x\>c.x);  
}

if it would help to have the file just e-mail me on [mat@the3rdedge.com](mailto:mat@the3rdedge.com)

THANK YOU For looking this over

Matchbox
