Mouse Interaction

Software: Away3D 4.x

Avatar
jscamposcr, Newbie
Posted: 09 July 2012 06:48 PM   Total Posts: 20

Hi guys,

Im working on a personal project with Away3D 4.0 but i havent been able to achieve click/rollover/out interactivity, i add MouseEvent3D to the object, make sure it has everything enabled and nothing, it doent fire the mouse event none, any ideas of how to get around it?

   

Richard Olsson, Administrator
Posted: 10 July 2012 09:10 AM   Total Posts: 1192   [ # 1 ]

What Away3D codebase are you using? GitHub or downloaded from the website? What branch, if you’re using Git?

   

Avatar
jscamposcr, Newbie
Posted: 10 July 2012 01:35 PM   Total Posts: 20   [ # 2 ]

Im using the one from the site, do you recommend using the GitHub one? whats the difference?

   

Richard Olsson, Administrator
Posted: 10 July 2012 02:31 PM   Total Posts: 1192   [ # 3 ]

The difference is that only releases are uploaded to the website, i.e. at a single point in time every now and then we zip everything up and put it there. Between releases, the work continues on GitHub, meaning that you’ll always be able to find the most recent code there.

Right now we’re working towards the 4.0 release, and that work is being conducted in the branch called “release” in the GitHub repository. It would be great if you could download that and test your code with that, to make sure that there are no bugs with the mouse picking.

That also means that you will be prepared when the final 4.0 version is released very soon.

   

Avatar
jscamposcr, Newbie
Posted: 10 July 2012 02:35 PM   Total Posts: 20   [ # 4 ]

Thank I will check how that one works and I will let you guys know!

   

Avatar
jscamposcr, Newbie
Posted: 10 July 2012 03:37 PM   Total Posts: 20   [ # 5 ]

Still doesnt work :-(, this is the code that im using:

private function onResourceComplete(ev : LoaderEvent) : void
{
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.removeEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
_loader.addEventListener(MouseEvent3D.CLICK, onObjectClick);

trace(_view.mouseEnabled); //true
trace(_view.mouseChildren); //true
trace(_loader.mouseChildren); //true

_view.scene.addChild(_loader);
}

private function onObjectClick(e:MouseEvent3D):void
{
trace(“mmm hello?”);
}

Everything but the trace works…., I wonder if I have to use the _view.mouseManager at all or create a stage proxy or anything related, please let me know and thank in advance.

   

Avatar
jscamposcr, Newbie
Posted: 10 July 2012 05:28 PM   Total Posts: 20   [ # 6 ]

It seems that it doesnt work with the loader but it does with the meshes inside it, which works for me.

   

Ran, Newbie
Posted: 17 July 2012 07:38 PM   Total Posts: 6   [ # 7 ]

I’m experiencing the same issue as the author, I can’t for the life of me get any mouse interaction events to trigger on my Loader3D object.

mouseEnabled and mouseChildren are returning true in my case as well.

I’m using the 4.0.0 beta build (swc release) from the downloads section of the main page, Flex SDK 4.6.0 and playerglobal.swc 11.3 (latest from Adobe)

I’ve tried both the flash.events.MouseEvent as well as the away3d.events.MouseEvent3D, but neither are producing any results.

How can I bind it to the mesh? I tried looping through all of Loader3D’s children and binding my listeners on them as well, but it still doesn’t work.

Should I not be using Loader3D on the scene? It’s what I picked up from the vase tutorial.

   

Avatar
Fabrice Closier, Administrator
Posted: 17 July 2012 07:43 PM   Total Posts: 1265   [ # 8 ]

Away3d 4.0 is now officially released. All your mouseEvent3D issues should now be resolved. You can update from the download section on this site or from the github repo. (look the announcement post on this forum for details or on away blog)

   

Ran, Newbie
Posted: 17 July 2012 07:52 PM   Total Posts: 6   [ # 9 ]

Ah, silly me didn’t notice the new release.. red face

Thanks, but it seems like the new parser broke my vase so I’ll have to postpone this test for now while I try to acquire a new vase somewhere. ^^

Oh and congratulations on the gold, plus the Adobe thing! Great stuff to see Adobe itself backing up Away3D, I love this library! Keep up the good work, guys.

   

Ran, Newbie
Posted: 18 July 2012 01:09 PM   Total Posts: 6   [ # 10 ]

After doing some more testing with the new release, unfortunately I still can’t get MouseEvent3D to trigger on Loader3D, but it does work on a Mesh object as stated by the author, the Loader3D blocks mouse interaction for the Mesh behind it too, but it won’t trigger events itself with both mouseEnabled and mouseChildren set to true. Maybe a bug?

   

Avatar
jscamposcr, Newbie
Posted: 18 July 2012 02:19 PM   Total Posts: 20   [ # 11 ]

Hey Ran,

Just go to GitHub and download the latest version from there, the files here in the site are the official releases, the updates that are done to the files are hosted on GitHub, that solved my problem.

Regards!
JsC

   

Ran, Newbie
Posted: 18 July 2012 02:41 PM   Total Posts: 6   [ # 12 ]

Did it fix the problem on Loader3D specifically? Because it still won’t work for me even with the latest files from github master branch.. I must be doing something wrong then.

I’m using FlashDevelop 4.0.4 RTM, Flex SDK 4.6.0 with playerglobals.swc 11.3, and now Away3D 4.0.7 fresh from the master branch.

Here’s the _loader specific code from my test project if that’s of any use, both the _loader and _cube show up on the scene, but _loader never fires the click event while _cube does.

_loader = new Loader3D();
   
_loader.mouseEnabled true;
   
_loader.mouseChildren true;
   
_loader.addEventListener(LoaderEvent.LOAD_ERRORonLoadErrorfalse0true);
   
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETEonResourceCompletefalse0true);
   
_loader.addEventListener(MouseEvent3D.MOUSE_DOWNonClickObjectfalse0true);
   
_loader.load(new URLRequest("../lib/onkba.awd"));

   
_cube = new Mesh(new CubeGeometry());
   
_cube.mouseEnabled true;
   
_cube.addEventListener(MouseEvent3D.CLICKonClickObjectfalse0true);
   
_view.scene.addChild(_cube); 
private function onResourceComplete(e:LoaderEvent):void 
  {
   _loader
.removeEventListener(LoaderEvent.LOAD_ERRORonLoadError);
   
_loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETEonResourceComplete);
   
_loader.scale(8);
   
_view.scene.addChild(_loader);
  
private function onClickObject(e:MouseEvent3D):void 
  {
   trace
("clicky");
  
   

Avatar
jscamposcr, Newbie
Posted: 18 July 2012 06:35 PM   Total Posts: 20   [ # 13 ]

Add this:

Mesh(_loader.getChildAt(i)).mouseEnabled = true;
Mesh(_loader.getChildAt(i)).mouseHitMethod = 1;

That fixed the problem for me.
Regards!
JsC

   

Ran, Newbie
Posted: 18 July 2012 07:34 PM   Total Posts: 6   [ # 14 ]

Yeah, although a bit of a dirty method, it works.. mouseHitMethod gives out the following error though:

ErrorAccess of possibly undefined property mouseHitMethod through a reference with static type away3d.entities:Mesh

So I commented it out and with the new away3d releases it works with just the mouseEnabled set true by looping each child of the Loader3D, but wouldn’t the intended functionality be to just enable mouse interactivity on the Loader3D object itself?

If you have to explicitly go through each child of the container, casting them as ‘away3d.entities.Mesh’ just so you can enable mouse on the contents of the Loader3D container that already has mouseEnabled and mouseChildren set to ‘true’, I think that’s not the right way of accomplishing this, especially when Loader3D is supposed to be the easy approach from what I understand.

I’d say it’s not desired at least, but it works, for myself though I’ll avoid Loader3D in the future and instead look further into creating a Mesh out of geometry loaded via the AssetLibrary as seen in some of the recent examples.

Thank you all for your help though, and long live Away3D and Flash/AIR!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X