<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 495,comments - 227,trackbacks - 0
    http://my.oschina.net/Boder/blog/931

    國外有高手已經(jīng)實(shí)現(xiàn)了IE瀏覽器內(nèi)加載flashpaper,好像是這篇吧: http://www.darronschall.com/weblog/2006/11/how-to-load-flashpaper- documents-in-flex-2.cfm 這里將在他的基礎(chǔ)上改成利用LocalConnection來通訊,以便更好的處理來回的操作. flex load flashpaper也離不開flash,這個(gè)例子其實(shí)就是用flash做一個(gè)空殼,比如命名FPload.swf這個(gè)殼就是用來加載 flashpapaer的,里面實(shí)現(xiàn)了對(duì)flashpaper的大小設(shè)置,縮略值,頁數(shù)設(shè)置等等,注意這個(gè)fpload.swf是flash8的.在 flex中加載就得利用LocalConnection(如果不明白的得自己去想辦法了解了)或者例子中的ExternalInterface跟 fpload.swf通訊,去設(shè)置尺寸,大小,頁面等等 首先看flex3里面如何來加載flashpaper //com.magReader.FlashPaperLoader.as


    package com.magReader
    {

        
    import flash.events.Event;
        
    import flash.events.StatusEvent;
        
    import flash.net.LocalConnection;
    //import flash.system.System;

        
    import mx.controls.SWFLoader;

        
    /**
         * UIComponent designed specifically to load FlashPaper documents
         * and size them correctly in the available area.
         
    */
        
    public class FlashPaperLoader extends SWFLoader
        {

            
    /**
             * The id of the FlashPaperLoader.swf proxy that will be used
             * for communication pyurposes.
             
    */
            
    public static const FLASH_PAPER_LOADED    : String = "flashPaperLoaded";
            
    public static const FLASH_CONNERROR        : String = "flashConnError";
            
    private var sendFlashConn:LocalConnection;
            
    private var recieveFlashConn:LocalConnection;
            
    /**
             * The name of the application that is loading in the FlashPaperLoader.swf
             * file.  This name must correspond to the "id" attribute in the object tag
             * and the "name" attribute in the embed tag when the Flex client is embedded
             * into the html page.
             
    */

            
    /**
             * Constructor
             
    */
            
    public function FlashPaperLoader()
            {
                
    //source = "app-storage:/data/fpHolder.swf";
                sendFlashConn=new LocalConnection();
                recieveFlashConn 
    = new LocalConnection();
                recieveFlashConn.client
    =this;
                sendFlashConn.addEventListener(StatusEvent.STATUS, onStatus);
                sendFlashConn.allowDomain(
    "*");
                recieveFlashConn.allowDomain(
    "*");
                sendConn();
            }
            
    public function sendConn():void
            {
                
    try
                {
                    recieveFlashConn.connect(
    "_flexloader");
                } 
    catch (error:ArgumentError) {
                    trace(
    "Can't connectthe connection name is already being used by another SWF");
                    onConnError();
                    
    return;
                }
            }

            
    private function onStatus(result:StatusEvent) :void{

                trace (result.level 
    == "error"?"Operation failed":"Operation succeeded");

            }
            
    //連接源出錯(cuò)
            private function onConnError():void
            {
                
    //errUnload();

                var e:Event
    =new Event(FlashPaperLoader.FLASH_CONNERROR);
                dispatchEvent( e );
            }

            
    // =================================================================
            
    //  Expose methods that are proxied from FlashPaperLoader.swf - Call
            
    //  JavaScript methods that the FlashPaperLoader.swf file picks up
            
    //  and passes to the loaded FlashPaper document.
            
    // =================================================================

            
    public function setSize( width:Number, height:Number ):void
            {
                trace(
    "=========setPaperSize=============");
                sendFlashConn.send(
    "_flashpaperloader","setPaperSize",width,height);
            }
            
    /**
             * 文檔加載成功提示
             * 
    */
            
    public function fpLoaded():void
            {
                trace(
    "reveice fpLoaded message!! this.width = " + this.width + " this.height" + this.height);
                
    //setSize(parent.width,parent.height);
                var e:Event=new Event(FlashPaperLoader.FLASH_PAPER_LOADED);
                dispatchEvent( e );
                
    //this.visible=true;
            }
            
    /**
             * 設(shè)置縮放
             * 
    */
            
    public function setZoom(value:Object):void
            {
                
    if (this.visible)
                {
                    sendFlashConn.send(
    "_flashpaperloader","setCurrentZoom",value);
                }
            }

    //    override protected function updateDisplayList( unscaledWidth:Number,
    //                                                   unscaledHeight:Number ):void
    //    {
    //        if ( contentHolder )
    //        {
    //            // Adjust values so the FlashPaper document is displayed correctly
    //            contentHolder.scaleX = 1.0;
    //            contentHolder.scaleY = 1.0;
    //            contentHolder.x = 0;
    //            contentHolder.y = 0;
    //    
    //            contentHolder.scrollRect = new Rectangle( 0, 0, unscaledWidth, unscaledHeight );
    //    
    //            // When the content has loaded, call the setSize method so that the
    //            // FlashPaper document sizes right in the available area
    //            if ( Loader( contentHolder ).content )
    //            {
    //                setSize( unscaledWidth, unscaledHeight );
    //                //this.setFocus();
    //            }
    //        }
    //    }

            
    //卸載此swf
            public function unload():void
            {
                
    if(sendFlashConn != null
                {
                    sendFlashConn.send(
    "_flashpaperloader","unload");
                    sendFlashConn 
    = null;
                }
                
    try
                {
                    
    if(recieveFlashConn != null
                    {
                        recieveFlashConn.close();
                        recieveFlashConn 
    = null;
                    }
                }
    catch(e:ArgumentError)
                {
                    trace(e.toString());
                    recieveFlashConn 
    = null;
                }

                unloadAndStop(
    true);
                
    //System.gc();
            }
            
    public function errUnload():void
            {
                
    if(sendFlashConn != null
                {
                    sendFlashConn.send(
    "_flashpaperloader","unload");
                    sendFlashConn 
    = null;
                }
                
    if(recieveFlashConn != null) recieveFlashConn = null;
                unloadAndStop(
    true);
                
    //System.gc();
            }

        } 
    // end class
    // end package


    posted on 2010-04-06 14:04 SIMONE 閱讀(722) 評(píng)論(0)  編輯  收藏 所屬分類: JAVAflash
    主站蜘蛛池模板: 亚洲一级毛片在线播放| 特级做a爰片毛片免费看| 免费网站观看WWW在线观看| 亚洲国产人成中文幕一级二级| 中文字幕乱码亚洲无线三区| 免费在线观看的网站| 四虎永久精品免费观看| 亚洲色大成网站www久久九| 好吊妞在线新免费视频| 久久亚洲精品国产精品婷婷| 日韩在线看片免费人成视频播放| 亚洲精品无码久久一线| 最近2019中文免费字幕在线观看| 国产偷v国产偷v亚洲高清| 在线播放免费人成毛片乱码| 亚洲av无码专区国产乱码在线观看| 精品视频在线免费观看| 亚洲图片在线观看| 在线播放免费人成视频网站| 久久久无码精品亚洲日韩软件 | 91老湿机福利免费体验| 亚洲伦理一区二区| 欧洲黑大粗无码免费| 亚洲av无码一区二区三区四区| 国产精品无码一二区免费 | 很黄很污的网站免费| 精品亚洲麻豆1区2区3区| 日韩版码免费福利视频| 美女扒开屁股让男人桶爽免费| 亚洲情XO亚洲色XO无码| 在线人成精品免费视频| 亚洲AV成人一区二区三区在线看| 国产精品jizz在线观看免费| 你懂的免费在线观看| 亚洲国产精品人久久电影| 大地资源网高清在线观看免费| 亚洲黄色免费网址| 国产好大好硬好爽免费不卡| 亚洲女同成人AⅤ人片在线观看 | 任你躁在线精品免费| 亚洲男人天堂2018av|