To make Crux work within popups, simply dispatch the ADD_BEAN event for the
content before opening it. For example:
var somePopupContent:SomePopupContent = new SomePopupContent();
dispatchEvent(new BeanEvent(BeanEvent.ADD_BEAN, somePopupContent));
var popup:PopUp = new PopUp();
popup.modal = true;
popup.content = somePopupContent;
addElement(popup);
popup.open = true;
Then, before closing, remove it:
dispatchEvent(new BeanEvent(BeanEvent.REMOVE_BEAN, this));
dispatchEvent(new Event('closePopUp'));
Hope this helps.
Brian
From: Roman Isitua <[email protected]>
Sent: Monday, November 22, 2021 12:33 PM
To: [email protected]
Subject: [EXTERNAL] Re: Crux - ItemRenderer
I can confirm that crux setter injection does not work inside pop up. The work
around I have come up with is to do the setter injection in the parent view
then pass the variable to my pop.
By setter injection I mean,
[Inject( source = "acctController.estateSearchList", bind = "true" )]
public function setEstateSearchList(val:ArrayList):void
{
trace(" injected estateSearchList. hurray !! ");
this.estateSearchList = val;
trace(" estateSearchList has been set ! ");
}
However, I have noticed this style of injection works
[Inject]
public var configData:ConfigData;
Regards,
On Sun, Nov 21, 2021 at 1:07 AM Greg Dove
<[email protected]<mailto:[email protected]>> wrote:
I can't say for certain Maria, because it's been some time since I used Crux.
Are your renderers in the main app, or are they in a popup? Crux may not work
inside a popup, without some tweaking and tuning for JSStageEvents, iirc.
Beyond that I think Crux is not particularly suitable for ItemRenderers. At
least I would personally try to avoid using it in this case, unless the
renderer count is always relatively low.
One of the key differences between the JS implementation vs. the Flash
implementation is when the bean setup is run to support processing the view.
This is triggered by 'addedToStage' event, which does not have directly
comparable support in the browser.
JSStageEvents bead creates a simulated 'addedToStage' event. But the way that
works is asynchronous (delayed) compared to the way it works in flash (which is
synchronous) as soon as the renderer is added to the stage. So that is one
possible reason for things not working the same, because often the code that is
creating the renderers is also explicitly running code in the newly created
renderer instance (like setting data and possibly other calls). It might be
doing this after it has been 'addedToStage' and there is no chance for the
PostConstruct method to run first, because it would be delayed. But if
PostConstruct is never running at all then it could be related to use in a
Popup.
Another thing to check is to make sure the package filtering on the
JSStageEvents is not excluding your renderers from having the simulated events
being created.
On Sun, Nov 21, 2021 at 11:51 AM Maria Jose Esteve
<[email protected]<mailto:[email protected]>> wrote:
Hi, Is there any explanation for the fact that "[PostConstruct]" does not work
in the itemrenderers?
Thx.
Hiedra