【问题标题】:how to load interactive .swf in mobile flex application?如何在移动 flex 应用程序中加载交互式 .swf?
【发布时间】:2011-09-26 06:27:39
【问题描述】:

我有一个移动应用程序,我正尝试使用它来加载交互式 .swf 文件。起初,我只是打算在 flex 中使用我的其他项目文件中的 .mxml 应用程序,但它们适用于桌面应用程序并在 Flex 3.6 上运行,而移动应用程序不能在低于 4.5 的基础上构建:P

所以,我想我会将第一个项目导出为 .swf,然后将其加载到我的移动应用程序中,但我所做的一切都不会让它显示出来。有人知道解决办法吗?

代码如下:

<?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="Task Graphic Novels">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:SWFLoader width="100%" height="100%"
                 loadForCompatibility="true"
                 id="bookLoader" enabled="false"/>
    <fx:Script>
        <![CDATA[
            import 
        ]]>
    </fx:Script>
    <s:List height="100%" width="100%">
        <s:itemRenderer>
            <fx:Component>
                <s:IconItemRenderer height="100" labelField="name" 
                                    iconField="photo" iconHeight="70" 
                                    iconWidth="54" messageFunction="getMessage">
                    <fx:Script>
                        <![CDATA[
                            import spark.components.NavigatorContent;
                            protected function getMessage(o:Object):String
                            {
                                return o.message;
                            }
                        ]]>
                    </fx:Script>
                </s:IconItemRenderer>
            </fx:Component>
        </s:itemRenderer>
        <s:dataProvider>
            <s:ArrayCollection>
                <fx:Object name="Breach an Obstacle" photo="@Embed('assets/img/sumeco/beach/title.jpg')" message=""/>
                <fx:Object name="Conduct a Raid" photo="@Embed('assets/img/sumeco/title.jpg')" message=""/>
            </s:ArrayCollection>
        </s:dataProvider>
        <s:change>
            <![CDATA[
            if(event.currentTarget.selectedItem.name == "Beach")
//here's where i'm trying to load the swf  {bookLoader.enabled=true; bookLoader.load(new U    RLRequest("assets/BookDemo.swf"));}
                else if(event.currentTarget.selectedItem.name == "Title"){}
                ]]>
            </s:change>
        </s:List>
</s:View>

【问题讨论】:

  • 我没有收到任何错误,它只是没有加载:/ 截至目前,单击该项目与单击第二个项目相同,没有。
  • 您的目标平台是什么?对于 iOS,这是不可能的。
  • 根本不适合 iOS?即使 swf 包含在打包的应用程序中也不行?

标签: apache-flex flash embed interactive mobile-application


【解决方案1】:

我认为这不会起作用,因为您正在尝试加载本地 swf。我认为它需要通过互联网加载,即使如此,你为什么要在本地加载 swf?为什么不直接调用呢?

【讨论】:

  • 哦,还有,如果你要上网,你需要添加权限。
  • 我如何直接调用它?
  • 相信你可以在源码中嵌入:&lt;SWFLoader source="@Embed('assets/BookDemo.swf')" /&gt;
  • VerifyError: Error #1053: Illegal override of activate in mx.managers.SystemManagerProxy. VerifyError: Error #1014: Class mx.graphics::RoundedRectangle could not be found. ReferenceError: Error #1065: Variable _SWFLoaderStyle__embed_css_Assets_swf___brokenImage_113275806 is not defined. ReferenceError: Error #1065: Variable BookDemo__embed_mxml_assets_img_sumeco_breach_an_obstacle_title_jpg_1106297139 is not defined.
  • 它看起来像是从我编译 swf 的原始文件中寻找资源?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多