Search:
Calendar:
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Subscribe:
Enter your email address to subscribe to this blog.
Archives By Subject:
Action Script (1) [RSS]
Adobe (33) [RSS]
AIR (7) [RSS]
Ajax (3) [RSS]
Buzzword (1) [RSS]
CFUG (42) [RSS]
ColdFusion (69) [RSS]
Flash (6) [RSS]
Flex (40) [RSS]
Frameworks (2) [RSS]
Free Software (2) [RSS]
FXUG (22) [RSS]
General (33) [RSS]
JpgMetadataReader (3) [RSS]
jQuery (1) [RSS]
Mac (2) [RSS]
Off Topic (13) [RSS]
OpenSource (14) [RSS]
PaperVision (10) [RSS]
Spry (2) [RSS]
Transfer (1) [RSS]
Adobe (33) [RSS]
AIR (7) [RSS]
Ajax (3) [RSS]
Buzzword (1) [RSS]
CFUG (42) [RSS]
ColdFusion (69) [RSS]
Flash (6) [RSS]
Flex (40) [RSS]
Frameworks (2) [RSS]
Free Software (2) [RSS]
FXUG (22) [RSS]
General (33) [RSS]
JpgMetadataReader (3) [RSS]
jQuery (1) [RSS]
Mac (2) [RSS]
Off Topic (13) [RSS]
OpenSource (14) [RSS]
PaperVision (10) [RSS]
Spry (2) [RSS]
Transfer (1) [RSS]
Tags:
adobe
air
ajax
cfug
coldfusion
flash
flex
frameworks
free software
fxug
general
jpgmetadatareader
mac
off topic
opensource
papervision
spry
Recent Entries:
Top Posts:
- [15501] Paper Vision 3D Sphere - Carousels on Steroids!
- [8170] Simple PaperVision3D Blurring example
- [7963] Carousel v0.2 - source code
- [7941] PaperVision3D/Flex2 Carousel v0.2
- [7912] Saving images from Flex using ColdFusion: Simple Example with source code
- [7816] PaperVision Carousel0.3 - one step closer to the master plan!
- [7473] Simple Dynamic Cursor Example in Flex2: With source code
- [7383] Simple PaperVision3D Blurring example : source code
- [6603] PaperVision3D is good for cubes! - a "geek" gift
- [5683] PaperVision, Flex2 and my daughter all playing together!
Recent Comments:
- ColdFusion and constants - how do you do them?
Ben Spencer said: Hi David, If you create a getConstants() method where you just set up a local var STRUCT with the ... [More] - ColdFusion and constants - how do you do them?
John Whish said: Hi Jim, you're right. David does mention that in the post. I read David's post when I posted my orig... [More] - ColdFusion and constants - how do you do them?
Jim Connor said: > I should point out that the THIS scope is a public property so can be set by code outside your ... [More] - ColdFusion and constants - how do you do them?
John Whish said: I should point out that the THIS scope is a public property so can be set by code outside your cfc. ... [More] - ColdFusion and constants - how do you do them?
Jim Connor said: We use the 'this' scope of the related cfc to store constants. I also use the C++ convention of maki... [More]
Top Commenters:
- [8] Campbell
- [8] Ben Nadel
- [6] Steve Bryant
- [6] Mark Flewellen
- [4] barry.b
- [4] Raymond Camden
- [3] John Whish
- [3] Peter Bell
- [2] carlos
- [2] riabook
My Links:
RSS:
Simple PaperVision3D Blurring example : source code
As promised, here is the source code for the simple blurring example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="0x000000"
creationCompleteEffect="Fade"
creationComplete="handleCreationComplete()"
>
<mx:Script>
<![CDATA[
import org.papervision3d.objects.Cube;
//Do the imports
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.objects.Plane;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.core.proto.MaterialObject3D;
public var scene:Scene3D;
public var camera:Camera3D;
public var posX:Number;
public var posY:Number;
public function handleCreationComplete():void
{
camera = new Camera3D( new DisplayObject3D() );//make a camera
camera.zoom = 20;//zoom it
scene = new Scene3D( sceneTarget );//make my scene
//Add my first cube
var c:Cube = scene.addChild( new Cube(null,15,15,200,2,2,2) , "oneCube") as Cube;
//set the container of the cube...
//because I am using "Scene3D" the container isn't automatically created
c.container = sceneTarget;
addEventListener( Event.ENTER_FRAME , handleEnterFrame );
}
public function handleEnterFrame( event:Event ):void
{
posX = (mouseX / width) - 0.5;
posY = (mouseY / height) - 0.5;
var factor:Number = 50;
//get the cube
var c:Cube = scene.getChildByName( "oneCube" ) as Cube;
//blur it
var blur:BlurFilter = new BlurFilter();
blur.blurX = Math.abs( factor * posX );
blur.blurY = Math.abs( factor * posY );
c.container.filters = [blur];
//spin it...
c.rotationX += factor * posY;
c.rotationY += factor * posX;
scene.renderCamera( camera );
}
]]>
</mx:Script>
<mx:Panel
width="100%"
height="100%"
verticalAlign="middle"
horizontalAlign="center"
>
<mx:Canvas
id="sceneTarget"
/>
</mx:Panel>
</mx:Application>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="0x000000"
creationCompleteEffect="Fade"
creationComplete="handleCreationComplete()"
>
<mx:Script>
<![CDATA[
import org.papervision3d.objects.Cube;
//Do the imports
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.objects.Plane;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.core.proto.MaterialObject3D;
public var scene:Scene3D;
public var camera:Camera3D;
public var posX:Number;
public var posY:Number;
public function handleCreationComplete():void
{
camera = new Camera3D( new DisplayObject3D() );//make a camera
camera.zoom = 20;//zoom it
scene = new Scene3D( sceneTarget );//make my scene
//Add my first cube
var c:Cube = scene.addChild( new Cube(null,15,15,200,2,2,2) , "oneCube") as Cube;
//set the container of the cube...
//because I am using "Scene3D" the container isn't automatically created
c.container = sceneTarget;
addEventListener( Event.ENTER_FRAME , handleEnterFrame );
}
public function handleEnterFrame( event:Event ):void
{
posX = (mouseX / width) - 0.5;
posY = (mouseY / height) - 0.5;
var factor:Number = 50;
//get the cube
var c:Cube = scene.getChildByName( "oneCube" ) as Cube;
//blur it
var blur:BlurFilter = new BlurFilter();
blur.blurX = Math.abs( factor * posX );
blur.blurY = Math.abs( factor * posY );
c.container.filters = [blur];
//spin it...
c.rotationX += factor * posY;
c.rotationY += factor * posX;
scene.renderCamera( camera );
}
]]>
</mx:Script>
<mx:Panel
width="100%"
height="100%"
verticalAlign="middle"
horizontalAlign="center"
>
<mx:Canvas
id="sceneTarget"
/>
</mx:Panel>
</mx:Application>
...file attached to for your downloading pleasure...
yes, it is very simple, but I was learning how to work with filters...and nothing else! ;-)

but yer blog messed up the code formatting.
also yer download link is broken. and i have a
quick question...
how does this work w/o importing
import flash.filters.*;
I've tied up the code, and fixed the download (hopefully)
regarding the import:
I don't really know either!
I had a quick look at the docs, and the examples in there included an import...
I relied on the IDE to do the required imports, so didn't notice this until you mentioned it.
It just displays an empty window when I run it.
I thing the PV3D code has changed from when I created this sample.
I think it may be something to do with the materials on the cube, and that they default to "null" now.
This code example is out of date now, and I'm not sure what version of PV3D it was compiled with.
Regarding the version of PV3D I comipled this on, when I checked the related post, I said there I had done it on RC1, and that the next release "broke" it