在 Flashbuilder 中动态填充文本字段

发布于 2024-09-09 11:38:28 字数 473 浏览 1 评论 0原文

我正在努力以我可以使用的方式将数据输入到我的项目中。我想使用 MySQL & PHP 我的 Flashbuilder 应用程序,我没有填充数据网格。

为了简单起见,在我的数据库表中,我有 3 列“ID、标题和内容”
我想用它来填充我的 flashbuilder 项目中的不同状态。

通常在网页中我可以在 sql 语句中说 SELECT * FROM table WHERE ID = 1 要获取第一行信息,我可以将标题和内容放在页面上我想要的位置,

我可以将查询更改为 SELECT * FROM table WHERE ID = 2 来填充第 2 页以获取它标题和内容。

在 flashbuilder 中,所有内容都在同一页面上,我不明白如何使用数据库中的单个字段填充标题或内容区域的单个文本字段。

似乎网络上的所有示例基本上都是针对数据网格的。

有人可以帮我吗?

I'm trying to wrap my brain around getting data into my project in a way that I can use. I want to use MySQL & PHP my Flashbuilder app and I'm not populating a datagrid so.

For simplicities sake, in my database table I have 3 columns "ID, Title & Content".
I want to use this to populate the different states in my flashbuilder project.

Normally in a web page I could say in the sql statement SELECT * FROM table WHERE ID = 1
to get the first row of info and I could put my Title and Content where I want them on my page

I can change the query to SELECT * FROM table WHERE ID = 2 to populate page 2 to get it's title and content.

In flashbuilder it all on the same page and I'm not understanding how to populate a singular text field for a title or content area with a single field from the database.

It seems all the examples on the web are basically for datagrids.

Can someone please help me out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不交电费瞎发啥光 2024-09-16 11:38:28

我会尽力提供帮助。

您有数据库表(ID、标题、内容)。

继续用 PHP 创建一个 Web 服务,它将 ping 数据库并检索数据。我对PHP了解不多,所以无法提供具体信息。如果可能的话,我建议使用 AMFPHP 或 ZendAMF 之类的东西在 Flex 和 PHP 之间来回传输数据。

在 Flex 中,您可以使用 RemoteObject、WebService 或 HTTPService 检索数据。你会以某种方式取回数据。出于本示例的目的,我假设您正在使用 AMF 的一种形式,并且有一个值对象数组。

每个对象都包含一个 ID、标题和内容属性,代表数据库表中的一行。

现在,您如何处理该数组?尝试在单个文本输入中显示数据集合会很奇怪。假设您想要创建一个表单来编辑第一项:

    <Form>
<formItem label="title">
 <textInput id="titleInput" text="{resultsFromPHP[0].title}" />
</formitem>
<formItem label="content">
 <textInput id="contentInput" text="{resultsFromPHP[0].content}" />
</formitem>
<formItem >
 <button label="Process Input" click="processInput()" />
</formitem>
</form>

因此,您有一个允许输入的表单,并且有一个按钮。只需编写点击处理程序:

protected function processInput():void{
 resultsFromPHP[0].content = contentInput.text
 resultsFromPHP[0].title = titleInput.text
 // call other PHP Service to update data
}

这有帮助吗?

这是我在浏览器中编写的伪代码,很可能需要调整才能编译。

I'll try to help.

You have the database table (ID, Title, Content).

Go ahead and create a web service in PHP that will ping the database and retrieve the data. I don't know much about PHP, so can't help with specifics. If possible, I recommend using something like AMFPHP or ZendAMF to transfer data back and forth between Flex and PHP.

In Flex, you can retrieve the data using RemoteObject, WebService, or HTTPService. You'll get the data back somehow. For the purposes of this sample, I'll assume you're using a form of AMF and have an array of value objects.

Each object contains an ID, title, and content property, representing a single row in your database table.

Now, what do you do with that array? It would be odd to try to display a collection of data in a single text input. Let's pretend you want to create a form to edit the first item:

    <Form>
<formItem label="title">
 <textInput id="titleInput" text="{resultsFromPHP[0].title}" />
</formitem>
<formItem label="content">
 <textInput id="contentInput" text="{resultsFromPHP[0].content}" />
</formitem>
<formItem >
 <button label="Process Input" click="processInput()" />
</formitem>
</form>

So, you have a form that allows for inputs, and has a button. Just write the click handler:

protected function processInput():void{
 resultsFromPHP[0].content = contentInput.text
 resultsFromPHP[0].title = titleInput.text
 // call other PHP Service to update data
}

Does that help?

This was psuedo code I wrote in the browser and will most likely need tweaking to compile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文