| 包 | spark.preloaders |
| 类 | public class SplashScreenImage |
| 继承 | SplashScreenImage Object |
| 实现 | IMXMLObject |
| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4.6 |
| 运行时版本: | AIR 3 |
您通常在 MXML 文件中定义 SplashScreenImage 类。使用 SplahsScreenImageSource 类来定义不同的图像选择和相应的设备配置。然后,将应用程序的 splashScreenImage 属性设置为 SplashScreenImage MXML 组件的名称。
确定与移动设备最匹配的 SplahsScreenImageSource 定义的过程如下:
- 确定与移动设备的设置相匹配的所有 SplashScreenImageSource 定义。发生匹配的条件如下:
- SplashScreenImageSource 定义未显式定义该设置。例如,不存在与任何设备的 DPI 相匹配的
dpi属性设置。 - 对于
dpi或aspectRatio属性,属性必须与相应的移动设备设置完全匹配。 - 对于
minResolution属性,当Stage.stageWidth和Stage.stageHeight属性中的较大者等于或大于minResolution时,属性与设备上的设置相匹配。
- SplashScreenImageSource 定义未显式定义该设置。例如,不存在与任何设备的 DPI 相匹配的
- 如果有一个以上的 SplashScreenImageSource 定义与设备相匹配,则:
- 选择一个显式设置数目最大的定义。例如,同时指定了
dpi和aspectRatio属性的 SplashScreenImageSource 定义的匹配度高于仅指定dpi属性的定义。 - 如果仍有多个匹配,则选择一个
minResolution值最高的匹配项。 - 如果仍有多个匹配,则选择组件中定义的第一个匹配项。
- 选择一个显式设置数目最大的定义。例如,同时指定了
注意::此类不能在应用程序的 MXML 中以内联方式设置。您必须在一个单独的 MXML 文件中定义它并使用应用程序的 splashScreenImage 属性引用它。
隐藏 MXML 语法The <s:SplashScreenImage> tag inherits all of the tag
attributes of its superclass and adds no new tag attributes:
<s:SplashScreenImage xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<!-- Define one or more SplashScreenImageSource. -->
<s:SplashScreenImageSource
source="@Embed('assets/logoDefault.jpg')"/>
<s:SplashScreenImageSource
source="@Embed('assets/logo240Portrait.jpg')"
dpi="240"
aspectRatio="portrait"/>
</s:SplashScreenImage>
默认 MXML 属性mxmlContent
相关 API 元素
公共属性
| 属性 | 由以下参数定义 | ||
|---|---|---|---|
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。 | Object | |
| mxmlContent : Array
SplashScreenImage 的 SplashScreenImageSource 源。 | SplashScreenImage | ||
公共方法
| 方法 | 由以下参数定义 | ||
|---|---|---|---|
构造函数。 | SplashScreenImage | ||
返回与指定的设备参数最匹配的 SplashScreenImageSource 的类。 | SplashScreenImage | ||
![]() |
表示对象是否已经定义了指定的属性。 | Object | |
创建实现对象且初始化在 MXML 标签上指定的所有组件属性后调用。 | SplashScreenImage | ||
![]() |
表示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() |
表示指定的属性是否存在、是否可枚举。 | Object | |
![]() |
设置循环操作动态属性的可用性。 | Object | |
![]() |
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。 | Object | |
![]() |
返回指定对象的字符串表示形式。 | Object | |
![]() |
返回指定对象的原始值。 | Object | |
属性详细信息
mxmlContent | 属性 |
构造函数详细信息
SplashScreenImage | () | 构造函数 |
public function SplashScreenImage()| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4.6 |
| 运行时版本: | AIR 3 |
构造函数。
方法详细信息
getImageClass | () | 方法 |
public function getImageClass(aspectRatio:String, dpi:Number, resolution:Number):Class| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4.6 |
| 运行时版本: | AIR 3 |
返回与指定的设备参数最匹配的 SplashScreenImageSource 的类。
您不要直接调用此方法,它由 Flex 内部调用。
如果您想覆盖选取 SplashScreenImageSource 最佳匹配实例的默认 Flex 逻辑,请在 SplashScreenImage 组件中覆盖此方法。
参数
aspectRatio:String — flash.display.StageAspectRatio.PORTRAIT 或 flash.display.StageAspectRatio.LANDSCAPE,以两者中较大者为准。
| |
dpi:Number — 移动设备的 DPI。
| |
resolution:Number — 移动设备的更大尺寸的分辨率(以像素为单位)。
|
Class — 要显示为启动屏幕图像的图像的 Class。
|
相关 API 元素
initialized | () | 方法 |
示例 如何使用本示例
DynamicSplashScreenExample1.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView="views.DynamicSplashScreenExample1HomeView"
splashScreenImage="SplashScreenImage1">
</s:ViewNavigatorApplication>
DynamicSplashScreenExample1HomeView.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:View>
SplashScreenImage1.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:SplashScreenImage xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
[Embed("soccer-ball.jpg")]
private var andImage:Class;
override public function getImageClass(aspectRatio:String, dpi:Number, resolution:Number):Class
{
// Are we running on IOS ?
if (Capabilities.version.indexOf("IOS") == 0)
return andImage;
return super.getImageClass(aspectRatio, dpi, resolution);
}
]]>
</fx:Script>
<!-- no settings, so this acts as default-->
<s:SplashScreenImageSource source="@Embed('image_not_found.jpg')"/>
<!-- specific settings -->
<s:SplashScreenImageSource source="@Embed('pinkball.jpg')"
dpi="160" minResolution="0"/>
<s:SplashScreenImageSource source="@Embed('yellowball.jpg')"
dpi="160" minResolution="500"/>
<s:SplashScreenImageSource source="@Embed('orangball.png')"
dpi="160" minResolution="1000"/>
<s:SplashScreenImageSource source="@Embed('yellowball.jpg')"
dpi="160" minResolution="1000" aspectRatio="portrait"/>
<s:SplashScreenImageSource source="@Embed('yellowball.jpg')"
dpi="240" aspectRatio="portrait"/>
<s:SplashScreenImageSource source="@Embed('pinkball.jpg')"
dpi="240" aspectRatio="landscape"/>
<s:SplashScreenImageSource source="@Embed('pinkball.jpg')"
dpi="320"/>
</s:SplashScreenImage>
Tue Jun 12 2018, 11:04 AM Z
显示 MXML 语法