加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ARCGIS viewer入门(9)flex viewer定制弹出窗口

发布时间:2020-12-15 04:36:09 所属栏目:百科 来源:网络整理
导读:(1)基本的弹出窗口? ? ? ? ? ???xml version="1.0" encoding="utf-8"? !--- ? ? Pop-up component used to render HTML text. -- s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" ? ? ? ? ? ? ? ? ? ?xmlns:s="library://ns.adobe.com/flex/s

(1)基本的弹出窗口?

? ? ? ? ??<?xml version="1.0" encoding="utf-8"?>


<!---
? ? Pop-up component used to render HTML text.
-->
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
? ? ? ? ? ? ? ? ? ?xmlns:s="library://ns.adobe.com/flex/spark"
? ? ? ? ? ? ? ? ? ?xmlns:mx="library://ns.adobe.com/flex/mx"
? xmlns:iframe="http://code.google.com/p/flex-iframe/"
? ? ? ? ? ? ? ? ? ?width="100%" height="100%"
? ? ? ? ? ? ? ? ? ?cornerRadius="10"
? ? ? ? ? ? ? ? ? ?creationComplete="htmlPopup_creationCompleteHandler(event)">
? ? <s:filters>
? ? ? ? <s:GlowFilter alpha="0.8"
? ? ? ? ? ? ? ? ? ? ? blurX="50"
? ? ? ? ? ? ? ? ? ? ? blurY="50"
? ? ? ? ? ? ? ? ? ? ? color="0xFFFFFF"
? ? ? ? ? ? ? ? ? ? ? quality="{BitmapFilterQuality.MEDIUM}"
? ? ? ? ? ? ? ? ? ? ? strength="1"/>
? ? </s:filters>
? ? <fx:Script>
? ? ? ? <![CDATA[
? ? ? ? ? ? import flash.filters.BitmapFilterQuality;


? ? ? ? ? ? import flashx.textLayout.conversion.TextConverter;


? ? ? ? ? ? import mx.core.FlexGlobals;
? ? ? ? ? ? import mx.events.CloseEvent;
? ? ? ? ? ? import mx.events.FlexEvent;


? ? ? ? ? ?
? ? ? ? ? ? [Bindable]
? ? ? ? ? ? public var btnLabel:String = "OK";

[Bindable]
public var source:String = "www.baidu.com";


? ? ? ? ? ? [Bindable]
? ? ? ? ? ? public var txtareaWidth:Number = 500;


? ? ? ? ? ? [Bindable]
? ? ? ? ? ? public var txtareaHeight:Number = 500;




? ? ? ? ? ? public static function show(content:String = "",
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? btnLabel:String = "OK",
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? width:Number = 500,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? height:Number = 500,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? modal:Boolean = true,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? closeHandler:Function = null):FramePopup
? ? ? ? ? ? {
? ? ? ? ? ? ? ? var alert:FramePopup = new FramePopup();


? ? ? ? ? ? ? ? var parent:Sprite = Sprite(FlexGlobals.topLevelApplication);


? ? ? ? ? ? ? ? if (closeHandler != null)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? alert.addEventListener(CloseEvent.CLOSE,closeHandler);
? ? ? ? ? ? ? ? }


? ? ? ? ? ? ? ? alert.source = content;
? ? ? ? ? ? ? ? alert.btnLabel = btnLabel;
? ? ? ? ? ? ? ? alert.txtareaWidth = width;
? ? ? ? ? ? ? ? alert.txtareaHeight = height;
? ? ? ? ? ? ? ? FramePopupManager.addPopUp(alert,parent,modal);
? ? ? ? ? ? ? ? return alert;
? ? ? ? ? ? }


? ? ? ? ? ? private function close(event:Event):void
? ? ? ? ? ? {
FramePopupManager.removePopUp(this);
? ? ? ? ? ? ? ? dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
? ? ? ? ? ? }


? ? ? ? ? ? protected function htmlPopup_creationCompleteHandler(event:FlexEvent):void
? ? ? ? ? ? {
? ? ? ? ? ? ? ? setStyle("backgroundColor",getStyle("contentBackgroundColor"));
? ? ? ? ? ? ? ? setStyle("backgroundAlpha",FlexGlobals.topLevelApplication.getStyle("backgroundAlpha"));
? ? ? ? ? ? }
? ? ? ? ]]>
? ? </fx:Script>
? ? <!-- doc reference http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/conversion/TextConverter.html#TEXT_FIELD_HTML_FORMAT -->
? ? <s:RectangularDropShadow id="dropShadow"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?left="0" right="0" top="0" bottom="0"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?alpha="0.32"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?angle="90"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?blRadius="10"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?blurX="20"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?blurY="20"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?brRadius="10"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?distance="25"/>
? ? <s:VGroup horizontalAlign="center" paddingBottom="10">
? ? ? ? <s:Button click="close(event)" label="{btnLabel}"/>
?<iframe:IFrame width="{txtareaWidth}" height="{txtareaHeight}" source="{source}" ?>
</iframe:IFrame>?
?
? ? </s:VGroup>
</s:BorderContainer>


---------------------------------------------------------------------------------------------

package com.esri.viewer.components
{


import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;


import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;


/**
?* Manager class used to control HTML pop-up component location and content.
?*/
public class FramePopupManager
{
? ? public static function addPopUp(window:IFlexDisplayObject,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? parent:DisplayObject,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? modal:Boolean = false,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? childList:String = null):void
? ? {
? ? ? ? PopUpManager.addPopUp(window,modal,childList);
? ? ? ? showSplash(window,parent as DisplayObjectContainer);
? ? }


? ? private static function showSplash(window:IFlexDisplayObject,parent:DisplayObjectContainer):void
? ? {
? ? ? ? var x:Number = ?parent.width - window.width-32;
? ? ? ? var y:Number = (parent.height - window.height) / 2;


? ? ? ? window.move(Math.ceil(x),Math.ceil(y));
? ? }


? ? public static function removePopUp(window:IFlexDisplayObject):void
? ? {
? ? ? ? PopUpManager.removePopUp(window);
? ? }
}


}


调用:FramePopup.show("http://www.baidu.com","ok",200,200);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读