[Papervision3D] Added a FlexFocus example to the repository

David Rorex drorex at gmail.com
Mon Feb 26 18:06:58 EST 2007


Hello,

Thanks for the examples. I have also created a Main.as file, so people can
see how to compile Papervision3D files in an as3-only context (not using any
of the flex framework). Basically, with this file, you can compile either
with main.mxml, OR Main.as (both work with the free Flex 2 SDK)

This required 1 line change to the FocusApp.as file.

Also, the comment at the top of the files are for people using FlashDevelop
as their IDE, it means you can compile&run directly, by only pressing
Ctrl+F8. Of course, you will need to adjust the path first to point at your
installation of Papervision3D source files.

-David R

Index: as3/examples/FlexFocus/src/Main.as
===================================================================
--- as3/examples/FlexFocus/src/Main.as    (revision 0)
+++ as3/examples/FlexFocus/src/Main.as    (revision 0)
@@ -0,0 +1,40 @@
+/**
+* @mxmlc -sp+=as3\src -use-network=false
+*/
+
+
+package
+{
+import flash.display.Sprite;
+import org.papervision3d.flex.FocusApp;
+import org.papervision3d.flex.Canvas3D;
+
+
+[SWF(width="640", height="480", backgroundColor="#000000", frameRate="30")]
+public class Main extends Sprite
+{
+
+    private var focusApp:FocusApp;
+    private var paperCanvas:Sprite;
+
+    public function Main()
+    {
+        paperCanvas = new Sprite();
+        addChild(paperCanvas);
+
+        // center the canvas
+        paperCanvas.x = stage.stageWidth/2;
+        paperCanvas.y = stage.stageHeight/2;
+
+
+        // setup stage properties
+        stage.quality = "MEDIUM";
+        stage.scaleMode = "noScale";
+        stage.align = "TL";
+
+        focusApp = new FocusApp(paperCanvas);
+    }
+
+}
+
+}
\ No newline at end of file
Index: as3/examples/FlexFocus/src/main.mxml
===================================================================
--- as3/examples/FlexFocus/src/main.mxml    (revision 46)
+++ as3/examples/FlexFocus/src/main.mxml    (working copy)
@@ -1,4 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- @mxmlc -sp+=as3\src -use-network=false
+-->
 <mx:Application
     xmlns:mx="http://www.adobe.com/2006/mxml"
     xmlns:flex="org.papervision3d.flex.*"
Index: as3/examples/FlexFocus/src/org/papervision3d/flex/FocusApp.as
===================================================================
--- as3/examples/FlexFocus/src/org/papervision3d/flex/FocusApp.as
(revision 46)
+++ as3/examples/FlexFocus/src/org/papervision3d/flex/FocusApp.as
(working copy)
@@ -50,7 +50,7 @@

         private function init():void
         {
-            var s:Stage = Application.application.stage;
+            var s:Stage = pv3dSprite.stage;
             s.quality = StageQuality.MEDIUM;

             s.addEventListener(Event.ENTER_FRAME, onEnterFrame);


On 2/26/07, Ralph Hauwert <r.hauwert at gmail.com> wrote:
>
> Hi List!
>
> After seeing more and more people ask on the what and how in terms on
> how to get PV3D to work in Flex, I converted Carlos's example to a
> Flex example and added it to the repo.
> It will show a very simple and crude example of how to incorporate
> PV3D in your Flex App, aswell as point the way on how to compile an AS
> only version of the Focus with the Flex Compiler.
>
> It's in the repo : examples/FlexFocus
>
> --
> Ralph Hauwert
> PaperVision3D
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070226/f95cc314/attachment-0001.htm


More information about the Papervision3D mailing list