Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-19-2011, 03:52 PM   #1
vancleefus
Registered User
 
Join Date: Mar 2011
Posts: 9
Default How do you launch a link website from Papervision3D?

How do you launch a link website from Papervision3D?

I have a plane with a material on it that I wish to be clickable and that would launch a default browser with the website.

How do I do this? Help please!
vancleefus is offline   Reply With Quote
Old 03-20-2011, 03:00 AM   #2
CMHanna
Member
 
Join Date: Nov 2007
Posts: 53
Default

It's been awhile since I've used Papervision but if I remember correctly the material should have a property called "interactive". Set this to true then add the Papervision mouse click listener, which I think is called something like InteractiveScene3DEvent.MOUSE_CLICK. Inside the listener just use navigateToURL and done.
CMHanna is offline   Reply With Quote
Old 03-20-2011, 06:07 AM   #3
vancleefus
Registered User
 
Join Date: Mar 2011
Posts: 9
Default

Thank you so much for your reply CMHanna! I really appreciate it! I'm really new to AS3 and papervision3D, so I'm finding it hard to understand the fundamentals. Although your answers have given me light, I just don't know how to put them (quite embarrassing actually). Could you help me out a bit more to how or where should I put those lines of code?

Here's my mess:

package {

import flash.display.Sprite
import flash.events.Event;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.materials.shadematerials.FlatSha deMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.materials.WireframeMaterial;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.parsers.Collada;
import org.papervision3d.objects.parsers.DAE;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.controller.AnimationController;
import org.papervision3d.core.animation.clip.AnimationCli p3D;
import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.materials.shaders.GouraudShader;
import org.papervision3d.materials.shaders.ShadedMaterial ;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.core.utils.virtualmouse.VirtualM ouse;
import org.papervision3d.view.Viewport3D;



[SWF(width=640, height=480, backgroundColor=0x808080, frameRate=30)]

public class Earth extends PV3DARApp
{
private var _plane:Plane;
protected var cowisplayObject3D;
protected var materialList:MaterialsList;
protected var bitmapFileMaterial:BitmapFileMaterial;

private var _earthAE;
var earth:AnimationClip3D = new AnimationClip3D("earth",0,6);

var scene:Scene3D;
var renderer:BasicRenderEngine;




public function Earth()
{
addEventListener(Event.INIT, _onInit);
init('Data/camera_para.dat', 'Data/marker.pat');
}

private function _onInit(e:Event):void
{
var _viewport:Viewport3D = new Viewport3D(0, 0, true, true);
_viewport.interactive = true;
_viewport.buttonMode = true;
addChild(_viewport);



var _material = new BitmapFileMaterial("model/images/ClickHere.png");
_material.interactive = true;
_material.oneSide = false;
_material.interactive = true;



_plane = new Plane(_material, 80, 20); // 80mm x 80mm。
_plane.rotationX = 180;
_plane.rotationZ = 90;
_plane.moveRight(300);
_markerNode.addChild(_plane); // attach to _markerNode to follow the marker. / _markerNode に addChild するとマーカーに追従する。



var light:PointLight3D = new PointLight3D();
light.x = 0;
light.y = 1000;
light.z = -1000;
//Create the new Collada Object with materialList
_earth = new DAE();
_earth.load('model/earth.dae');
_earth.scale = 10;
_earth.rotationX = 90;
_markerNode.addChild(_earth);
_earth.addEventListener(Event.ENTER_FRAME, loop);

}
private function loop(e:Event):void {


}
}
}
vancleefus is offline   Reply With Quote
Old 03-20-2011, 01:47 PM   #4
CMHanna
Member
 
Join Date: Nov 2007
Posts: 53
Default

Try this...
ActionScript Code:
import flash.net.*; //add for navigateToURL //I assume you want the plane clickable since it has a click here material :) plane.addEventEventListener(InteractiveScene3DEvent.OBJECT_CLICK, onPlaneClick, false, 0, true); private function onPlaneClick(e:InteractiveScene3DEvent):void { //use navigateToURL here }
CMHanna is offline   Reply With Quote
Old 03-21-2011, 05:19 AM   #5
vancleefus
Registered User
 
Join Date: Mar 2011
Posts: 9
Default

Thank you so much for your help CMhanna! I was able to publish my project and understand a bit more with your example.

Sadly though, nothing happens when I click the object.
vancleefus is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:19 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.