Je viens de réaliser une galerie d'images avec PV3D et AS3.
Tout fonctionne bien sauf...
Je n'arrive pas à rendre mes plane interactives. Je voudrais que lorsque l'on clique sur une image, on atteigne une url. Mais quoi que je fasse, je n'arrive pas à appliquer le click event sur ma plane mais seulement sur le container...
Merci pour votre aide.
Voici mon script :
import flash.events.IMEEvent;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import org.papervision3d.events.*;
import flash.net.URLLoader;
import flash.display.Loader ;
import flash.net.URLRequest;
import org.papervision3d.core.utils.virtualmouse.VirtualMouse;
import org.papervision3d.core.utils.virtualmouse.VirtualMouseMouseEvent
import flash.events.MouseEvent;
import flash.display.Sprite;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.objects.primitives.Plane;
var container:Sprite = new Sprite();
container.x = stage.stageWidth * 0.5;
container.y = stage.stageHeight * 0.5;
addChild(container);
var scene:Scene3D = new Scene3D(container);
var camera:Camera3D = new Camera3D();
camera.zoom = 6;
var mat1:BitmapAssetMaterial = new BitmapAssetMaterial("groupefacilasol.jpg");
mat1.smooth = true;
mat1.oneSide = false;
var mat2:BitmapAssetMaterial = new BitmapAssetMaterial("panneaux.jpg");
mat2.smooth = true;
mat2.oneSide = false;
var mat3:BitmapAssetMaterial = new BitmapAssetMaterial("photovoltaique.jpg");
mat3.smooth = true;
mat3.oneSide = false;
var mat4:BitmapAssetMaterial = new BitmapAssetMaterial("Agriculteurs.jpg");
mat4.smooth = true;
mat4.oneSide = false;
var mat5:BitmapAssetMaterial = new BitmapAssetMaterial("investisseurs.jpg");
mat5.smooth = true;
mat5.oneSide = false;
var mat6:BitmapAssetMaterial = new BitmapAssetMaterial("Particuliers.jpg");
mat5.smooth = true;
mat6.oneSide = false;
var mat7:BitmapAssetMaterial = new BitmapAssetMaterial("pvfix.jpg");
mat7.smooth = true;
mat7.oneSide = false;
var mat8:BitmapAssetMaterial = new BitmapAssetMaterial("rachat.jpg");
mat8.smooth = true;
mat8.oneSide = false;
var mat9:BitmapAssetMaterial = new BitmapAssetMaterial("sma.jpg");
mat9.smooth = true;
mat9.oneSide = false;
var photo1:Plane = new Plane(mat1, 250, 250,9,9);
scene.addChild(photo1);
photo1.x =-300;
photo1.y =150;
photo1.z =-150;
addEventListener(MouseEvent.CLICK, photo1Click);
function photo1Click(e:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.youtube.com"));
}
var photo2:Plane = new Plane(mat2, 250, 250,9,9);
scene.addChild(photo2);
photo2.x =0;
photo2.y =150;
photo2.z =-150;
var photo3:Plane = new Plane(mat3, 250, 250,9,9);
scene.addChild(photo3);
photo3.x = 300;
photo3.y = 150;
photo3.z =-150;
var photo4:Plane = new Plane(mat4, 250, 250,9,9);
scene.addChild(photo4);
photo4.x =-300;
photo4.y =-150;
photo4.z =-150;
var photo5:Plane = new Plane(mat5, 250, 250,9,9);
scene.addChild(photo5);
photo5.x =0;
photo5.y =-150;
photo5.z =-150;
var photo6:Plane = new Plane(mat6, 250, 250,9,9);
scene.addChild(photo6);
photo6.x = 300;
photo6.y =-150;
photo6.z =-150;
var photo7:Plane = new Plane(mat7, 250, 250,9,9);
scene.addChild(photo7);
photo7.x =-300;
photo7.y =-450;
photo7.z =-150;
var photo8:Plane = new Plane(mat8, 250, 250,9,9);
scene.addChild(photo8);
photo8.x =0;
photo8.y =-450;
photo8.z =-150;
var photo9:Plane = new Plane(mat9, 250, 250,9,9);
scene.addChild(photo9);
photo9.x = 300;
photo9.y = -450;
photo9.z =-150;
addEventListener(Event.ENTER_FRAME, render);
function render(e:Event):void
{
camera.x += (((stage.mouseX-(stage.stageWidth * .5))*2)-camera.x )*.05;
camera.y += (((stage.mouseY-(stage.stageHeight*.5))*2)-camera.y )*.05;
scene.renderCamera(camera);
}