Archive for December 11th, 2008
Hosting problems
It looks like I’m having some troubles with my hosting for images, source, and example .swfs.
Please be patient while I try to resolve this.
Thanks,
John
*update – Looks like everything is good again. Back to cranking out examples.
Swapping a Plane with a MovieClip
The idea here is to setup your material as normal and bring the plane front and center. When the plane reaches front and center, you put your regular 2d object on top and start it playing (or start interaction, etc.). Then when it’s time to go back into plane form, use plane.material.bitmap.draw(embeddedVideo) to update your material to the latest snapshot of where the video left off.
Don’t get too hung up on the tweening code. It’s not important to the concept.
The .swf is about 2 megs, so be patient while it loads.

source
package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.text.TextFormat; import gs.TweenMax; import gs.easing.Quad; import gs.events.TweenEvent; import org.papervision3d.events.InteractiveScene3DEvent; import org.papervision3d.materials.MovieMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; [SWF(width="640", height="480", backgroundColor="#ffffff", frameRate="60")] public class SwappingPlanesWithMovieClips extends BasicView { private var embeddedVideo:MovieClip = new theoffice(); private var plane:Plane; private var moveForwardTween:TweenMax; private var moveBackTween:TweenMax; private var moveBackObject:Object; private var moveForwardObject:Object; private var isMovingForward:Boolean = true; public function SwappingPlanesWithMovieClips() { camera.focus = 10; camera.zoom = 100; viewport.interactive = true; embeddedVideo.visible = false; embeddedVideo.stop(); embeddedVideo.addEventListener(MouseEvent.CLICK, embeddedVideo_clickHandler); viewport.addChild(embeddedVideo); var initialMovieMaterial:MovieMaterial = new MovieMaterial(embeddedVideo); initialMovieMaterial.interactive = true; plane = new Plane(initialMovieMaterial); plane.x = 500; plane.y = 500; plane.z = 3000; plane.rotationY = 40; plane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, plane_objectClickHandler); scene.addChild(plane); moveForwardObject = {x:0, y:0, z:0, rotationY:0, ease:Quad.easeInOut}; var time:Number = 2; moveForwardTween = new TweenMax(plane, time, moveForwardObject); moveForwardTween.addEventListener(TweenEvent.COMPLETE, moveForwardTween_completeHandler); startRendering(); } private function toggleDirection():void { isMovingForward = !isMovingForward; } private function moveForwardTween_completeHandler(event:TweenEvent):void { if(isMovingForward) { embeddedVideo.visible = true; embeddedVideo.play(); toggleDirection(); } } private function plane_objectClickHandler(event:InteractiveScene3DEvent):void { toggleDirection(); moveForwardTween.reverse(); } private function embeddedVideo_clickHandler(event:MouseEvent):void { plane.material.bitmap.draw(embeddedVideo); embeddedVideo.visible = false; embeddedVideo.stop(); moveForwardTween.reverse(); } } }
Also, you can watch that clip of “The Office” here: http://www.hulu.com/watch/47992/the-office-the-surplus—magic-tricks
Search
Recommended Books
Speaking at FITC Toronto
Recent Posts
- FDT Super Awesome March Deal
- haXe Tutorial
- AS3 Signals Tutorial
- Preferred Video Tutorial Resolution?
- TweenMax – Tweening a timeline (Advanced Tweening)
- Robotlegs + Flight + Union Platform
- Back in the saddle
- Eclipse Theme Designer Preview
- RobotLegs Hello World Video Tutorial
- 10 Things Every Senior Flash Developer Should Know
- Efflex – 3D Effects for Flex
- MorphController – Mighty Morphing Papervision3D
- End dump
- Test if a plane is within the view of the camera (aka testing if culled)
- Materials Reference
Recent Comments
- John Lindquist on ActionScript 3 – Model View Controller (MVC)
- Bruno Fonzi on FDT Super Awesome March Deal
- KD on ActionScript 3 – Model View Controller (MVC)
- BAM5 on haXe Tutorial
- AlexG on Finding 2D Coordinates of a DisplayObject3D
- Josh on ActionScript 3 – Model View Controller (MVC)
- martin everett on requests
- martin everett on requests
- lillacska on Dragging Spheres
- Guy Ritchie on MXML without the Flex framework
Categories
Archives
Preferred Video Tutorial Resolution
- 1024x768 (53%, 85 Votes)
- 1280x1024 (15%, 24 Votes)
- 1920x1080 (15%, 24 Votes)
- 800x600 (13%, 20 Votes)
- 480x320 (4%, 6 Votes)
- 640x480 (0%, 2 Votes)
Total Voters: 160

