MX2004 components (3): DataHolder

zhaozj2021-02-12  168

An example:

? 1) Built a new file

? 2) Drag a DataHolder and a TextInput component to Stage, named DataHolder_DH, show_txt, respectively

? 3) Select DataHoder_DH, select the Schema label in the Component Properties panel, point the big " " in the upper left corner to add an attribute, fill in the following file? Name column: namestring ,? And in the data? Type column: String

? 4) Keep the status of the DataHolder_DH, open the bindings tag, click " " button, in the pop-up Add? Binding window selected:

NameString: String, point OK

? 5) Points below the Bound? To column, select TextInput in the pop-up Bound? To window,

And select TEXT: String, point OK on the right

? 6) Write in the first frame of the time axis: DataHolder_DH.NameString = "TEST";

? 7) CTRL ENTER

? You will see "Test" in Show_TXT,

? Description: The last example is to create a nameString property to DataHolder to store data (string "test" screen.width / 2) this.width = screen.width / 2 "vSpace = 2 border = 0>, then put this property Bind the text property of TextInput, then TextInput's text property value is the value of DataHolder's nameString. • You can also add multiple properties to DataHolder and assign Different Data? Type, then you can tied data In different components,

If the MVC model is added to this, then DataHolder is C, (it seems to be M), other view? Components (for example: textInput, label) are V? It sets some properties, then put the property value Bind to the View component display (TextInput, Label?, Etc.)? As for the provider of the data, you can customize, can be an array, or other types of data sources (XML, Database ...)

• The popular point of the VIEW component is only responsible for displaying the results. What other components should be displayed, how to display, is controlled by DataHolder. (Of course, there is a custom class " To help finish (:

DataSource ----> DataHolder -------> View? Components? Your own understanding, I also hope to correct.

? http://www.macromedia.com/devnet/mx/flash/articles/databinding.html? This tells some of the DataHoldler usage, but does not speak with Flash? Remoting, and data from XML, Database. Interaction, get started.

转载请注明原文地址:https://www.9cbs.com/read-6304.html

New Post(0)