Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Regular Contributor
Posts: 90
Registered: ‎09-04-2009
My Device: Blackberry Z10
My Carrier: Airtel

Scalling image

hi,

 

how to scalling image.

 

 

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Scalling image

hey satish,

 

to scale an image, you need to wait until it is fully loaded before you can make any manipulations. try the following code for an example:

 

 

package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	import qnx.ui.display.Image;
	
	public class ImageTest extends Sprite
	{
		private var myImage:Image;
		
		public function ImageTest()
		{
			super();
			
			// support autoOrients
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			myImage = new Image();
			
			/*
			 * Replace picture.jpg with your image
			*/
			
			myImage.setImage("picture.jpg");
			myImage.addEventListener(Event.COMPLETE, resizeImage);
			
			addChild(myImage);
		}
		
		private function resizeImage(e:Event):void
		{
			/*
			 * Resize the image to 100x100 pixels after it has been loaded
			*/
			
			e.target.setSize(100,100);
		}
	}
}

 

After your picture has been loaded use the e.target reference to the image (you can also use myImage as a reference in this case becaues the variable name is available outside the constructor). hope that helps. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Regular Contributor
Posts: 90
Registered: ‎09-04-2009
My Device: Blackberry Z10
My Carrier: Airtel

Re: Scalling image

thanks,

 

 its preety helpful for me...