how to mediate a view manually ?
I have several modules in my flex project, i load them to
different panels which could be dragged and dropped in one parent
container.
when i want to bring a panel to front, there need to call
setElementIndex(panel,numElements - 1 ) function , it will trigger
RemoveFromStage and AddToStage Event, which cause mediator call
destroy function, and i need reinitialize the mediator.
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
Support Staff 1 Posted by Ondina D.F. on 11 Jan, 2014 12:30 PM
Hello,
Sorry, I haven't noticed your post until today, because you've marked it as private. Is there any reason you want to keep this discussion private, or have you marked it as such by accident?
Re-parenting means the view is removed from stage and then added again. So, its mediator is removed and then created again, and, of course, initialize() is called again.
That shouldn't be an issue for you, unless your mediator is doing more than just adding event listeners in its initialize() method.
If you want to mediate a view manually, you can do this:
https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...
But, I don't see why that is necessary, because as I said, the re-parented view will have its mediator created automatically.
Ondina
2 Posted by foodyi on 17 Jan, 2014 01:15 AM
hi
I had convert this discussion to public, when i pushed this discussion ,i didn't aware i made a private discussion, so sorry.
I think i found the problem, I new a rsl config file for module when module add to stage, when the depth of module was changed, there will trigger add_to_stage event, then my program reinitialize rsl context for the module and the mediator is also initialized. now i listen creationComplete event to initialize rsl context of module , and it works well.
sorry for my poor english. another question, when i debug the project , everything works well. but when i use release version of the project, rsl framework always throw a null pointer error.
Support Staff 3 Posted by Ondina D.F. on 17 Jan, 2014 09:56 AM
Hi,
Try setting the "Framework linkage" to Merged into code, instead of Runtime shared library (RSL) for your modules - under Project- properties - Flex Build Path - Framework linkage
If you did not compile your module in the main application, then maybe you should also try to choose "Do not optimize (module can be loaded by multiple applications)" for your module, under Project - Properties - Flex Modules - Edit Module
I'm using FlashBuilder! Settings may differ in other IDEs
Also, see this article and the replies there: http://forums.adobe.com/message/3835326
and this:
http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-fle...
Also, check the ApplicationDomain of your modules. See these discussions and the links there: http://knowledge.robotlegs.org/discussions/problems/650-robotlegs-m...
http://knowledge.robotlegs.org/discussions/problems/505-loading-rob...
http://knowledge.robotlegs.org/discussions/problems/521-loading-one...
Not sure if that could be an issue too, but try setting the additional compiler arguments like this:
https://github.com/robotlegs/robotlegs-framework/wiki/common-proble...
Let me know how it goes.
Ondina
4 Posted by foodyi on 18 Jan, 2014 03:15 PM
hi Ondina
the release version of my flex project works well, thanks a lot. btw, without these arguments, debug version of my project also works.after i added below compiler arguments :
Support Staff 5 Posted by Ondina D.F. on 20 Jan, 2014 12:20 PM
You're welcome:)
Glad to hear that it works.
Ondina D.F. closed this discussion on 20 Jan, 2014 12:20 PM.