Newest Articles

MegaCombs
Flash Media Player
XML Driven Pie Chart
Base Defender
Hangman Game
8 Ball Pool


Popular Articles

True Fullscreen Flash Mode
Mp3 Player with XML Playlist
Image Slider
Flash Media Player
3d Rotating Image Cube
Catapult Game


Random Articles

Growing Tree using Recursion
Motion along a Path
onEnterFrame vs setInterval
Show the Current Frames Per Second
Glowing Orb
Krypto Movie Quotes


Links

Foundation-Flash
MickM
TutorialQuest
Tutorialsphere.com - Free Online Tutorials
Newgrounds
TWiT
Link to SwfSpot
Swf Spot



rss feed

3d Rotating Image Cube

3d Rotating Image Cube
AddThis Social Bookmark Button
Description: 6 images are grabbed through GET parameters and scaled to create a cube.
Author: John Bezanis
Added: April 5th 2008
Version: Flash 8

This script grabs 6 images and creates a 3d cube which rotates according to the mouse position. It accepts the images through GET parameters. With this form, the user can specify the flash applet height and width, as well as the size of the cube itself. If your website receives a substantial amount of hits, please host the swf file on your own server.
Cube Parameters
Image 1:
Image 2:
Image 3:
Image 4:
Image 5:
Image 6:
Flash Applet Width:
Flash Applet Height:
Cube Size:

Code to copy and paste on your website:


Download the files below:

Download Source File
Download the built 3d Cube
Comments
Damn thats awesome! Great job!
April 6th 2008 12:04PM   -   josh
Is it possible to get this with a different background colour? The white does not fit into my website.
April 9th 2008 05:04PM   -   James
Sure James. Just insert <param name="wmode" value="transparent"> right before </object> and it will make the background transparent. Example:
http://www.bezzmedia.com/stuff/transparent.htm
April 9th 2008 07:04PM   -   John
hi this is cool but how can i turn it into a swf. file with my pics and caption? can u be able to teach me. cuz i downloaded the source code in fla. but nothing comes out what is there for me to do in order to get pictures to come out?? thanks..
April 18th 2008 10:04PM   -   benny
i am looking to put the code above into the style below...is there a way to do that ?? just incase someone does not have a browser that supports flash ????

<script type="text/javascript">
// <![CDATA[
var fo = new FlashObject("http://www.bezzmedia.com/swfspot/resources/45-picturecube.swf?im0=http://www.bezzmedia.com/swfspot/resources/45-im0.jpg&amp;im1=http://www.bezzmedia.com/swfspot/resources/45-im1.jpg&amp;im2=http://www.bezzmedia.com/swfspot/resources/45-im2.jpg&amp;im3=http://www.bezzmedia.com/swfspot/resources/45-im3.jpg&amp;im4=http://www.bezzmedia.com/swfspot/resources/45-im4.jpg&amp;im5=http://www.bezzmedia.com/swfspot/resources/45-im5.jpg&amp;cubesize=100" width="250" height="150");
fo.write("flashcontent");
// ]]>
</script></td>
April 21st 2008 02:04PM   -   mike
I'm trying to reduce the speed of rotation but what I"m doing isn't effective. Any tips?
May 14th 2008 04:05PM   -   Donna
may be a daft question, but is there anyway to remove the shadow on the cube? thanks
May 21st 2008 05:05AM   -   John E
Nice! But if i want to place the cube to the right in the movie (now its allways centerd). How do i do that? And is it possible to change the code so it get a movieclip in stead of an jpg?
May 22nd 2008 11:05AM   -   Shine
Not bad, but how did you forget to utilize forceSmoothing???
May 24th 2008 09:05AM   -   Justin Guptell
Good suggestion Justin. There is however a big performance issue when using forceSmoothing.
May 24th 2008 11:05PM   -   John
Hi! I found the code for center cube, one problem solved.
Is it possible to change the code so it get a movieclip in stead of an jpg?
May 26th 2008 05:05AM   -   Shine
Hello friends ;
How can i call images from xml ?Thanks
May 27th 2008 08:05PM   -   James
I love this, thank you for sharing. :D

As a complete Flash noob, erm.. is there a way I can add links to the pix, please?

frivvy. XXXx
June 7th 2008 05:06AM   -   frivvy
I can't seem to download the "Download the built 3d Cube" file?
I'm just led to a blank screen.
Regardless of that - amazing work!
June 10th 2008 09:06AM   -   Bonzo
I downloaded the source code for this and as a newbie I can't seem to figure out how to get images to appear on the 3D cube. Can you please help a newbie out!!!
June 10th 2008 01:06PM   -   vomelaaw
Hi John. Great job! It seems I have the same problem as benny. I cant figure out where to insert the code above to get my own pictures to apear in the cube?
June 11th 2008 11:06AM   -   Kasper
Is it possible to call a image, simular to clicking on the image from an external javascript? I want to bring up the photo on a mouseover elsewhere in the page. Also on mouseoff resume the rotation
June 15th 2008 08:06AM   -   Maxwell Smart
It works perfectly !!
Thanks for your job.
June 23rd 2008 04:06AM   -   Alex
I cannot download the built 3D qube?
June 23rd 2008 05:06PM   -   Franklyn
Franklyn - right click -> save target as.
June 23rd 2008 05:06PM   -   John
Thanx John
June 24th 2008 02:06PM   -   Franklyn
Hi...how do I host this on my own server? I have the cube working but it relies on your server.
June 28th 2008 05:06AM   -   Franklyn
Hi...I am new to all this never done flash before and am grateful for your genius..I have put your cube on my site (see links page)
the next bit is how do I change your images into mine ?

ArunMChandran@aol.com
July 7th 2008 04:07PM   -   Arun Chandran
Hi John,
Well impressed but are you going to answer the question that almost everyone wants to know? that is of course how do we get our pics on the cube? I will of course host the swf file on my own server.
Thank you.
July 27th 2008 10:07AM   -   Angelo
superb, I soon realised why the white space, you just need to upload the generated swf (renamed below) to your own server ( save this guy's bandwidth ) and change the links to ie ..."http://www.yourdomain.com/cube.swf?im0=http://www.yourdomain.com/images/1.jpg....etc, nice work and cheers....
August 6th 2008 03:08PM   -   sam
Exactly what I was looking for... You are the shiz
August 18th 2008 02:08AM   -   T
Hi John

I think cube is wonderful. I know it's a give away, but please, please, tell me how can I remove the wording and link
"3D cube by SWF Spot" which is visible and accessible whenever I right click the cube? Please reply to this John, I just can't figure it out.

Regards

Craig
August 20th 2008 07:08AM   -   Craig Danta
Awesome, thanks for sharing
August 22nd 2008 12:08AM   -   Filas
can u try and make it opaque... like transparent to merge in our layout background or its really beautiful....
August 29th 2008 02:08PM   -   scorphees
hi john, your cube is great , it has an hypnotic effect . but i have problems to see the cube in IE 6 , it only shows a white box. How do i need in IE to see properly ?
Thanks! Great job!
September 4th 2008 03:09PM   -   Gustavo
How do I provide url to this cube.
September 10th 2008 12:09PM   -   Satish
HI there


this is such a great cube....!!!! great job!!!!

any way one can make the sides function as buttons to place as navigation in a flash site....that means to say that if I click on a side it goes to a frame label in my site? If so...how can i do that? Please help...

thanks a bunch
September 10th 2008 02:09PM   -   sumari van Dyk
I can get the cube to display properly (locally hosted, with my own pics) but I can not seem to get it to display in a frame (within my website). It will only display properly in a full window. Any ideas as to why this might be and how to fix it? Thanks.
September 10th 2008 09:09PM   -   jack
Hi john, your works is so exilent & i m also intrested to learn it bcz i m also a designer...

& plz tell me about - how to do it??
October 8th 2008 03:10AM   -   Sunny
Hi John,

Thank you for the great work you have done on this 3d rotating cube! I have been able to get this to work displaying pictures of my own choosing hosted from your server. Could you please provide some further instructions on how to host this on my own server? I downloaded the source file that you provided but am having some difficulty with this step.

Thanks so much!! :-)
October 15th 2008 12:10PM   -   Mike
I actually just figured it out. Does any one know if it is possible to have video links instead of pictures display? Great work!!!
October 16th 2008 02:10AM   -   Mike
wow ! amazing john ! thank you !
October 28th 2008 12:10PM   -   absolutebeginner66
Great code thanks.
But how do I get this thing to also work in any version of netscape?
November 13th 2008 01:11AM   -    Maxwell Smart
Could one alter this great design so it only rotates 4 faces on the Y axis, w/hyperlinks on each face?
November 23rd 2008 08:11PM   -   Brandon
I cannot get the swf file to host on my own server no matter what I try! I have downloaded it several times, have tried remaking it from the fla file, but the only way it will run is linked to the bezzmedia site. I can set it to use the images from my own site but not the swf. Any ideas from anyone?
November 24th 2008 05:11PM   -   Bill
Great,Can we control the speed
November 25th 2008 02:11AM   -   Rosemary
how indentify the side of cube user clicked? - i want to make this cube as 6 buttons navigator, so where i should place my scripts?
thanks,
not pro in flash scripting..
November 28th 2008 03:11AM   -   Arunas
thanks for this.

i don't want to add image for cube, i wish to add swf file or movie clip. have anyway for that ? if have then please let me know. i'm not pro. in flash.. so if need action script thing then post here please..

thanks again
December 9th 2008 12:12AM   -   pagol
To make work off your server, make sure you upload 6 pictures (John's or yours) as well as the .swf file. You can get all the files above. To get the .swf file, right click it and select "save As" from the menu and save it to your hard drive. You only need the .fla file if you want to modify the cube in a flash program. You will need an HTML page that loads everything (using the outline script above. Make sure you change the file locations and or names to match your design and it will work perfectly. If you have a problem, re-check you file names and verify that all files are present in the directory you have named in the HTML file. Works like a charm. Great work John and thanks
December 20th 2008 11:12PM   -   Michael
uhh...Jhon? you, uh, gonna answer anyones question anytime soon??
January 16th 2009 07:01AM   -   Raghib
I cant get My Personal Pictures to work on in the cube. Could i get some help
January 25th 2009 11:01AM   -   Mike
Is it possible to slow down the rotation of the cube when the user isn't mousing over? Right now it seems to rotate very quickly. Any help would be greatly appreciated. Thanks!
January 26th 2009 02:01PM   -   Sierra
Hello, do I have a problem of display under Internet to explore 6 how I must make???
January 27th 2009 11:01AM   -   Lylou
Although it doesn't seem as though there has been any response for this lately, I'll jump-

I'm trying to use the cube in a non-web environment (as a tool for showing drafts of my work, possibly in a presentation environment such as ppt, pdf or even flash presentation). I have CS3 Flash and a very basic knowledge of flash (I'm a graphic designer). I can't figure out where to insert code to link my pictures in the .fla to make them appear in the .swf in a non-web environment.
March 9th 2009 03:03PM   -   RCain
Oh, and it's a Killer Cube. Your Flash talent is only exceeded by your math genius:) Also, I understand if you've gone commercial and are now only selling your code/expertise, but I may have to ante up out of my own pocket for this one since it's been driving me mad for a week.
March 9th 2009 03:03PM   -   Rcain
great work...amazing
April 9th 2009 04:04PM   -   nv
I built this cube with my own pictures in l996 On Geocities when they offered it. Wish I could remember how I did it.
May 10th 2009 10:05PM   -   Janice
Nice Cube you got there.

So i have a problem, i have a rubiks cube in Flash and i want to upload my images on the sides like it's in this cube but i really don't know how to make it.

Could somebody help me?
May 12th 2009 07:05AM   -   Michael
Please, please, teach me how to make a http link when I click on one of the images.
June 2nd 2009 01:06PM   -   rico
Any idea how I can embed this into a SWiSHmax animation please?
June 9th 2009 07:06AM   -   Rob
Great Job!
June 9th 2009 10:06PM   -   Suliazanna
Hi,
The cube works fine in i.e 7 but not in any other browsers. Can anyone tell me how to make the cube cross-browser compliant?

Many THanks

Chaz
June 19th 2009 09:06AM   -   Sharon
how to drag and join two or more 3D boxes in flash AS3 pls give me the source file
July 2nd 2009 03:07AM   -   maxwell
jabb
July 28th 2009 03:07AM   -   God like
This is awesome! Thank you so much for sharing your knowledge and expertise! :)
August 3rd 2009 12:08AM   -   Mel
Hi, I am trying to download the files but the first one downloads a .fla but is blank inside and the second does not download anything. is there an alternative link?
August 14th 2009 06:08PM   -   Andy
Hi Andrew,

Can you please explain exactly where you did add some AS? I am using AS 2.0 and in the original cube fla I have main with AS, and 3 movies, 2 of them got AS.
I can't figure out where to add the actionscript to make each side of the cube link to a new page.

Thanks in advance.

karin
September 1st 2009 05:09PM   -   karin
Hi Karin, you need a copy of Flash CS3 (or i suppose an earlier version).

If you open the downloaded fla file, you can access the code that runs the cube. Inside it somewhere, there is a section that sets the cube to stop and maximixe when it is clicked.

In there, i made actionscript call a javascript function - in my case, it just outputted the image location.

This is the bit you are looking for in the cube.fla file

//A side has been clicked. Spin it to that side and zoom in
eval('side'+0).onPress=function()
{
focusing=!focusing;
focusX=0;
focusY=0;
focusZ=0;
focusside=0;

// Refactored by Andrew Osiname
// A side has been clicked and the name of the picture is passed
// back to the browser for further use.
getURL("javascript:changeValue('"+_parent.im0+"');");
}

getURL instructs it to call the javascript function inside the brackets. in my case it is a function called changeValue in which it takes the value of im0 which is the path of im0 and prints to the browser

so for example if my javascript changeValue function was actually a function that links to another page then it would like you to that new page.

a good way to test it is to add this line in

getURL("javascript:alert('hello world');");
When you click on the side, it will alert hello world so whatever javascript function you put in place of alert('hello world') will be called when a side is clicked.

I hope that makes sense?!?!
September 2nd 2009 11:09AM   -   andrew
hey Andrew,

Thanks a lot, this helps heaps.
I got the javascript popup window. I now and wresling with the proper egtURL value. I will let you know, if ya like, whats happens with my effort..
And I hope this way other people can learn as well.

greetzz,
Karin
September 2nd 2009 06:09PM   -   Karin
Hi again Andrew,

I think we might want to take this elsewhere, I am sure people watching this site might not be pleased reading all this.. But..then again, until we get complaints:

I worked with your tips, I got the hello world thingie
Then I tried adding a myURL value and it got me nothing.
I will paste my AS below:
(oops, I can only put so many characters in here. I will put my code in next msg)
September 2nd 2009 07:09PM   -   Karin

//Picture Cube by John Bezanis
//visit http://swfspot.com for more flash projects
stop();
//Size of the cube.
cubeSize = _parent.size;
cubeDiagonal = Math.sqrt(cubeSize*cubeSize+cubeSize*cubeSize);
//Initial rotational position in radians
rotationX = 0;
rotationY = 0;
rotationZ = 0;
//Rotational speed in radians
speedX = .01;
speedY = .015;
speedZ = .0;
//Points plotting the corners of the cube
var pointArray:Array = [[-cubeSize/2, -cubeSize/2, cubeSize/2], [cubeSize/2, -cubeSize/2,

cubeSize/2], [cubeSize/2, cubeSize/2, cubeSize/2], [-cubeSize/2, cubeSize/2, cubeSize/2],

[-cubeSize/2, -cubeSize/2, -cubeSize/2], [cubeSize/2, -cubeSize/2, -cubeSize/2],

[cubeSize/2, cubeSize/2, -cubeSize/2], [-cubeSize/2, cubeSize/2, -cubeSize/2]];
//A temporary array to reset the points each frame
var drawArray:Array = new Array();
//corners of each side correspond to the points
var facePoints:Array = [[0, 1, 2, 3], [1, 5, 6, 2], [5, 4, 7, 6], [4, 0, 3, 7], [4,5,1,0],

[3, 2, 6, 7]];
for (i=0; i<6; i++) {
attachMovie('side', 'side'+i, this.getNextHighestDepth());
eval('side'+i).inner.pic = eval("_parent.im"+i);
}
//A side has been clicked and the name of the picture is passed
//back to the browser for further use
var myURL:String = "http://www.moondesigns.nl/images/flashcube/";
//getURL("javascript:openNewWindow('" + String(myURL) + "');");


getURL("javascript:openNewWindow('" + String(myURL) + "');");
//A side has been clicked. Spin it to that side and zoom in
eval('side'+0).onPress=function(){
focusing=!focusing;
focusX=0;
focusY=0;
focusZ=0;
focusside=0;
}
eval('side'+1).onPress=function(){
focusing=!focusing;
focusX=0;
focusY=-Math.PI/2;
focusZ=0;
focusside=1;
}
eval('side'+2).onPress=function(){
focusing=!focusing;
focusX=0;
focusY=-Math.PI;
focusZ=0;
focusside=2;
}
eval('side'+3).onPress=function(){
focusing=!focusing;
focusX=0;
focusY=Math.PI/2;
focusZ=0;
focusside=3;
}
eval('side'+4).onPress=function(){
focusing=!focusing;
focusX=Math.PI/2;
focusY=0;
focusZ=0;
focusside=4;
}
eval('side'+5).onPress=function(){
focusing=!focusing;
focusX=-Math.PI/2;
focusY=0;
focusZ=0;
focusside=5;
}
focusing=false;
radianstodegrees = 180/Math.PI;
onEnterFrame = function () {
clear();
if(!focusing){
mousedist=Math.sqrt(_xmouse*_xmouse+_ymouse*_ymouse);
mouseangle=Math.atan2(_ymouse,_xmouse);
//Change the speed based on the mouse position
speedX=Math.max(-.05,Math.min(.05,speedX+Math.sin(mouseangle)

*mousedist/100000));
speedY=Math.max(-.05,Math.min(.05,speedY+Math.cos(mouseangle)

*mousedist/100000));
speedZ=0;
//Change the rotation of the cube based on its speed
rotationX = rotationX%(2*Math.PI)+speedX;
rotationY = rotationY%(2*Math.PI)+speedY;
rotationZ = rotationZ%(2*Math.PI)+speedZ;
_xscale=(_xscale*4+100)/5;
_yscale=(_yscale*4+100)/5;
}else{
//If there is minimum change, do nothing. This reduces flickering.
if(Math.round(rotationX*1000)==Math.round(focusX*1000)&&Math.round

(rotationY*1000)==Math.round(focusY*1000)&&Math.round(rotationZ*1000)==Math.round

(focusZ*1000)){
}else{
rotationX = (rotationX*4+(rotationX+focusX)/2)/5;
rotationY = (rotationY*4+(rotationY+focusY)/2)/5;
rotationZ = (rotationZ*4+(rotationZ+focusZ)/2)/5;
}
September 2nd 2009 07:09PM   -   Karin
if((eval('side'+focusside).inner.image_mc._yscale/eval

('side'+focusside).inner.image_mc._xscale)>Stage.width/Stage.height){
//wider than stage
_width=(_width*5+Stage.width)/6;
_yscale=(_yscale*3+_xscale*(eval

('side'+focusside).inner.image_mc._xscale/eval('side'+focusside).inner.image_mc._yscale))/4;
}else{
//higher than stage
_height=(_height*5+Stage.height)/6;
_xscale=(_xscale*3+_yscale*(eval

('side'+focusside).inner.image_mc._yscale/eval('side'+focusside).inner.image_mc._xscale))/4;
}
}
//Copy the positions of the dots on the cube. The original positions do not get

modified.
//Doing this eliminates round off error over time.
drawArray = [pointArray[0].slice(), pointArray[1].slice(), pointArray[2].slice(),

pointArray[3].slice(), pointArray[4].slice(), pointArray[5].slice(), pointArray[6].slice(),

pointArray[7].slice()];

//Spin the dots for the top 4 corners. The bottom 4 corners are just negatives of

the top
//The cube is spun along each axis seperately.
//When spinning along each axis, the value for that axis remains the same.
for (position=0; position<4; position++) {
rotateX(position);
}
for (position=0; position<4; position++) {
rotateY(position);
}
for (position=0; position<4; position++) {
rotateZ(position);
}
//Copy the points of the top half, but take the negative of ther values
drawArray[4] = [-drawArray[2][0], -drawArray[2][1], -drawArray[2][2]];
drawArray[5] = [-drawArray[3][0], -drawArray[3][1], -drawArray[3][2]];
drawArray[6] = [-drawArray[0][0], -drawArray[0][1], -drawArray[0][2]];
drawArray[7] = [-drawArray[1][0], -drawArray[1][1], -drawArray[1][2]];
highpoint = 0;
//Find the point with the highest z value
for (point=1; point<8; point++) {
if (drawArray[point][2]>=drawArray[highpoint][2]) {
highpoint = point;
}
}
for (curside=0; curside<6; curside++) {
showside = 0;
//Looping through the sides, only draw the sides that are visible.
for (sidepoint=0; sidepoint<=3; sidepoint++) {
if (facePoints[curside][sidepoint] == highpoint) {
showside = 1;
}
}
if (showside) {
drawSide(curside);
eval('side'+curside)._alpha = 100;
//Adjust the brightness of the side based on its visible area
myColor = new Color(eval('side'+curside));
currentColor = {rb:255*(Math.min(100,eval

('side'+curside).inner._xscale)+Math.min(100,eval('side'+curside).inner._yscale))/200-255,


gb:255*(Math.min(100,eval('side'+curside).inner._xscale)+Math.min(100,eval

('side'+curside).inner._yscale))/200-255,


bb:255*(Math.min(100,eval('side'+curside).inner._xscale)+Math.min(100,eval

('side'+curside).inner._yscale))/200-255};
myColor.setTransform(currentColor);
} else {
eval('side'+curside)._alpha = 0;
eval('side'+curside)._xscale = 0;
eval('side'+curside)._yscale = 0;
}
}
};
//the rotate functions find the point's distance from its axis, figure out its current

angle,
//and rotate based on the new angle
function rotateX(rotatePoint) {
axisDistance = Math.sqrt(Math.pow(drawArray[rotatePoint][1], 2)+Math.pow(drawArray

[rotatePoint][2], 2));
drawAngle = Math.atan2(drawArray[rotatePoint][1], drawArray[rotatePoint][2])

+rotationX;
drawArray[rotatePoint][1] = axisDistance*Math.sin(drawAngle);
drawArray[rotatePoint][2] = axisDistance*Math.cos(drawAngle);
}
function rotateY(rotatePoint) {
axisDistance = Math.sqrt(Math.pow(drawArray[rotatePoint][0], 2)+Math.pow(drawArray

[rotatePoint][2], 2));
drawAngle = Math.atan2(drawArray[rotatePoint][0], drawArray[rotatePoint][2])

+rotationY;
drawArray[rotatePoint][0] = axisDistance*Math.sin(drawAngle);
drawArray[rotatePoint][2] = axisDistance*Math.cos(drawAngle);
}
function rotateZ(rotatePoint) {
axisDistance = Math.sqrt(Math.pow(drawArray[rotatePoint][0], 2)+Math.pow(drawArray

[rotatePoint][1], 2));
drawAngle = Math.atan2(drawArray[rotatePoint][0], drawArray[rotatePoint][1])

+rotationZ;
drawArray[rotatePoint][0] = axisDistance*Math.sin(drawAngle);
drawArray[rotatePoint][1] = axisDistance*Math.cos(drawAngle);
}
September 2nd 2009 07:09PM   -   Karin
//Distance between 2 points
function getDistance(x1, y1, x2, y2) {
deltaX = x1-x2;
deltaY = y1-y2;
dist = Math.sqrt((deltaX*deltaX)+(deltaY*deltaY));
return dist;
}
function drawSide(side) {
eval('side'+curside)._xscale = 100;
eval('side'+curside)._yscale = 100;
eval("side"+side)._x = drawArray[facePoints[side][0]][0];
eval("side"+side)._y = drawArray[facePoints[side][0]][1];
ab = getDistance(drawArray[facePoints[side][0]][0], drawArray[facePoints[side][0]]

[1], drawArray[facePoints[side][1]][0], drawArray[facePoints[side][1]][1]);
bc = getDistance(drawArray[facePoints[side][1]][0], drawArray[facePoints[side][1]]

[1], drawArray[facePoints[side][3]][0], drawArray[facePoints[side][3]][1]);
ca = getDistance(drawArray[facePoints[side][3]][0], drawArray[facePoints[side][3]]

[1], drawArray[facePoints[side][0]][0], drawArray[facePoints[side][0]][1]);
//Corner Angle in Radians
cornerAngle = Math.acos(-(bc*bc-ab*ab-ca*ca)/(2*ab*ca));
eval("side"+side)._yscale = ((Math.tan(cornerAngle/2)*(cubeDiagonal/2)

*2)/cubeDiagonal)*100;
eval("side"+side)._rotation = radianstodegrees*Math.atan2(drawArray[facePoints

[side][1]][1]-drawArray[facePoints[side][0]][1], drawArray[facePoints[side][1]][0]-

drawArray[facePoints[side][0]][0])+radianstodegrees*cornerAngle/2;
eval("side"+side).inner._rotation = -45;
distortionscale = 100/((0.707106781186548/Math.cos(cornerAngle/2))*cubeSize);
eval("side"+side).inner._xscale = ab*distortionscale;
eval("side"+side).inner._yscale = ca*distortionscale;
}
function visitswfspot() {
getURL("http://www.swfspot.com", "_blank");
}
var myMenu = new ContextMenu();
var menubezz = new ContextMenuItem("3D Cube by SWF Spot", visitswfspot);
myMenu.customItems.push(menubezz);
_root.menu = myMenu;

Thanks in advance for your help:)

Karin
September 2nd 2009 07:09PM   -   Karin
I think i see the problem. From your code:

you have to put your javascript INSIDE the:

eval('side'+0).onPress=function()

Because inside that function is what the cube does when you press a side.

If you follow me, you should really put your javascript call under focussside=0

Try this

//A side has been clicked. Spin it to that side and zoom in
eval('side'+0).onPress=function()
{
focusing=!focusing;
focusX=0;
focusY=0;
focusZ=0;
focusside=0;
getURL("javascript:top.location.replace('http://www.google.co.uk');");
}

That links to google.co.uk on a click. So you probably want to write a javascript function somewhere called

function linkToPage(thePage)
{
top.location.replace(thePage);
// this is one of a few javascript redirect built in functions
}

Then side 0 will have
getURL("javascript:linkToPage('http://www.google.co.uk');");

This may cause problems though because it means you have to hard code six websites into your flash cube - which can be a pain if your pictures change - unless you code an id number of somesort which references to the correct page in your javascript.
September 3rd 2009 10:09AM   -   andrew
I'd like mine to be stopped when it first appears, and have people click on it to start the rotation. Any way to do that?
September 5th 2009 05:09AM   -   mel cheplowitz
how can i turn images transparent like http://www.photocube3d.com/

and slowdown the rotation of cube ?

thx
r3beLDeRa@hotmail.com
September 9th 2009 01:09AM   -   Rebelssss
This cube is a great work!

You can change the url inside the code, and point it to your own images uploaded in your server...

I downloaded the source file... action script 2... but does not seem to work...

Tried to download the built 3d cube from the link above, but can
September 12th 2009 06:09AM   -   Paul
Rebelsss - think that would be something to do with the alpha fade but cannot say for sure.

Paul, you can download it from here but you have to right click on the link and select 'save target as' then save to your hard drive
September 12th 2009 04:09PM   -   Andrew
im new to flash and don't get how i am able to put this onto my flash site, any help would be great, do i use a loader? sorry to be a noob.
September 26th 2009 05:09PM   -   centric
Any ideas how to center it? Just putting div around and center doesnt work- can u tell ive never used flash ;) BRILLIANT BY THE WAY, THANK YOU!!!
September 28th 2009 01:09PM   -   dems
Is there any way to maybe put a glow around the box as it rotates?
October 1st 2009 12:10PM   -   Shane Keogh
The easiest way to set up and host this on your own site.....
Set the cube parameters: go ahead and enter the six pictures
you want to use on your cube from your website...
(ie: http://home.comcast.net/mysite/myfolder/myfile.jpg)
set cube size and hit the update code and preview button.
if it looks good to you copy and paste the code from the box
into notepad. download built3d cube swf by right clicking on the
link and save as.
copy and past the code into your webpage. be sure to update the
location of the swf file on your site...
Thanks for the cube!!! gk
October 4th 2009 02:10PM   -   GK
works great... thanks for the transparent background tip..
To center it on the page put the Center right before Table
and close /Center right after you close /table
/center
gk
October 4th 2009 10:10PM   -   GK
Great work.

I love this cube, but I'm afraid that for many users, my photos will not be seen because they won't click on the cube.

Is there anyway to make this rotate for a few seconds then automatically display one of the images, then go back to rotating, then display another image, and so on and so on?

Picture display could be ordered or random.

October 23rd 2009 10:10AM   -   zemi
Great, but seriously, speed? The thing whips around like a dervish on cocaine.
October 25th 2009 05:10PM   -   dirkson
Is there a way to make one of the pictures a video clip? Also, same question as others.. how to slow it down? Thanks!
November 5th 2009 01:11AM   -   Rachel
keep
November 6th 2009 10:11AM   -   vigrx
That is an awesome cube, thanks for sharing
November 11th 2009 12:11PM   -   best toasters
anyway I can get this to work in power point?
November 14th 2009 08:11PM   -   tony
This cube is a great work!

You can change the url inside the code, and point it to your own images uploaded in your server...

Anybody knows how to download the swf cube?

Thanks.
November 24th 2009 10:11PM   -   Dieta para emagrecer
Can this image cube be changed to have more sides ?
November 27th 2009 08:11AM   -   Smart l
Really awesome! Thank you for sharing such a valuable knowledge and information !
Are we free to use, modify and edit this source file ?
Thanks
November 27th 2009 09:11AM   -   alaenah
Great cube... just wondering how I could place text onto the faces of the cube. Basically I'm using your code to pull images in from my blog. I would place text onto the images but then the trouble is I've got a lot of images. I haven't got a clue where to start. Any ideas?

Cheers,

Rich
December 2nd 2009 11:12AM   -   Richard Lee
how to upload pics here?i upload from photobucket then i put here the code but when i put in my facebook it not appear

can u help me?
December 5th 2009 06:12AM   -   uuuuuuu
It perfectly, Thanks for your job.
December 6th 2009 01:12AM   -   seo
Nice post,thanks for sharing and best regards.
December 7th 2009 12:12PM   -   selbstklebefolie
Thanks and well done for fixing this together! This site has some games that are so addictive! I'm going to have to ban myself from using it until my exams are over
December 9th 2009 11:12AM   -   Extender Dining Tables
Thanks for this!
December 10th 2009 06:12PM   -   adam
I have bookmarked your site. Thanks for sharing
December 13th 2009 08:12AM   -   dental
Very cool cube!
December 17th 2009 10:12AM   -   get paid for surveys
[b][url=http://www.mbtmall.com/Sports.html]mbt sneakers m walk[/url][/b]
[b][url=http://www.mbtmall.com/Sports.html]mbt sneakers chapa [/url][/b]
[b][url=http://www.mbtmall.com/Sports.html]mbt sneakers lami[/url][/b]
[b][url=http://www.mbtmall.com/Sports.html]mbt masai shoes[/url][/b]
[b][url=http://www.mbtmall.com/Sports.html]mbt barabara mens shoes [/url][/b]
[b][url=http://www.mbtmall.com/Sports.html]mbt chapa sneakers[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-M.-Walk-Sky-36.html]mens mbt m walk sky[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-M.-Walk-Silver-37.html]mens mbt m walk silver[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-M.-Walk-Pink-35.html]mens mbt m walk pink[/url][/b]
[b][url=http://www.mbtmall.com/Sports.html]mens mbt m walk black[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-M.-Walk-White-34.html]mens mbt m walk white[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Chapa-Water-49.html]mens mbt chapa water[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Chapa-Ebony-48.html]mens mbt chapa ebony[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Chapa-Black-18.html]mens mbt chapa black[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Chapa-GTX-Stone-47.html]mens mbt chapa gtx stone[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Chapa-GTX-Black-46.html]mens mbt chapa gtx black[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Chapa-Caviar-Black-19.html]mens mbt chapa caviar black[/url][/b]
[b][url=http://www.mbtmall.com/Sports/Men-s-MBT-Sport-Black-17.html]mens mbt sport black[/url][/b]
[b][url=http://www.mbtmall.com/Casual/Men-s-MBT-Safiri-Chill-20.html]mens mbt safiri chill[/url][/b]
[b][url=http://www.mbtmall.com/Casual/Men-s-MBT-Safiri-Navy-21.html]mens mbt safiri navy[/url][/b]


December 30th 2009 04:12AM   -   mbt shoes
Hello,

Thanks a lot for this but the link for download the swf doesn't work. Can you repair this ?

Thanks !
December 30th 2009 03:12PM   -   Chriss
i like
January 4th 2010 02:01AM   -   pandora jewelry
I was amazed at this 3d Rotating Image Cube and Ability of transparent background of flash is great.
January 4th 2010 03:01AM   -   jobs
Hello,

Sorry for my english, I'm french.
Great job for the cube.
I need to do a cube with red borders and back faces. No problem with that. But I'd like to change the shadow in red too. It will be on color black (http://edsh.free.fr/ryan). Is it possible ?
Thank you

Micael
January 4th 2010 12:01PM   -   Micael
thnx for sharing
nice)
January 6th 2010 01:01PM   -   movie downloads
Great component. Thanks.
January 7th 2010 02:01PM   -   Ipotpal
its too good! i have never seen anything like this before.
January 8th 2010 07:01AM   -   custom logo design
I Like it, thanks for the informations and comments. Best regards from germany.
January 8th 2010 03:01PM   -   Wandtattoo Blog
I'm trying to use the cube in a non-web environment (as a tool for showing drafts of my work, possibly in a presentation environment such as ppt, pdf or even flash presentation). I have CS3 Flash and a very basic knowledge of flash (I'm a graphic designer). I can't figure out where to insert code to link my pictures in the .fla to make them appear in the .swf in a non-web environment.
January 11th 2010 12:01PM   -   Cialis
Cant wait to implement this code to my site. Many thanks fromt he uk
January 13th 2010 07:01PM   -   small notebook computers
this is so cool how it creates a 3d cube. You definitely out did yourself on this. This code is amazing to use on my website.
January 14th 2010 03:01PM   -   dallas porcelain veneers
the rotating image cube looks ace! i will implement it on my page soon presenting some latex masks .
January 14th 2010 06:01PM   -   Masker
Thanks for sharing such a wonderful information with us.
January 14th 2010 07:01PM   -   chat
If they are linking from the comment, I would consider it spam. If they post a comment, and it is on topic, be glad someone saw your blog and thought enough to post to it.
January 14th 2010 07:01PM   -   mirc
Thank you for good tutorial of 3d cube.
January 18th 2010 10:01PM   -   book
How to set speed of this cube?
January 18th 2010 10:01PM   -   film
Useful info to be shared
January 19th 2010 08:01AM   -   Ares
Very nicely presented, thanks for sharing.
January 20th 2010 05:01PM   -   Dior Sunglasses
This is by far the best cube I have ever seen. I will use it on my sites.
January 20th 2010 08:01PM   -   McFarlane NFL Sports Pick
Thanks so much for offering this...can't wait to try it out on my web sites!
January 21st 2010 07:01AM   -   Mens Best Gifts
Nice cube. I'l used it.
January 21st 2010 01:01PM   -   3d image
Yeah the cube is very nice, thank you for sharing it.
January 22nd 2010 12:01AM   -   tuning
That is an awesome cube, thanks you for sharing.
January 22nd 2010 12:01AM   -   tuning
This cube is awesome and works fine on Internet explorer but don't seem to get it to work on googlechrome. And tips? Thanks in advance.
January 22nd 2010 06:01AM   -   Sakayaya
thanks you for post.
January 22nd 2010 04:01PM   -   generic Valtrex
thanx for this post i really loved it
January 23rd 2010 03:01PM   -   augmentin online
cool site.
January 23rd 2010 04:01PM   -   Vardenafil
great infos here i will come back more often
January 23rd 2010 08:01PM   -   buy augmentin online
great post i will read this more often
January 23rd 2010 10:01PM   -   augmentin no prescription
love this info i will read this more often
January 23rd 2010 11:01PM   -   augmentin overnight deliv
love this info i will read this more often
January 24th 2010 06:01AM   -   evening dresses
Nice flash object! Well done :-)
January 24th 2010 11:01AM   -   Mike
Nice cube.
January 24th 2010 02:01PM   -   newsong
SWEET CUBE!!!
January 25th 2010 11:01PM   -   web hosting
happy republic day,
January 26th 2010 12:01AM   -   Republic Day Messages
_____ \\\!!!///____
______( ô ô )______
____ooO-(_)-Ooo___
Ich möchte einen netten Gruß hinterlassen
und ich würde mich freuen, wenn Sie auf
meiner Homepage auch einmal
vorbei schauen würden!

February 4th 2010 12:02PM   -   Volker Lasnge
Special thank for good post.
February 5th 2010 08:02AM   -   à¹‚หลดเพลงà
Thank
February 5th 2010 10:02PM   -   à¹‚หลดเพลงm
Special thank for good post.
February 10th 2010 03:02AM   -   à¹‚หลดเพลงà
Special thank for good post.
February 10th 2010 08:02AM   -   à¹‚หลดเพลงà
Why its not working with forefox
February 15th 2010 01:02AM   -   Kavitha
Hey gang,
Just wanted to say, I played around a little with this and figured out how to change the speed in the AS. For some reason the speed setting starting at line 11 doesn't do anything. However, if you scroll down to line 79 you can change the speed by dividing the speed vars by a low number. For example, I changed them to:

rotationX = rotationX%(3*Math.PI)+(speedX/.5);
rotationY = rotationY%(3*Math.PI)+(speedY/.5);
rotationZ = rotationZ%(3*Math.PI)+(speedZ/.5);

That worked great. Play around with it and find the right speed for your project.
February 19th 2010 12:02AM   -   Jesse
On that last post I messed up - you actually want to divide the speed vars by something above one so 1.5 for example. Sorry about that.
February 19th 2010 12:02AM   -   Jesse
Why does an image, when clicked, randomly display different width/height?

All 6 jpg's, for my cube, have the same resolution, same width/height in px. Set the above cube size to x, flash width/flash height to y/z. Irrespective of size of xyz, when the image is clicked, it 'randomly' displays what appears to be the correct width/height with shadow; yet click it again after clicking other images, then it displays a larger image without (or with partial) shadows. I can't read the fla file because I only have flash mx. This occurs in IE or firefox; occurs when data is created/shown on this site. Any way to correct this? Info greatly appreciated.
February 23rd 2010 01:02PM   -   gabrielle
Add a Comment
name:
website (optional):
captcha type the characters into the box
message (5000 characters or less):