Get the App
SLTechnology News&Howtos  ›  Development  › 

How to understand the data exchange between Flex pop-up window and child parent Flex window

Shulou Source: shulou.com Published: 2022-06-02 11:38:45 10月03日 Update

This article to share with you is about how to understand Flex pop-up window implementation and child parent Flex window data exchange, Xiaobian think quite practical, so share for everyone to learn, I hope you can read this article after harvest, not much to say, follow Xiaobian to see it.

Implementation of Flex Pop-up Window and Data Exchange between Child and Parent Flex Window

Flex uses PopUpManager.createPopUp(parent,class,modal[,initobj,outsideEvents]) to create a parent child Flex window. The parameters of this function are described as follows:

parent A reference to the Flex window in which the pop-up Flex window is located.

class A reference to the class of the object to be created.

modal A Boolean value indicating that the Flex window is true or false.

initobj An object containing initialization properties. This parameter is optional.

OutsideEvents A Boolean value that indicates whether (true) or (false) the event is triggered when the user clicks outside the Flex window. This parameter is optional.

The first three parameters are mandatory and the last two are optional. The second parameter must match the name of your mxml file. The third parameter, if yes, does not allow the parent Flex window to be manipulated until the Flex window is closed. Otherwise, it is allowed.

◆ First we create a page, the key code is as follows:

functionshowWindow(modal) { varpopup=mx.managers.PopUpManager.createPopUp(_root,login,modal,{deferred:true}); }

Then we create a TitleWindow, notice that although it is also an mxml file, its rating element is not Application but TitleWindow, and the rest is the same as before.

The following describes the data exchange of the child parent Flex window.

The parent Flex window gets an instance of the child Flex window when the child Flex window is created, notice the variables I marked with red children. We can use this variable to refer to global variables defined in the child Flex window. For example, I define it as follows in the child Flex window: varname:String="haha";. The variable can be referenced in the parent Flex window using popup.name.

Similarly, in a child Flex window we can use "parent" to refer to variables defined in the parent Flex window, for example I define varage:String="24"; in the parent Flex window. This variable can be referenced in a child Flex window using parent.age.

The above is how to understand the data exchange between Flex pop-up window implementation and sub-parent Flex window. Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Parameters variables data three size object Boolean file more knowledge article practical consistent nothing two event code element global key Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Redmi Shulou Tech Info Docker