Using the Image control as a pop up (转载)
2010-01-09 10:13
337 查看
The following example shows how you can use the PopUpManager class to launch an modal Image control.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/10/18/using-the-image-control-as-a-pop-up/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
global {
modalTransparencyBlur: 0;
modalTransparency: 0.9;
modalTransparencyColor: black;
modalTransparencyDuration: 500;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.managers.PopUpManager;
private const IMG_PREFIX:String = "http://www.helpexamples.com/flash/images/";
private function popIt(src:String):void {
var img:Image = new Image();
img.addEventListener(MouseEvent.CLICK, img_click);
img.addEventListener(Event.COMPLETE, img_complete);
img.load(IMG_PREFIX + src);
img.toolTip = img.source.toString();
PopUpManager.addPopUp(img, this, true);
}
private function img_complete(evt:Event):void {
var img:Image = evt.currentTarget as Image;
img.width = img.contentWidth;
img.height = img.contentHeight;
PopUpManager.centerPopUp(img);
}
private function img_click(evt:MouseEvent):void {
var img:Image = evt.currentTarget as Image;
PopUpManager.removePopUp(img);
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="image 1" click="popIt('image1.jpg');" />
<mx:Button label="image 2" click="popIt('image2.jpg');" />
<mx:Button label="image 3" click="popIt('image3.jpg');" />
</mx:ApplicationControlBar>
</mx:Application>
转载自:/article/4889068.html
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/10/18/using-the-image-control-as-a-pop-up/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
global {
modalTransparencyBlur: 0;
modalTransparency: 0.9;
modalTransparencyColor: black;
modalTransparencyDuration: 500;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.managers.PopUpManager;
private const IMG_PREFIX:String = "http://www.helpexamples.com/flash/images/";
private function popIt(src:String):void {
var img:Image = new Image();
img.addEventListener(MouseEvent.CLICK, img_click);
img.addEventListener(Event.COMPLETE, img_complete);
img.load(IMG_PREFIX + src);
img.toolTip = img.source.toString();
PopUpManager.addPopUp(img, this, true);
}
private function img_complete(evt:Event):void {
var img:Image = evt.currentTarget as Image;
img.width = img.contentWidth;
img.height = img.contentHeight;
PopUpManager.centerPopUp(img);
}
private function img_click(evt:MouseEvent):void {
var img:Image = evt.currentTarget as Image;
PopUpManager.removePopUp(img);
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="image 1" click="popIt('image1.jpg');" />
<mx:Button label="image 2" click="popIt('image2.jpg');" />
<mx:Button label="image 3" click="popIt('image3.jpg');" />
</mx:ApplicationControlBar>
</mx:Application>
转载自:/article/4889068.html
相关文章推荐
- 【转载】LINQ to SQL (Part 5 - Binding UI using the ASP:LinqDataSource Control)
- Using the Image control as a pop up
- Showing the Image file thumbnail view in ListView control using VC++ 6.0
- [Watir]Control the popup windows created using javascript
- [转载]Image Your Hard Drive using dd
- Creating unique identifiers for objects using the getUID() (转载)
- Using Templates With the ASP.NET Repeater Control...
- [转载]Flip an image in UIImageView using UIView transitionWithView
- Removing items from a Flex DataGrid control using the DragManager class
- Classifying traffic scenes using the GIST image descriptor
- [CSS] Control Image Aspect Ratio Using CSS
- Using the itemDoubleClick event to open nodes in a Flex Tree control
- Alternating row colors in a Flex Tree control using the alternatingItemColors style
- 25 You are using the control file to maintain information about the database backups that are being
- 【转载】10.1\t使用项目视图类(Using the Item View Convenience Classes)
- Fill in PDF Form Fields using the Open Source iTextSharp Dynamic Link Library(转载)
- A Simple ASP.NET Tab Control Using the MultiView control
- Adaptive Thresholding Using the Integral Image ( Derek Bradley* Gerhard Roth)
- Uploading Files Using the File Field Control (ASP.NET上传文件)(zz)
- Setting the Background Image for a List Control