[Papervision3D] PV3D 2.0 - using a SimpleButton created in Flash IDE : no states, no hand cursor
Rob Bateman
rob.bateman at gmail.com
Fri Dec 21 16:29:02 PST 2007
Hey Vincent
simplebutton interaction will work if you use the Away3d engine. You can
use MovieMaterial with interactive set to true, and everything should work
in the correct manner. go to away3d.com for more details of downloads etc
atb
Rob
On Dec 13, 2007 2:53 PM, Ralph Hauwert <r.hauwert at gmail.com> wrote:
> UIComponents need to be on added to a stage, otherwise they don't work;
> it's the way they are designed.
>
>
> On Dec 12, 2007 5:09 PM, Vincent Maitray < vincent at electrofrog.com> wrote:
>
> > Hi,
> >
> > I have been using PV3D Great White for a few days, and I'd like to use
> > a SimpleButton created in Flash IDE.
> > This button is inside a MovieClip being used as MovieAssetMaterial
> > applied on a Plane... The problem is that I can't see the states of
> > the button nor I can see the hand cursor...
> > I tried to do the same with a MovieClip created by code and used as a
> > SimpleButton and it worked ( but the useHandCursor property doesn't
> > seems to work either ).
> >
> > Is there a way to do this ?
> > Thanks for your help.
> >
> > btw : this my first post here so many thaks to the developpers for
> > PV3D... ^_^
> >
> > Here is my code :if it helps :
> >
> > Vincent Maitray
> >
> > package
> > {
> >
> > import flash.display.MovieClip;
> > import flash.display.SimpleButton;
> > import flash.display.Sprite;
> > import flash.display.StageAlign;
> > import flash.display.StageScaleMode;
> > import flash.events.Event;
> > import flash.events.MouseEvent;
> > import flash.utils.getQualifiedClassName;
> >
> > import org.papervision3d.cameras.Camera3D;
> > import org.papervision3d.materials.MovieAssetMaterial;
> > import org.papervision3d.objects.DisplayObject3D ;
> > import org.papervision3d.objects.primitives.Plane;
> > import org.papervision3d.render.BasicRenderEngine;
> > import org.papervision3d.scenes.Scene3D;
> > import org.papervision3d.view.Viewport3D ;
> >
> > public class Main extends Sprite
> > {
> >
> > private var viewport1 : Viewport3D;
> > private var scene1 : Scene3D;
> > private var camera1 : Camera3D;
> > private var renderer1 : BasicRenderEngine;
> > private var plane1 : Plane;
> > private var plane2 : Plane;
> > private var plane3 : Plane;
> > private var mam1 : MovieAssetMaterial;
> > private var mam2 : MovieAssetMaterial;
> > private var mam3 : MovieAssetMaterial;
> > private var child1:MovieClip;
> >
> > private var card : DisplayObject3D;
> >
> > public function Main()
> > {
> >
> > stage.align = StageAlign.TOP_LEFT;
> > stage.scaleMode = StageScaleMode.NO_SCALE;
> >
> > init();
> >
> > }
> >
> > private function init():void
> > {
> >
> > viewport1 = new Viewport3D( 0, 0, true, true,
> > true, true );
> > viewport1.interactive = true;
> > addChild( viewport1 );
> >
> > scene1 = new Scene3D( true );
> >
> > camera1 = new Camera3D();
> > camera1.zoom = 11;
> >
> > renderer1 = new BasicRenderEngine();
> >
> > // the card object
> > card = new DisplayObject3D();
> > card.name = "card";
> >
> > // front & back face of the card
> > mam1 = new MovieAssetMaterial( "CardFront", true,
> > true, false,
> > true );
> > mam1.smooth = true;
> > mam1.doubleSided = true;
> > mam1.interactive = true;
> >
> > // referencing the MovieClip inside mam1
> > var mc1:MovieClip = MovieClip( mam1.movie );
> >
> > // adding a MovieClip
> > child1 = new MovieClip();
> > child1.name = "child1";
> > child1.graphics.beginFill( 0xFF0000, 100 );
> > child1.graphics.drawRoundRect( 10, 10, 100, 50,
> > 8, 8 );
> > child1.graphics.endFill();
> > child1.buttonMode = true;
> > mc1.addChild( child1 );
> >
> > child1.addEventListener( MouseEvent.MOUSE_OVER,
> > handleButtonOver );
> > child1.addEventListener ( MouseEvent.MOUSE_OUT,
> > handleButtonOut );
> > child1.addEventListener( MouseEvent.CLICK,
> > handleButtonClick );
> >
> > // referencing a SimpleButton ---- this doesn't
> > work
> > var spade:SimpleButton = ( mc1.getChildByName(
> > "spadeButton" ) as
> > SimpleButton );
> >
> > plane1 = new Plane( mam1, 120, 175, 2, 2 );
> > card.addChild( plane1 );
> >
> > scene1.addChild( card );
> >
> > this.addEventListener( Event.ENTER_FRAME, render
> > );
> >
> > }
> >
> >
> >
> > //////////////////////////////////////////////////////////////////////////
> > handling
> > button states
> > private function handleButtonOver( pEvt:MouseEvent ):void
> > {
> >
> > pEvt.currentTarget.alpha = 0.5;
> > trace( "over" );
> >
> > }
> >
> > private function handleButtonOut( pEvt:MouseEvent ):void
> > {
> >
> > pEvt.currentTarget.alpha = 1;
> > trace( "out" );
> >
> > }
> >
> > private function handleButtonClick( pEvt:MouseEvent
> > ):void
> > {
> >
> > pEvt.currentTarget.alpha = 1;
> > trace( "click" );
> >
> > }
> >
> >
> > //////////////////////////////////////////////////////////////////////////
> > rendering
> > private function render( pEvt : Event ) : void
> > {
> >
> > plane1.yaw( 1 );
> > renderer1.renderScene( scene1, camera1, viewport1
> > );
> >
> > }
> > }
> > }
> >
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
>
>
>
> --
> Ralph Hauwert
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
--
Rob Bateman
Flash Development & Consultancy
rob.bateman at gmail.com
www.infiniteturtles.co.uk
www.away3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20071222/9d44f059/attachment-0001.html
More information about the Papervision3D
mailing list