Image in Flex

Ads
 

Image in Flex

Hi.....

Can you manipulate images using Flex programs?
please give me the example.......

Thanks

View Answers

October 21, 2010 at 12:30 PM

Ans:

Yes,we can manipulate the image in flex. I think this example will be useful for you.

private var original:BitmapData;
private static const MAX_WIDTH:uint = 1980;
private static var MAX_HEIGHT:uint = 1980;

private function loadImage(url:String):void
{
var requestURL:URLRequest = new URLRequest(url);
var imageLoader:Loader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, image_Handler);
imageLoader.load(requestURL)
}

private function image_Handler(event:Event):void
{
var bmdImage:BitmapData = Bitmap(event.currentTarget.content).bitmapData;       
var originalWidth:Number = bmdImage.width;
var originalHeight:Number = bmdImage.height;
var newWidth:Number = originalWidth;
var newHeight:Number = originalHeight;  
var matrix:Matrix = new Matrix();   
var scaleX:Number = 1;
var scaleY:Number = 1;

if (originalWidth > MAX_WIDTH || originalHeight > MAX_HEIGHT)
{
sx =  MAX_WIDTH / originalWidth;
sy = MAX_HEIGHT / originalHeight;
var scale:Number = Math.min(sx, sy);
newWidth = originalWidth * scale;
newHeight = originalHeight * scale; 
}
matrix.scale(scale, scale);
original = new BitmapData( newWidth, , newHeight);          
original.draw(bmdImage, matrix);            
}

Ads









Related Tutorials/Questions & Answers:
Flex Looping
Flex Looping  I need example for flex looping mechanisam example
Sitemap Adobe Flex Tutorial
Introducing Flex | Downloading and Installing Flex | Downloading and Installing Flex Builder | Compiling MXML application | Eclipse flex ant coding | Compiling MXML files with FlexBuilder | Flex Combo Box
Advertisements
Flex Combobox
Flex Combobox  flex combobox with database as dataprovider   You can visit the following link for detailed tutorial on the topic. May this will be helpful to you. http://www.roseindia.net/flex/flex-combo-box.shtml
Flex Updates
Flex Updates  Sir, first Thanks For Good Resource for Every One! i am New to Flex... but,in Current Updates Tell Us Flex Becomes To down!(Sorry To say).. May I know Future groom & Advantage of Flex Over Other Web
Adding a flex table in another flex table column
Adding a flex table in another flex table column  how to add a flex table in another flex table column
Flex with JSP
Flex with JSP  i want to draw chart in jsp page using flex. how can i do that? any solution??   Flex charts You can visit the following links: http://www.roseindia.net/tutorial/flex/flex4/components/charteffect.html
HTML in Flex
Flex application? Please give an example so i can implement it in my apps Thanks  Ans: Yes, you can embed HTML in flex application. You will use the TextArea component for embed An HTML in flex application
Flex-Question
Flex-Question  Hi, i have to take a DOB(date of birth) field and from here i have to calculate age. i am tryin but i am not getting the result......... pls help me
FLex Tree
FLex Tree  I want to change the node name in flex tree my code is: Company:XML = <Element name ="Element" code="400"> <{newChild} name ={newChild1} code="400"/> ; where comapny is dataprovide for tree. I want
Question about a flex...
Question about a flex...  Is there good Future for Adobe flex
Flex Combobox
Flex Combobox  flex combobox with database as dataprovider  ... on the topic. May this will be helpful to you. http://www.roseindia.net/flex/flex-combo-box.shtml
image
image  how to add the image in servlet code
Flex Developers
Player, Flex based Image Gallery, RIA apps with Flex and Flash, Flex based...Flex Developers Adobe Flex is a popular standard-based Software Development... Internet Application (RIA). Flex is used for developing rich content low bandwidth
flex
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp
ModuleNotFoundError: No module named 'flex'
ModuleNotFoundError: No module named 'flex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'flex' How to remove the ModuleNotFoundError: No module named 'flex' error
ModuleNotFoundError: No module named 'flex'
ModuleNotFoundError: No module named 'flex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'flex' How to remove the ModuleNotFoundError: No module named 'flex' error
Guide me to learn Flex
Guide me to learn Flex  Guidance to learn Flex Thanks in Advance. Kamal   Please visit the following link: Flex Tutorials
Flex Tutorial
Flex Tutorial In this section we will discuss about Flex. This section describes you the aspects of Flex such as what is Flex, benefits of flex, flex architecture, flex integration with different technologies, flex download, flex
Flex Howto
Flex Howto       In this section, you will find miscellaneous articles in flex and will be introduced... flex applications. 1. Create Modal Window
Item renderer in flex
Item renderer in flex  Hi...... please tell me about How to create item renderers in flex? give an example for that Thanks
Flex Image Gallery Slide Show
Flex Image Gallery Slide Show Earlier, most of us were fond of storing... designed and developed hundreds of sample Flex image galleries and represented... of image galleries and slide show presentation based on flex with finest quality
Flex Introduction
Flex Introduction       Flex is an open source framework developed by Adobe for creating rich internet applications. Flex based applications provide real time rich experience
which one is better, Flex or Java?
which one is better, Flex or Java?  Does flex has a scope to survive in IT? Which one of these two, Flex and Java, has a better scope of survival
Version of com.caucho>hessian-flex dependency
List of Version of com.caucho>hessian-flex dependency
Flex Offshore Web Development
Application, Flex Skins, RIA Flex based Video Player, Flex based Image Gallery, Flex...Flex Offshore Web Development Adobe Flex is a flexible and powerful standards...-platform rich Internet applications based on the Adobe Flash platform. Flex has more
Embed flex video
Embed flex video  Hi, I want to embed "application/x-shockwave-flash" content in my mxml.Basically I want to hit one url , get "application/x-shockwave-flash" content from it and display it in my mxml/swf.How to do
Flex Skin Design
Flex Skin Design Adobe Flex is a highly productive, free open source software... Applications (RIAs). Flex provides a modern, standards-based language... other than a bitmap graphics or vector graphic image. These images can be created

Ads