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: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900

Avoid seeing elements being added on launching the application in BB 10

[ Edited ]

Hai am having a serious problem with my app. When it loads I could see each component being added. Say for example if there is a container to which I add an image then during loading initially there is a white screen then only the background comes in. The white background is only there for half a millisecond but I need to avoid seeing that. I tried splashScreens but not helpful

_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Avoid seeing elements being added on launching the application.

[ Edited ]

You can fake a splash screen or create your own loader (like 'Cut The Rope' or 'Plants vs Zombies' on Playbook)

 

Faking:

add an image on top of your first container, which looks exactly like your splash screen. under that image, load all you need. When the loading is done, dispatch an event to remove your fake splash screen. For additional effect, you could use a Tweener, setting it's alpha-value and then remove the fake splash screen when the alpha-value hits zero

 

Loader:

same as before, but you show a screen with a loading bar. There is one in the qnx-package, or you can just create your own. When everything is loaded, remove the loading screen. With a custom loading screen, you don't need to care about orientation / react accrodingly to orientation change

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900

Re: Avoid seeing elements being added on launching the application.

I think I will move with your idea of fake splash screen it sounds great.. But am thinking of how..?? I did try to load a image but its kind of failing. Don't know what went wrong..?? Could you point me towards some example codes.. Am really sorry for being such a pain but am totally new to this BB Development.
_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Avoid seeing elements being added on launching the application.

How do you load an image? If you embed it first, you have it instantly (instead of loading). Then it's just loading the embedded Class into a bitmap, then add that to a Sprite/Image/MovieClip/whatever

 

see here: http://www.bit-101.com/blog/?p=853

 

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

Re: Avoid seeing elements being added on launching the application.

You may have to load the image, listen for the completion event, *then* begin creating the items on the main page.
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Avoid seeing elements being added on launching the application.

Psedo code:
* app starts
* Create image and add to display list
* Add listener for Event.COMPLETE
* Set image source to graphics (load or embed)
* On event listener, add display element underneath image
* When done, remove image

Hope this helps.
Developer
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900

Re: Avoid seeing elements being added on launching the application.

i tried for Event.COMPLETE but it's not getting triggered.
_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Avoid seeing elements being added on launching the application.

here's a simple example for embedding

 

package
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(width="1024", height="600", backgroundColor="#ffffff", frameRate="60")]
	public class MyTest extends Sprite
	{
		[Embed(source='assets/splash.png')]	public static const SPLASH : Class; //<--the same image as your splash screen
		private var _splash:Sprite;
		
		public function MyTest()
		{
                        //faking your splash screen

			var splashBitmap:Bitmap = new SPLASH ();
			_splash = new Sprite();
			_splash.addChild(splashBitmap);
			addChild(_splash); //<-- this should be there instantly, because you embedded it

                        //now load your stuff normally
                        loadNormalStuff()
		}
		
		private function loadNormalStuff():void
		{
			//whatever. When done (with Event), remove your fake splash screen
                        

                        //call this when done, most likely in a callback function (though I would prefer a Tweener)
                        if (contains(_splash))
                            removeChild(_splash);
		}
	}
}

 

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900

Re: Avoid seeing elements being added on launching the application.

I tried this but still I could see elements being dropped..
_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Avoid seeing elements being added on launching the application.

Create another sprite and add it before the splash. Add your elements to that first sprite.