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
Developer
pyth
Posts: 501
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Help!! how to put bitmap on screen??


in Flash Pro. I have library where i store items how this is achieved in "flash builder"?

I really  thought these simple things gonna be sraightforward.

Im moving from Flash Pro so , Flash Builder is new to me

 


you embed them (like in my code snippet) or you load them (like jtegen said). embedding is faster, with loading you can load from web etc. as well

 

you don't have to use ANE for something this simple

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Help!! how to put bitmap on screen??

[Embed(source='assets/edit.png')] private var edit_icon : Class;

No need to be static.
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Help!! how to put bitmap on screen??

The skin ANE *might* be portable, but the device ANE -- probably not. They are making these item's ANE to make it easier to support other devices down the road. If you want to support other platforms, then you/we/world will need to provide an ANE with the same API.
Please use plain text.
Contributor
ShoulO
Posts: 10
Registered: ‎06-20-2011
My Device: curve 8520
My Carrier: Orange

Re: Help!! how to put bitmap on screen??

[ Edited ]

Thanks for answers!

 

OK so Im getting somewhere - i want to use pure ActionScript approach and try using embeding first.

(maybe latter will try loading)

But still things dont work...

 

thats what I do:

 

1. Created folder assets, right mouse click --> Import-->General-->File System, import image.png, hit Refresh.

2. Write code:

package
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	
	[SWF(width="1024", height="600", backgroundColor="#404040", frameRate="60")]
	public class kkk extends Sprite
	{
		[Embed(source='assets/image.png')]
		public static const MyImage : Class;
		
		public function kkk()
		{
			initBGR();
		}
		
		private function initBGR():void
		{
			var myImg:Bitmap = new MyImage();
			var mySprite:Sprite = new Sprite();
			mySprite.addChild(myImg);
			mySprite.cacheAsBitmap = true;
			addChild(mySprite);
		}
	}
}

 the line [Embed(source='assets/image.png')]  is underlined in red and i ger error:

 

Could not find Embed source 'assets/image.png'. Searched 'C:\Documents and Settings\mmm\grybasssssssssss\kkk\src\assets\image.png', 'assets/image.png' in SWCs on the library path

 

What I am doing wrong?

 

P.S. I can see image.png inside folder assets so its really there

 

Please use plain text.
Contributor
ShoulO
Posts: 10
Registered: ‎06-20-2011
My Device: curve 8520
My Carrier: Orange

Re: Help!! how to put bitmap on screen?? (SOLVED!)

Yeees! :smileyhappy:

 

 

I created new workspace, and created folder assets INSIDE folder src and it works perfectly!

 

Thanks to all who helped me out,

Cheers!

Please use plain text.