---
title: "Ext.flash.Component"
description: "xtype 为 flash 的 Ext JS 原生组件参考。"
---

> Documentation Index
> Fetch the complete documentation index at: https://ag.879818327.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Ext.flash.Component

源码定义：`ext-all-debug.js:91184`。分类：基础组件与提示。

## 创建示例

```javascript
var component = Ext.create("Ext.flash.Component", {
  xtype: "flash",
  backgroundColor: '#ffffff',
  expressInstall: false,
  flashVersion: '9.0.115',
  onFailure: Ext.emptyFn,
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `backgroundColor` | `String` | `'#ffffff'` | 配置组件的 `backgroundColor` 选项。 | `backgroundColor: '#ffffff'` |
| `expressInstall` | `Boolean` | `false` | 控制是否启用 `expressInstall` 行为。 | `expressInstall: false` |
| `flashVersion` | `String` | `'9.0.115'` | 配置组件的 `flashVersion` 选项。 | `flashVersion: '9.0.115'` |
| `onFailure` | `Mixed` | `Ext.emptyFn` | 配置 `onFailure` 回调函数。 | `onFailure: Ext.emptyFn` |
| `renderTpl` | `Array` | `['<div id="{swfId}" role="presentation"></div>']` | 配置生成组件内容的 `renderTpl` 模板。 | `renderTpl: ['<div id="{swfId}" role="presentation"></div>']` |
| `swfHeight` | `String` | `'100%'` | 配置组件的 `swfHeight` 选项。 | `swfHeight: '100%'` |
| `swfWidth` | `String` | `'100%'` | 配置组件的 `swfWidth` 选项。 | `swfWidth: '100%'` |
| `wmode` | `String` | `'opaque'` | 配置组件的 `wmode` 选项。 | `wmode: 'opaque'` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `initComponent` | `` | 初始化组件及其子项。 执行时会保留父类默认行为。源码涉及 `callParent()`、`addEvents()`。 | `component.initComponent()` |
| `beforeRender` | `` | 生成 `before` 的渲染结果。 执行时会保留父类默认行为。源码涉及 `callParent()`、`getSwfId()`。 | `component.beforeRender()` |
| `afterRender` | `` | 生成 `after` 的渲染结果。 执行时会保留父类默认行为。源码涉及 `callParent()`、`getSwfId()`。 | `component.afterRender()` |
| `swfCallback` | `e` | 处理 `swfCallback` 操作。 执行时会派发 `success`、`failure` 事件、更新 `swf` 状态。源码涉及 `onSuccess()`、`fireEvent()`、`onFailure()`。 | `component.swfCallback(...)` |
| `getSwfId` | `` | 读取并返回 `swfId`。 执行时会更新 `swfId` 状态。源码涉及 `getAutoId()`。 | `component.getSwfId()` |
| `onSuccess` | `` | 处理 `success` 回调。 | `component.onSuccess()` |
| `beforeDestroy` | `` | 在 `destroy` 前执行预处理。 执行时会保留父类默认行为。源码涉及 `getSwfId()`、`callParent()`。 | `component.beforeDestroy()` |

## 事件

| 事件 | 说明 | 监听示例 |
| --- | --- | --- |
| `failure` | 当前操作失败时触发。 源码在 `swfCallback()` 中通过 `fireEvent()` 触发。 | `listeners: { failure: function () {} }` |
| `success` | 当前操作成功完成后触发。 源码在 `swfCallback()` 中通过 `fireEvent()` 触发。 | `listeners: { success: function () {} }` |

Source: https://ag.879818327.xyz/ext/basic/flash-component/index.mdx
