I got the same problem. Can anyone give some suggestion?

在2009-06-23,duncmcm <dunc...@yahoo.co.uk> 写道:





Hi

I have used the following code to add a flex component into a papervision 
primitive in this case a plane. The flex component is added through the 
papervision material then added to the plane and is interactive ok, IE I can 
still click the button. But the quality of the flex button is very poor.

Does anyone have any idea how to improve this quality?, as I desperately want 
to add flex components into PV3D in my portfolio.

Thanks

Duncan

Test.mxml
=========

<?xml version="1.0? encoding="utf-8??>
<mx:WindowedApplication applicationComplete="initPV3D();" 
xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" verticalScrollPolicy="off" horizontalScrollPolicy="off">
<mx:Script>
<![CDATA[
import org.papervision3d.objects.primitives.Plane; 
import org.papervision3d.materials.MovieMaterial;
import org.papervision3d.cameras.Camera3D; 
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.render.BasicRenderEngine;

private var scene:Scene3D;
private var camera:Camera3D; 
private var material:MovieMaterial; 
private var plane:Plane; 
private var render : BasicRenderEngine;
private var viewPort : Viewport3D;

private function initPV3D():void

{
// create an instance of our component
// note that the component can be already present, created and displaying
// there's no need to be created now
var testComp1 : testComp = new testComp();

// set it's position to be out of the display area (we canno make it
// invisible nor transparent, as any visual changes would show in 3D)
// if you set the layout other than "absolute" then this might not work
testComp1.x = -1000;

// add it to the display list
this.addChild(testComp1);

// create the scene
scene = new Scene3D();

// create the camera
camera = new Camera3D(); 

// create the renderer

render = new BasicRenderEngine();

// create the viewport
viewPort = new Viewport3D();

// set the viewport to be interactive so that our UIComponent in 3D is 
interactive
viewPort.interactive = true;

// add the viewport to the display list
this.rawChildren.addChild(viewPort);

// create our movie material: we make it transparent and <b>animated</b>
// (if it's not animated, we won't see responsiveness on mouse or keyboard
// action nor any changes in display)
material = new MovieMaterial(testComp1, true, true); 

// set it to be interactive
material.interactive = true;

// let's set it to be double sided
material.doubleSided = true;

// create the plane that will hold our component
plane = new Plane(material,900,900,5,5);

// rotate the plane a bit to appear 3D
plane.rotationY = 30;

// add the plane to the scene's display list
scene.addChild(plane);

// listen for the ENTER_FRAME event so that you can render our scene
addEventListener(Event.ENTER_FRAME, enterFrameEvent);
}

private function enterFrameEvent(event:Event):void
{
render.renderScene(scene, camera, viewPort);
}
]]>
</mx:Script>
</mx:WindowedApplication>

TestComp.mxml
=============

<?xml version="1.0? encoding="utf-8??>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; 
width="250" height="250" backgroundColor="#FFEA00">

<mx:Button label="Button" width="80" x="85" y="33" 
click="youClicked(`button');"/>
<mx:HSlider x="10" y="78" width="230" change="youClicked('slider');"/> 
<mx:CheckBox x="10" y="109" label="Checkbox" change="youClicked(`checkbox');"/> 
<mx:RadioButton x="10" y="155" label="Radio" 
change="youClicked(`radioButton');"/> 
<mx:Script>
<![CDATA[
private function youClicked(text : String) : void
{
trace("youClicked: "+text);
}
]]>
</mx:Script>
</mx:Canvas>



Reply via email to