Can a view contain another one?

jansensan's Avatar

jansensan

04 Jan, 2012 09:45 PM

Hello all, this is mostly a conceptual question, even though it relates to an actual project onto which I am working.

So, here goes: I usually simply add views to the contextView:

contextView.addChild(new SomeView()); contextView.addChild(new SomeOtherView());

And that usually is quite enough for me. In this case though, I need to work with Away3D, and thus I do not want to add the new views to the contextView, but rather to Away3D's View3D.

At first, I created only an Away3DView class, and within there started to play with the 3D elements, but that became a hassle quickly. It became a big god view, not really what I need.

I thought I'd create a view that would extend Away3D's ObjectContainer3D and associate a Mediator to it. Then came the issue of where does that view get added? Well, within the Away3DView...

_view3D.scene.addChild(new CoverFlowView());

And that's where nothing happens. So here is what I wonder: is it mandatory to add the views to the contextView, or is it conceptually ok for views to contain other views that are themselves also mapped to Mediators?

And if it is ok, is there something that I should look into as of why working this way with Away3D would break the logic?

Thanks!

-mat.

  1. 1 Posted by davidpett on 04 Jan, 2012 10:04 PM

    davidpett's Avatar

    You can add views to any display object. They will be mediated as long as you map the mediator to the view in the context.

  2. 2 Posted by jansensan on 04 Jan, 2012 10:14 PM

    jansensan's Avatar

    Aaah crap...

    Away3D's code explains why my idea doesn't work...:

    public class Scene3D extends EventDispatcher

    Thanks for the help, I'll go back to the original idea. :(

    -mat.

  3. 3 Posted by matt on 06 Jan, 2012 04:11 PM

    matt's Avatar

    yup, your away3d views won't be mediated automatically but you can do it manually

    http://away3d.com/forum/viewthread/273/
    http://www.google.co.uk/search?UTF-8&q=away3d+robotlegs

  4. 4 Posted by jansensan on 06 Jan, 2012 04:14 PM

    jansensan's Avatar

    Oh that is quite interesting! I love that RobotLegs is simple AND deep at the same time :) Thanks!

  5. Ondina D.F. closed this discussion on 03 Feb, 2012 09:42 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac