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.
01-28-2011 12:09 AM
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?
Solved! Go to Solution.
01-28-2011 02:41 AM
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
here is the link to a good deal of info related to scale9grid:
hope that helps. good luck!
01-28-2011 02:47 AM
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.
01-28-2011 03:11 AM
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