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
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings
Accepted Solution

Theme not working in Hello World app?

Hello,

 

i was reading through the slides and I wondered why the Hello World app has such an ugly black background, despite I configured the white theme.

 

I don't really see the difference with the RSSReader example, then again I might be overseeing something. Thank you

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Theme not working in Hello World app?

hey zezke,

 

to change the background of your application you have three options to choose from. The theme stuff you were reading about is in regards to the buttons and components within the application. To change the background of your application however follow one of these three steps (taken from a thread discussing this issue from before):

 

Meta Data:

 

package
{
import flash.display.Sprite;

[SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
public class MyApplication extends Sprite

public function MyApplication()
{
(...)

}
}
}

 

The background is in the same format as HTML coloring. The second way is by creating a shape object as large as the screen and adding it as the first child to your program like so:

 

package
{
import flash.display.Shape;
import flash.display.Sprite;

[SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
public class MyApplication extends Sprite
{
public function MyApplication()
{

var appBackgroundColor:Shape = new Shape();

appBackgroundColor.graphics.beginFill(0xFF0000);
appBackgroundColor.graphics.drawRect(0,0,1024,600);
appBackgroundColor.graphics.endFill();

addChild(appBackgroundColor);


(...)
}
}
}

 

To add an image is like the second step only using the Image class like this:

 

package
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.filesystem.File;

import qnx.ui.display.Image;


[SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
public class MyApplication extends Sprite
{
public function MyApplication()
{

var appBackgroundImage:Image = new Image();

appBackgroundImage.setImage(File.applicationDirectory.resolvePath('path/to/image.png').url);
appBackgroundImage.setSize(1024,600);
appBackgroundImage.setPosition(0,0);

addChild(appBackgroundImage);

(...)

}
}
}

 

Here is the link to the older thread:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/how-to-set-background-for-contain...

 

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
Highlighted
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Theme not working in Hello World app?

Thank you, I did however needed to use the second method, since the first one did not have any visual effect.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!