Papervision 3D + primitives.addEventListener

Ariranha Messages postés 79 Date d'inscription mercredi 1 août 2007 Statut Membre Dernière intervention 27 juillet 2011 - 6 mai 2010 à 16:37
muyiweiyang Messages postés 1 Date d'inscription samedi 8 mai 2010 Statut Membre Dernière intervention 8 mai 2010 - 8 mai 2010 à 04:18
Bonjour à tous,

Après avoir parcouru des "tonnes" de tutoriels et de post je me décide a poster ma question qui est vraiment très basique.

Comment on met un évènement souris sur une primitive avec papervision3d.
J'ai pourtant bien déclaré :
viewport.interactive = true;
viewport.buttonMode = true;


Ci-dessous le code utilisé qui n'est pourtant pas très complexe :
package {
import flash.events.Event;

import org.papervision3d.view.BasicView;	

import org.papervision3d.objects.primitives.Cube;

import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.events.InteractiveScene3DEvent;

import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.materials.utils.BitmapMaterialTools;

public class MouseInteractionExample extends BasicView
{	
private var FrontTexture:Class;
private var BackTexture:Class;		
private var LeftTexture:Class;

private var materialsList:MaterialsList;

private var cube:Cube;

public function MouseInteractionExample()
{	
stage.frameRate = 40;

init();
startRendering();
}

private function init():void
{			
viewport.interactive = true;
viewport.buttonMode = true;

var grey:ColorMaterial = new ColorMaterial(0xFFFFFF);

var backBook:BitmapFileMaterial = new BitmapFileMaterial("assets/back.jpg");
var frontBook:BitmapFileMaterial = new BitmapFileMaterial("assets/front.jpg");			
var leftBook:BitmapFileMaterial = new BitmapFileMaterial("assets/left.jpg");

frontBook.smooth = true;
backBook.smooth = true;
leftBook.smooth = true;

frontBook.addEventListener(FileLoadEvent.LOAD_COMPLETE, loadComplete);
backBook.addEventListener(FileLoadEvent.LOAD_COMPLETE, loadComplete);
leftBook.addEventListener(FileLoadEvent.LOAD_COMPLETE, loadComplete);

materialsList = new MaterialsList();
materialsList.addMaterial(frontBook, "front");
materialsList.addMaterial(backBook, "back");
materialsList.addMaterial(leftBook, "left");
materialsList.addMaterial(grey, "right");
materialsList.addMaterial(grey, "top");
materialsList.addMaterial(grey, "bottom");

cube = new Cube(materialsList,300,15,450,100);
cube.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,bookClick);
}

private function loadComplete (e:FileLoadEvent):void
{
scene.addChild(cube);		
}

private function bookClick(e:InteractiveScene3DEvent):void
{
trace("_____ok_____");
}

override protected function onRenderTick(e:Event=null):void
{	
//define how far the x mouse and y mouse positions are from the center of the stage
var xDist:Number = mouseX - stage.stageWidth * 0.9;
var yDist:Number = mouseY - stage.stageHeight * 0.5;

//MOVE CAMERA WITHOUT EASING
camera.x = xDist;
camera.y = -yDist; 

super.onRenderTick();
}
}
}


Si quelqu'un pouvait m'éviter de m'arracher le peu de cheveu qu'il me reste je lui en serait bien reconnaissant.

1 réponse

muyiweiyang Messages postés 1 Date d'inscription samedi 8 mai 2010 Statut Membre Dernière intervention 8 mai 2010
8 mai 2010 à 04:18
How to convert DVD to iPhone, DVD to iPhone MP4, DVD to iPhone AVC
1. Add DVD discs
1. Click ?(1)? to input DVDs, all the movie contents will be shown clear as day with title table;
2. Click ?(2)? to cut and merge video for your needs;
3. Select any titles and click ?1? to add more output formats to converted at one time;
4. Click ?2? to delete titles or move movies easily.

2. Powerful function clip, merge and cut video before conversion
1. Click ?1?, pause preview;
2. Click ?2?, to set beginning time;
3. Click ?3?, to set ending time;
4. Click ?4?, to start merging

3. Seclect any output from various video formats in profile


4. Professional ?Profile Settings? for users to edit video?s attribute
1. Support setting different ?Video Size?, ?Video Quality?, ?Channel?, ?Audio Quality?, get various quality converted output files;
2. Support setting video bitrate, zoom for making personal diy videos.

5. Click ?Start? button to rip or convert after all settings.
0
Rejoignez-nous