• Using Flex swf to load html into frames(转)


    I recently had a reason to do this, and saw that many people online are having problems. Here’s a solution, and a few notes to help. First the Flex code:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="30" horizontalScrollPolicy="off" verticalScrollPolicy="off" backgroundColor="#000000" backgroundGradientAlphas="{[0,0]}">
    <mx:Script>
    <![CDATA[
    import flash.net.URLRequest;
    //private var contentFrame:
    private var myArr:Array = new Array("home","bio","contact");

    ]]>
    </mx:Script>
    <mx:ButtonBar width="100%" height="100%" dataProvider="{myArr}" itemClick="navigateToURL(new
    URLRequest(event.label+'.html'),'contentFrame');" color="#ffffff"/>
    <mx:Label id="test" y ="150" /></mx:Application>

    Here’s an example (you can view page source to see the HTML):

    A few notes:

    In AS3:

    The frame name must by exactly the same (of course! – but this came up in the forums), and must be a string, passed as a parameter in navigateToURL (in place of “_blank” etc)

    In AS2: (Flash): The parameter is ’supposed’ to be a string here as well, but I could only get it to work with out the quotes (as a var) – here you use the getURL() method.

    Note: if using relative urls, it will appear not to work while developing, but should once you get it on the server – flash security. This seems o only be the case with as3

    Cheers,




    转自:http://blog.flexcommunity.net/?p=128
  • 相关阅读:
    感谢梦想
    感谢迷茫
    CSS动画
    ES6笔记③
    Object的增。删。查。改。遍历
    js创建对象的方式 三种
    js 控制台的错误提示
    ES6笔记② 箭头函数
    ES6笔记① var 和 let的区别
    js冒泡排序
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1583849.html
Copyright © 2020-2023  润新知