<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>3d rotating sphere using flash &#8211; DesignSavvy: Unleashing Creative Brilliance</title>
<atom:link href="https://www.searchenginegenie.com/web-design-blog/tag/3d-rotating-sphere-using-flash/feed/" rel="self" type="application/rss+xml" /><link>https://www.searchenginegenie.com/web-design-blog</link>
<description>Inspiring Designs, Transformative Insights</description>
<lastBuildDate>Tue, 17 May 2011 12:28:34 +0000</lastBuildDate>
<language>en-US</language>
<sy:updatePeriod>
hourly	</sy:updatePeriod>
<sy:updateFrequency>
1	</sy:updateFrequency>
<generator>https://wordpress.org/?v=6.9.4</generator><image>
<url>https://www.searchenginegenie.com/web-design-blog/wp-content/uploads/2024/05/cropped-SEG-1-32x32.png</url><title>3d rotating sphere using flash &#8211; DesignSavvy: Unleashing Creative Brilliance</title><link>https://www.searchenginegenie.com/web-design-blog</link>
<width>32</width>
<height>32</height>
</image>
<item><title>Rendering of 3d colorful sphere rotation using Flash:</title><link>https://www.searchenginegenie.com/web-design-blog/rendering-of-3d-colorful-sphere-rotation-using-flash/</link>
<comments>https://www.searchenginegenie.com/web-design-blog/rendering-of-3d-colorful-sphere-rotation-using-flash/#respond</comments>
<dc:creator><![CDATA[Mars]]></dc:creator>
<pubDate>Tue, 17 May 2011 12:27:53 +0000</pubDate>
<category><![CDATA[Flash]]></category>
<category><![CDATA[web design]]></category>
<category><![CDATA[3d rotating sphere using flash]]></category>
<category><![CDATA[3d rotating sphere using flash action script]]></category>
<guid
isPermaLink="false">http://www.searchenginegenie.com/web-design-blog/?p=767</guid><description><![CDATA[Step-1: Open a new document in flash is about the size of 400 X 410. Step-2:In layer-1 type the text which ever you want. Here I gave “Move the Mouse over the surface  to rotate the sphere”. Step-3:Create layer-2 and write the following action script in keyframe-1(F9). var boardSize:Number=350; var cubeSize:Number=Math.round(boardSize/3); var rotateFactor:Number=1.2*320/boardSize; var fLen:Number=2000; [&#8230;]]]></description>
<content:encoded><![CDATA[<p><object
id="test" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="410" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param
name="src" value="https://www.searchenginegenie.com/web-design-blog/wp-content/uploads/2011/05/3d-colorful-glass-rotation-using-Flash.swf" /><param
name="name" value="test1" /><embed
id="test" type="application/x-shockwave-flash" width="400" height="410" src="https://www.searchenginegenie.com/web-design-blog/wp-content/uploads/2011/05/3d-colorful-glass-rotation-using-Flash.swf?x86529" name="test1"></embed></object></p><p
style="text-align: left;"><span
style="color: #000000;">Step-1: Open a new document in flash is about the size of 400 X 410.</span><br
/>
<span
style="color: #000000;"><br
/>
Step-2:In layer-1 type the text which ever you want. Here I gave “Move the Mouse over the surface  to rotate the sphere”.</span><br
/>
<span
style="color: #000000;"><br
/>
Step-3:Create layer-2 and write the following action script in keyframe-1(F9).<br
/>
</span><br
/>
<span
style="color: #636365;">var boardSize:Number=350;<br
/>
var cubeSize:Number=Math.round(boardSize/3);<br
/>
var rotateFactor:Number=1.2*320/boardSize;<br
/>
var fLen:Number=2000;<br
/>
var spBoard:Sprite=new Sprite();<br
/>
this.addChild(spBoard);<br
/>
spBoard.x=200;<br
/>
spBoard.y=200;<br
/>
var shBack:Shape=new Shape();<br
/>
spBoard.addChild(shBack);<br
/>
drawBack();<br
/>
var shCube:Shape=new Shape();<br
/>
spBoard.addChild(shCube);<br
/>
var doRotate:Boolean = false;<br
/>
var prevX:Number;<br
/>
var prevY:Number;<br
/>
var curTheta:Number=-10;<br
/>
var curPhi:Number=60;<br
/>
var examplesTot:uint=11;<br
/>
var exampleNum:uint=3;<br
/>
var nMesh:Number=40;<br
/>
var tilesArray:Array=[];<br
/>
var firstRun:Boolean=true;<br
/>
var tilesColors:Array=[];<br
/>
function drawBack():void {<br
/>
shBack.graphics.lineStyle(2,0xFFFFFF);<br
/>
shBack.graphics.beginFill(0x000000);<br
/>
shBack.graphics.drawRect(-boardSize/2,-boardSize/2,boardSize,boardSize);<br
/>
shBack.graphics.endFill();<br
/>
}<br
/>
setTilesArray();<br
/>
renderView(curTheta,curPhi);<br
/>
function setTilesArray():void {<br
/>
var i:int;<br
/>
var j:int;<br
/>
var istep:Number;<br
/>
var jstep:Number;<br
/>
var tmin:Number;<br
/>
var tmax:Number;<br
/>
var smin:Number;<br
/>
var smax:Number;<br
/>
var curt:Number;<br
/>
var curs:Number;<br
/>
shCube.graphics.clear();<br
/>
tilesArray=[];<br
/>
tilesColors=[];<br
/>
firstRun=true;<br
/>
curTheta=-10;<br
/>
curPhi=90;<br
/>
if(exampleNum==3){<br
/>
tmin=0;<br
/>
tmax=1.5*Math.PI;<br
/>
smin=0;<br
/>
smax=2*Math.PI;<br
/>
}<br
/>
istep=(smax-smin)/nMesh;<br
/>
jstep=(tmax-tmin)/nMesh;<br
/>
for(i=0;i&lt;=nMesh;i++){<br
/>
curs=istep*i+smin;<br
/>
tilesArray[i]=[];<br
/>
for(j=0;j&lt;=nMesh;j++){<br
/>
curt=jstep*j+tmin;<br
/>
if(exampleNum==3){<br
/>
tilesArray[i][j]=[cubeSize/4.3*Math.cos(curs)*(2+Math.cos(curt)*2),cubeSize/4.3*Math.sin(curs)*(2+Math.cos(curt)*2),cubeSize/2.6*(3-curt)-0.3*cubeSize];<br
/>
}<br
/>
}<br
/>
}<br
/>
}<br
/>
function renderView(t:Number,p:Number):void {<br
/>
var i:int;<br
/>
var j:int;<br
/>
var n:int;<br
/>
var distArray=[];<br
/>
var dispArray=[];<br
/>
var tilesNewArray=[];<br
/>
var midPoint:Array=[];<br
/>
var dist:Number;<br
/>
var depLen:Number;<br
/>
var coloFactor=100/cubeSize;<br
/>
t=t*Math.PI/180;<br
/>
p=p*Math.PI/90;<br
/>
shCube.graphics.clear();<br
/>
for(i=0;i&lt;=nMesh;i++){<br
/>
tilesNewArray[i]=[];<br
/>
for(j=0;j&lt;=nMesh;j++){<br
/>
tilesNewArray[i][j]=pointNewView(tilesArray[i][j],t,p);<br
/>
}<br
/>
}<br
/>
for(i=0;i&lt;nMesh;i++){<br
/>
if(firstRun){<br
/>
tilesColors[i]=[];<br
/>
}<br
/>
for(j=0;j&lt;nMesh;j++){<br
/>
midPoint[0]=(tilesNewArray[i][j][0]+tilesNewArray[i+1][j][0]+tilesNewArray[i][j+1][0]+tilesNewArray[i+1][j+1][0])/4;<br
/>
midPoint[1]=(tilesNewArray[i][j][1]+tilesNewArray[i+1][j][1]+tilesNewArray[i][j+1][1]+tilesNewArray[i+1][j+1][1])/4;<br
/>
midPoint[2]=(tilesNewArray[i][j][2]+tilesNewArray[i+1][j][2]+tilesNewArray[i][j+1][2]+tilesNewArray[i+1][j+1][2])/4;<br
/>
dist=Math.sqrt(Math.pow(fLen-midPoint[0],2)+Math.pow(midPoint[1],2)+Math.pow(midPoint[2],2));<br
/>
distArray.push([dist,i,j]);<br
/>
if(firstRun){<br
/>
tilesColors[i][j]=combineRGB((2*coloFactor*midPoint[2]+100)*0.8+70,(2*coloFactor*midPoint[1]+100)*0.8+70,(2*coloFactor*midPoint[0]+100)*0.8+70);<br
/>
}<br
/>
}<br
/>
}<br
/>
distArray.sort(byDist);<br
/>
for(i=0;i&lt;=nMesh;i++){<br
/>
dispArray[i]=[];<br
/>
for(j=0;j&lt;=nMesh;j++){<br
/>
dispArray[i][j]=[fLen/(fLen-tilesNewArray[i][j][0])*tilesNewArray[i][j][1],-fLen/(fLen-tilesNewArray[i][j][0])*tilesNewArray[i][j][2]];<br
/>
}<br
/>
}<br
/>
depLen=distArray.length;<br
/>
shCube.graphics.lineStyle(1,0&#215;111111);<br
/>
for(n=0;n&lt;depLen;n++){<br
/>
i=distArray[n][1];<br
/>
j=distArray[n][2];<br
/>
shCube.graphics.moveTo(dispArray[i][j][0],dispArray[i][j][1]);<br
/>
shCube.graphics.beginFill(tilesColors[i][j],1.0);<br
/>
shCube.graphics.lineTo(dispArray[i][j+1][0],dispArray[i][j+1][1]);<br
/>
shCube.graphics.lineTo(dispArray[i+1][j+1][0],dispArray[i+1][j+1][1]);<br
/>
shCube.graphics.lineTo(dispArray[i+1][j][0],dispArray[i+1][j][1]);<br
/>
shCube.graphics.lineTo(dispArray[i][j][0],dispArray[i][j][1]);<br
/>
shCube.graphics.endFill();<br
/>
}<br
/>
firstRun=false;<br
/>
}<br
/>
function byDist(v:Array,w:Array):Number {<br
/>
if (v[0]&gt;w[0]){<br
/>
return -1;<br
/>
} else if (v[0]&lt;w[0]){<br
/>
return 1;<br
/>
} else {<br
/>
return 0;<br
/>
}<br
/>
}<br
/>
function pointNewView(v:Array,theta:Number,phi:Number):Array {<br
/>
var newCoords:Array=[];<br
/>
newCoords[0]=v[0]*Math.cos(theta)*Math.sin(phi)+v[1]*Math.sin(theta)*Math.sin(phi)+v[2]*Math.cos(phi);<br
/>
newCoords[1]=-v[0]*Math.sin(theta)+v[1]*Math.cos(theta);<br
/>
newCoords[2]=-v[0]*Math.cos(theta)*Math.cos(phi)-v[1]*Math.sin(theta)*Math.cos(phi)+v[2]*Math.sin(phi);<br
/>
return newCoords;<br
/>
}<br
/>
function combineRGB(red:Number,green:Number,blue:Number):Number {<br
/>
var RGB:Number;<br
/>
if(red&gt;255){red=255;}<br
/>
if(green&gt;255){green=255;}<br
/>
if(blue&gt;255){blue=255;}<br
/>
if(red&lt;0){red=0;}<br
/>
if(green&lt;0){green=0;}<br
/>
if(blue&lt;0){blue=0;}<br
/>
RGB=(red&lt;&lt;16) | (green&lt;&lt;8) | (blue&lt;&lt;0);<br
/>
return RGB;<br
/>
}<br
/>
spBoard.addEventListener(MouseEvent.ROLL_OUT,boardOut);<br
/>
spBoard.addEventListener(MouseEvent.MOUSE_MOVE,boardMove);<br
/>
spBoard.addEventListener(MouseEvent.ROLL_OVER,boardOver);<br
/>
function boardOut(e:MouseEvent):void {<br
/>
doRotate=false;<br
/>
}<br
/>
function boardOver(e:MouseEvent):void {<br
/>
prevX=spBoard.mouseX;<br
/>
prevY=spBoard.mouseY;<br
/>
doRotate=true;<br
/>
}<br
/>
function boardMove(e:MouseEvent):void {<br
/>
var locX:Number=prevX;<br
/>
var locY:Number=prevY;<br
/>
if(doRotate){<br
/>
prevX=spBoard.mouseX;<br
/>
prevY=spBoard.mouseY;<br
/>
curTheta+=(prevX-locX)*rotateFactor;<br
/>
curPhi+=(prevY-locY)*rotateFactor;<br
/>
renderView(curTheta,curPhi);<br
/>
e.updateAfterEvent();<br
/>
}<br
/>
}</span></p><p
style="text-align: left;"><span
style="color: #000000;">Now run the program.</span></p>
]]></content:encoded>
<wfw:commentRss>https://www.searchenginegenie.com/web-design-blog/rendering-of-3d-colorful-sphere-rotation-using-flash/feed/</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
</channel>
</rss>
<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.searchenginegenie.com @ 2026-04-19 00:46:52 by W3 Total Cache
-->