tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/760-need-the-shared-eventdispatcher-inside-my-mxml-specific-reasonRobotlegs: Discussion 2016-11-07T17:06:28Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-10T00:41:55Z2013-01-14T15:20:35ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>I have an embedded mp3 file that I am including in my app for
connection testing purposes, it will send a file to the server
validate md5's and respond back..</p>
<p>The only way I can get the bytearray of the embedded mp3 is
doing it inside the MXML. I know this sounds crazy however I've
researched tons and tried many different things.. Feel free to test
yourself :)</p>
<p>I'm trying to dispatch events inside of this MXML instead of
using a mediator as I generally do. But I can't seem to figure out
how to get my shared event dispatcher into the MXML.. I have tried
a few different things that failed..</p>
<p>Thanks in advance!</p></div>Josh Hartzelltag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-11T20:51:33Z2013-01-11T20:51:33ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Hello Josh,</p>
<p>That does sound crazy! Got any links, or example code, that
shows it working in MXML but not plain AS3? Anyhoo..</p>
<p>Can't you just pass the event dispatcher through to the
component from the Mediator? If you don't want to do that you could
inject the <code>IEventDispatcher</code> directly into the
component by using the ViewMap (RL1) or the ViewProcessorMap
Extension (RL2).</p>
<p>Hope that helps!</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-13T20:58:33Z2013-01-14T15:20:35ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>I guess it didn't, I'll post it again :P..</p>
<p><a href=
"http://blog.somepixels.net/2010/01/how-to-get-bitmapdata-and-bytearray-from-embed-in-flex/">
http://blog.somepixels.net/2010/01/how-to-get-bitmapdata-and-bytear...</a></p>
<p>Give that link a try in a new flex project, try it inside the
MXML first to see it working correctly, then try it inside AS3. I
didn't actually try this exact example because I am embedding an
mp3 so it's a bit different however my above statement holds
true.</p>
<p>Also would it be possible for you to give a small example of the
ViewProcessorMap extension? I've never used it and am using
RL2.</p></div>Josh Hartzelltag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-13T21:00:04Z2013-01-13T21:00:04ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Did you respond to my response? If so, it doesn't look like it
came through.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-13T22:46:23Z2013-01-14T15:20:35ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>I tried posting a response like 20 minutes after your response
and said it had to be processed but it never showed up..</p>
<p>I have a link but I think that is what is blocking my post from
posting.. this is the post without the link.</p>
<p>That is an example of an embedded img file and using BitMapData,
I havent actually tried it with a img but you can reproduce this
functionality with an MP3 and then try to get the bytearray from
the embedded mp3, I was unable to do it unless it was inside the
MXML..</p>
<p>Anywho, could you possibly show a few examples of your solution
and also maybe show an example of how the ViewProcessorMap is used?
I'm a little confused, how would I pass the eventDispatcher from my
mediator to the view?</p></div>Josh Hartzelltag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-13T23:02:22Z2013-01-13T23:02:22ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Hi Josh,</p>
<p>your messages have been marked as spam for some reason. I've
restored them. Hopefully, everything will be ok from now on.</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-13T23:27:52Z2013-01-14T15:20:35ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>I'm sorry about that! :P You can delete a few of the duplicates
if you like just delete the ones that are more convoluted, keep the
one you understand :P I was just trying different alterations to
see if something I was doing in the form was illegal or failing
moderation validation haha.</p></div>Josh Hartzelltag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-14T11:16:34Z2013-01-14T11:16:34ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Hey Josh,</p>
<p>Don’t be sorry! We are sorry for the inconvenience :) Your
last message has been marked as spam again. The moderation you were
talking about is not coming from our staff, but from Tender Support
(the app hosting our forum).<br>
If it's not too much trouble, would you mind creating an account?
You’re listed as an anonymous user. Hopefully, as a
registered user your posts won’t be marked as spam again.</p>
<p>Regarding your question about the ViewProcessorMapExtension,
I’ve never used it until now, but I’ll give it a
try:</p>
<p>In your context config class:</p>
<p>context.install( ViewProcessorMapExtension );</p>
<p>Depending on how your config class looks like, you either do
this:</p>
<p>[Inject] public var viewProcessorMap:IViewProcessorMap;</p>
<p>or this:</p>
<p>private var viewProcessorMap:IViewProcessorMap;<br>
viewProcessorMap = injector.getInstance(IViewProcessorMap);</p>
<p>Then:</p>
<p>viewProcessorMap.map(ViewWithoutMediator).toInjection();</p>
<p>In your ViewWithoutMediator:</p>
<p>[Inject] public var sharedDispatcher:IEventDispatcher;</p>
<p>Somewhere in the view:</p>
<p>sharedDispatcher.dispatchEvent(new
SomeEvent(SomeEvent.SOME_TYPE, "some message"));</p>
<p>Then you add a listener for that event on the shared dispatcher
within the classes that need to react to that event.</p>
<p>If I’m wrong about the usage of viewProcessorMap, Shaun
will surely provide more info or examples.</p>
<p>Cheers,<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-14T15:11:46Z2013-01-14T15:11:47ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Not a problem at all fellas, I appreciate the help tremendously.
I have fallen in love with RobotLegs and its' simplicity. It has
taken AS3 and Flex from being a language I despise to a language I
actually enjoy working with. Thanks for such a great framework!</p>
<p>As for the technical details; thanks so much again! This looks
great I will give it a shot!</p></div>Josh Hartzelltag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-14T22:36:45Z2013-01-14T22:36:45ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Thanks for the kind words Josh!</p>
<p>If you need any other info on the ViewProcessorMap you can have
a read through:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/tree/master/src/robotlegs/bender/extensions/viewProcessorMap">
https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...</a></p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-14T22:39:44Z2013-01-14T22:39:44ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Btw, what IDE are you using? If you're using FB4.7 then it's
possible that you'd be compiling plain as3 projects with ASC2. ASC2
might have a bug related to Embedding. When switching to MXML you'd
then be switching to the legacy compiler (mxmlc) which does not
have such a bug. Just thinking aloud.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-15T01:25:15Z2013-01-15T01:25:43ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>I've just recently switched over to IntelliJ and I'm in love ;)
-- I did think of that possibility but it wasn't the issue in
4.6</p></div>Josh Hartzelltag:robotlegs.tenderapp.com,2009-10-18:Comment/236600482013-01-22T10:25:29Z2013-01-22T10:25:29ZNeed the shared eventDispatcher inside my mxml - specific reason!<div><p>Josh, I'm assuming this is resolved. I’m going to close
this discussion for now, but you can re-open it if need be.</p>
<blockquote>
<p>I have fallen in love with RobotLegs and its' simplicity.</p>
</blockquote>
<p>Me too, a long time ago! And the feelings are still lasting
;-)</p>
<p>If you have other questions about rl2, please don’t
hesitate to open new discussions, preferable under this category:
<a href=
"http://knowledge.robotlegs.org/discussions/robotlegs-2">http://knowledge.robotlegs.org/discussions/robotlegs-2</a></p>
<p>See you around :)</p>
<p>Ondina</p></div>Ondina D.F.