tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/493-why-would-a-mediator-not-receive-an-event-from-a-viewRobotlegs: Discussion 2012-02-27T16:34:24Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T18:00:39Z2012-02-24T18:00:39ZWhy would a Mediator not receive an event from a View?<div><p>Have you added break points (or traces) to onRemove() to check
if the mediator is being removed for some reason?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T18:02:32Z2012-02-24T18:32:21ZWhy would a Mediator not receive an event from a View?<div><p>Could it be that the view gets removed/added from/to stage when
you switch between StageDisplayState.NORMAL and
StageDisplayState.FULL_SCREEN and its mediator gets removed/added
too ?<br>
Can you add an event listener in the view for addedToStage
(flash.events.Event.ADDED_TO_STAGE) and removedFromStage
(flash.events.Event.REMOVED_FROM_STAGE) to see if this ist the
case?</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T18:44:57Z2012-02-24T18:44:57ZWhy would a Mediator not receive an event from a View?<div><p>@Shaun: I tried after you suggested, to no avail. Since I have
no plan on removing the mediator, I overrode the onRemove() and put
a breakpoint on super.onRemove(), didnt get anything.</p>
<p>@Ondina: Technically, I am no really going fullscreen, even
though I use the terminology. I just expand the
MultiTouchVideoPlayer to fit the screen, bring in over the other
children, then hide the menu that is over all that. This part
works. When I collapse, the video player goes bak to its original
size, all the other children are visible and available, but since
the mediator does not receive the event, I cannot tell the menu
(another view with its own mediator) to go back on screen.</p>
<p>Conceptually, I have been wondering about what's the best way to
have views talk to each other. Since no data is to be exchanged, is
it ok to simply have the mediator do
eventDispatcher.dispatch(SomeEvent.EVENT) and then another mediator
listen to the eventDispatcher, or is it better to have a model
change state, and then all mediators that need to listen to that
change do so? Currently, I tried both options and now am using the
latter.</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T19:21:21Z2012-02-24T19:21:21ZWhy would a Mediator not receive an event from a View?<div><p>Stupid question: could TweenMax affect anything in that flow? Or
could the fact that I am using FP 11.2 beta?</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T19:32:33Z2012-02-24T19:32:33ZWhy would a Mediator not receive an event from a View?<div><p>I also thought that TweenMax could do that, so I tried it 10
minutes ago:)<br>
It doesn’t add or remove the views.<br>
Are you sure you don’t switch between some states
somehow?<br>
Is the view dispatching the events a subview of the mediated
view?<br>
How does your custom event class look like? Can you paste it in
here?</p>
<p>As for FP 11.2 beta, I have no idea if it can be the cause of
the issue.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T19:47:26Z2012-02-24T19:47:26ZWhy would a Mediator not receive an event from a View?<div><p>Try to dispatch another custom event from the view, that is not
related to the VideoPlayer stuff, to see if the mediator can hear
it.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T19:59:36Z2012-02-24T19:59:36ZWhy would a Mediator not receive an event from a View?<div><p>I have tried a couple of things here:</p>
<ul>
<li>revert to FP v11.1</li>
<li>rename my custom class event (either the class itself, or the
event type constant)</li>
<li>dispatch any event at all (I tried Event.SOUND_COMPLETE, just
to see, didn't work)</li>
</ul>
<p>These things did not work. Below is the current event class:</p>
<pre>
<code>package com.f4.slideshowss12.event
{
import flash.events.Event;
/**
* @author Mat Janson Blanchet
*/
public class MultiTouchVideoPlayerEvent extends Event
{
public static const COLLAPSE :String = "COLLAPSE";
public static const EXPAND :String = "EXPAND";
public static const TOUCH :String = "TOUCH";
public function MultiTouchVideoPlayerEvent ( type:String,
bubbles:Boolean = false,
cancelable:Boolean = false
)
{
super(type, bubbles, cancelable);
}
override public function clone():Event
{
return new MultiTouchVideoPlayerEvent(type, bubbles, cancelable);
}
}
}</code>
</pre>
<p>As for switching states, I am trying to achieve that :) I will
add more traces along the way. I tried a couple of different
breakpoints, but it did not clarify anything.</p>
<p>At first, the mediated view was just redispatching the event a
subview was sending, now I create a new one altogether. Hey, maybe
I should null the event that the handler receives? I'll try
that.</p>
<p>I am loading a Vimeo player in my project, maybe something
conflicts with their classes? I'll try to add some
ApplicationDomain constraints.</p>
<p>Thanks for your time! This is really confusing me as this is not
where I thought I'd hit a wall :P</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T20:19:38Z2012-02-24T20:19:38ZWhy would a Mediator not receive an event from a View?<div><p>The custom event looks fine, indeed :)</p>
<p>I don’t think that’s the issue, but just try to set
bubbles=true</p>
<blockquote>
<p>dispatch any event at all (I tried Event.SOUND_COMPLETE, just to
see, didn't work)</p>
</blockquote>
<p>Can you try to dispatch that event from a really simple view,
having just a button inside?</p>
<blockquote>
<p>I am loading a Vimeo player in my project, maybe something
conflicts with their classes? I'll try to add some
ApplicationDomain constraints.</p>
</blockquote>
<p>Good look! And please let us know about your findings.<br>
Sorry for not being able to help you. I have to go now. Maybe Shaun
or someone else will give you more hints.<br>
Cheers,<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T21:13:42Z2012-02-24T21:13:42ZWhy would a Mediator not receive an event from a View?<div><p>Just a quickie: you're specifying <code>VideoPlayerEvent</code>
as the concrete event type when mapping with the EventMap, but the
event code you posted was for
<code>MultiTouchVideoPlayerEvent</code>. When specifying a concrete
event, the EventMap will ignore events that aren't that exact
concrete type. Could this be the issue?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T21:19:06Z2012-02-24T21:19:06ZWhy would a Mediator not receive an event from a View?<div><p>Oh, no that's not it. I posted the most recent version of that
class. As I mentioned in my previous reply, I tried renaming the
class or constants, in case they were conflicting with who knows
what.</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T21:20:29Z2012-02-24T21:20:29ZWhy would a Mediator not receive an event from a View?<div><p>Is there a way that I could send you my src directory directly?
(rather than posting it publicly here?) I mean that may help, that
may not either</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T22:13:10Z2012-02-24T22:13:10ZWhy would a Mediator not receive an event from a View?<div><p>I’m going to change the discussion to private. You can
attach a zip file. After that I’ll delete the attachment and
change the discussion to public again. OK?</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T22:14:46Z2012-02-24T22:14:46ZWhy would a Mediator not receive an event from a View?<div><p>This works with me. Thanks!</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T22:42:21Z2012-02-24T22:42:21ZWhy would a Mediator not receive an event from a View?<div><p>There is the full project. It has been built with FDT.</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T22:44:05Z2012-02-24T22:44:05ZWhy would a Mediator not receive an event from a View?<div><p>You may not be able to expand the videos as multitouch is
necessary. I'm using TuioPad <a href=
"http://code.google.com/p/tuiopad/">http://code.google.com/p/tuiopad/</a>
to be able to do so.</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T22:50:54Z2012-02-24T22:50:54ZWhy would a Mediator not receive an event from a View?<div><p>Cool, could you give some quick instructions for reproducing the
bug</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T22:58:53Z2012-02-24T22:58:53ZWhy would a Mediator not receive an event from a View?<div><p>There is a library missing. I can’t make it work;)</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:00:36Z2012-02-24T23:00:36ZWhy would a Mediator not receive an event from a View?<div><p>Yes!</p>
<p>If you have TuioPad installed on your phone, makes sur that in
the header part, the host says "incoming connection", that's by
clicking on the TCP button. Also, there is a message that says
"current network adress is...", that adress should be put into
deploy/flash-config.xml in the humanInterface ip attribute. You may
also set the scale and fps to fit your screen.</p>
<p>A menu is visible on the right when you load the app. Keep your
finger down (or mouse) on the video section until the timer fills
up. The video thumbnails will slide in. Here you do need
multitouch, for you need to reverse pinch the thumbs to expand the
video. At that moment, the menu hides automatically. When you pinch
once in fullscreen mode, the video reverts to small mode, this is
where the collapse event should fire but does not, leaving the menu
out of sight.</p>
<p>I hope that is helpful :)</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:05:22Z2012-02-24T23:05:22ZWhy would a Mediator not receive an event from a View?<div><p>Can you tell me what could be missing? All is included. Attached
is an image that shows all the libraries that should be there and
added to class paths. The closed directories are not used yet.</p>
<p>You're awesome for helping me!</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:08:02Z2012-02-24T23:11:39ZWhy would a Mediator not receive an event from a View?<div><blockquote>
<p>Can you tell me what could be missing?</p>
</blockquote>
<p>everything under net.jansensan</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:10:58Z2012-02-24T23:10:58ZWhy would a Mediator not receive an event from a View?<div><p>For real? It should be there in the export... odd, anywho, here
is the swc that should be in the libs/as3jansensanlib directory</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:11:24Z2012-02-24T23:11:24ZWhy would a Mediator not receive an event from a View?<div><p>I got it, but I won't be able to use TuioPad though.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:12:18Z2012-02-24T23:12:18ZWhy would a Mediator not receive an event from a View?<div><blockquote>
<p>Here you do need multitouch, for you need to reverse pinch the
thumbs to expand the video. At that moment, the menu hides
automatically. When you pinch once in fullscreen mode, the video
reverts to small mode, this is where the collapse event should fire
but does not, leaving the menu out of sight.</p>
</blockquote>
<p>Where do these things happen in the code?</p>
<p>I don't think I'll be able to get this up and running locally -
too many pieces, and I don't have a phone to test on. Nevertheless,
I'm sure we can get to the bottom of it.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:17:40Z2012-02-24T23:17:40ZWhy would a Mediator not receive an event from a View?<div><p>It happens in the com.f4.slideshowss12.view.videoboard
package.</p>
<p>VideoBoardMediator is the mediator<br>
VideoBoard is the mediated view<br>
MultiTouchVideoPlayer is a subview of VideoBoard<br>
VimeoPlayer is a subview of MultiTouchVideoPlayer</p>
<p>MultiTouchVideoPlayer.dispatchExpand and
MultiTouchVideoPlayer.dispatchCollapse are the functions that
initially send the event.</p>
<p>VideoBoard.videoExpandCollapseEventHandler() receives them and
redispatches them to its mediator. The mediator dispatches the
event further for commands. These are mapped in the
com.f4.slideshowss12.controller.InitAppCommand class</p>
<p>This will function only once the video is expanded, the full
process works. Then afterwards visually the video can expand, but
the events dont travel</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:19:21Z2012-02-24T23:19:21ZWhy would a Mediator not receive an event from a View?<div><p>As a test, everywhere where you have
<code>mediatorMap.mapView(..)</code> (and where it makes sense to
do so), try setting autoRemove to false (the last parameter of
mapView), just to be sure that mediators aren't being removed.</p>
<p>Just got your last message, will take a look..</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:30:03Z2012-02-24T23:30:03ZWhy would a Mediator not receive an event from a View?<div><p>So I added those parameters, it works a couple of times now,
then stops again... I guess it must be something I'm doing
wrong?</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:37:45Z2012-02-24T23:37:45ZWhy would a Mediator not receive an event from a View?<div><p>If that's the case, then it sounds like something is being GC'd.
Does VideoBoard ever leave the stage?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:40:02Z2012-02-24T23:40:02ZWhy would a Mediator not receive an event from a View?<div><p>It should not, as I always need it there. And it contains the
videos, which are always visible, I do not take it out of the stage
myself. I'll try something without the Vimeo stuff at all, see if
it interferes. I have put it in it's own application domain, but
that may not be enough.</p></div>jansensantag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:41:57Z2012-02-24T23:41:57ZWhy would a Mediator not receive an event from a View?<div><p>In VideoBoardMediator's onRegister(), where you map the EXPAND
and COLLAPSE handlers with the EventMap, try setting
useWeakReference to false (the final parameter of mapListener). If
that solves the issue then you've got GC issues.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/139618872012-02-24T23:43:58Z2012-02-24T23:43:58ZWhy would a Mediator not receive an event from a View?<div><p>Also, put a trace in the overridden onRemove() just to be sure
that it's not getting called at any point.</p></div>Shaun Smith