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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 168
Registered: ‎01-13-2011
My Device: Not Specified
Accepted Solution

scale9Grid and images

I am trying to scale9grid an image.  I am using the following code.

 

			[Embed(source="assets/images/frame.png",
				scaleGridTop="5", scaleGridBottom="10",
				scaleGridLeft="5", scaleGridRight="10")]
			var paneFrame:Class;
			
			var frame:Image;
			/*  Add the border */
			frame = new Image();
			frame.setImage(new paneFrame);
			frame.height = 300;
			frame.width = 300;
			addChild(frame);

 

 

When I do this, I get an empty screen.  The image in question measures 15x50 pixels.

 

To note when I just remove the scaling parameters from the embed code, the image displays (all pixelated of course)

 

 

		[Embed(source="assets/images/frame.png")]
			var paneFrame:Class;
			
			var frame:Image;
			/*  Add the border */
			frame = new Image();
			frame.setImage(new paneFrame);
			frame.height = 300;
			frame.width = 300;
			addChild(frame);

 

Has anyone used scale9grid on a image successfully?

 

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

Re: scale9Grid and images

hey EraserX,

 

try using the following code:

 

 

			[Embed(source="assets/images/frame.png",
				scaleGridTop="5", scaleGridBottom="10",
				scaleGridLeft="5", scaleGridRight="10")]
			var paneFrame:Class;

			var myContainer:Sprite = new Sprite();
			var frame:Sprite = new paneFrame();
			myContainer.addChild(frame);
			frame.width = 300;
			frame.height = 300;
			
			var myBitmapData:BitmapData = new BitmapData(300,300);
			myBitmapData.draw(myContainer);
			addChild(new Bitmap(myBitmapData))

 

i've looked around an apparently you have to add your image to a sprite first and then draw that sprite out as the source. something to do with non-transformable sources. and i used the Bitmap class instead of the image. im not a fan of the QNX image class yet but im warming up to it Smiley Happy

 

 

here is the link to a good deal of info related to scale9grid:

 

http://www.dreaminginflash.com/2007/12/03/9-slice-and-bitmap/

 

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
Developer
Posts: 168
Registered: ‎01-13-2011
My Device: Not Specified

Re: scale9Grid and images

Thanks JRab!  I don't have experience working with bitmaps, so your example is definitely going to help!  Also there aren't any other posts (that I could find) on this forum on scale9grids with bitmaps/images so I"m sure lots of other people will find it helpful too.

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

Re: scale9Grid and images

hah no problem at all! yeah i agree scale9grid info is scarce compared to other things around here. but one reason for that is prolly that scale9grid is a grey area from what i've read about it so far in AS3. it basically doesnt do what logically makes sense. people feel it should do one thing but it really does another. but as with all things intangible there are workarounds Smiley Happy

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