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
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Fading images in Flex...

Have you installed the QNX library (v 0.9.4)?

Those files get installed in the sdks directory in FB.

Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Fading images in Flex...

I did and I also added them to the Preferences - FlashBuilder - Installes SDKs. But I still have Hero set as the default. It would not let me create the project otherwise. Do I need to check BlackBerry as default?

 

Ideally, it would be nice to have an Android compatible app at the same time. i.e. don't use the embedded QNX stuff. I should be able to download one of the 3rd party Tweener libraries shouldn't I? I tried putting them in the libs folder of the project but I can;t seem to access them.

 

I'm sure I am missing something in terms of libraries in FB.

 

Thanks

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: Fading images in Flex...

Ah, yes, you should be able to include a 3rd party library.  You need to add the SWC from the preferences panel for that project (Under Flex Build Path, select "Add SWC..." button).

Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Fading images in Flex...

Okay. Got the Tweener loaded so that the commands to not generate errors... But how do I get it to trigger???

 

I have an image:

 

<s:Image id="s1" width="150" height="300" source="assets/digit-{secs1}.png"/>

 

 

And I change the image every second in the script with:

 

secs1 = ("0"+currentTime.seconds.toString()).substr(-2,1);

 

 

I've added a Tween...

 

Tweener.addTween(s1, {alpha:100, time:1});

 But the image is still flipping crudely as before... How do I get the crossfade effect?

 

Sorry for being so thick.

 

 

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: Fading images in Flex...

Alpha is between 0.0-1.0.  0=transparent, 1=opaque

Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Fading images in Flex...

I think my problem is that the effect is working but not where I want it too. If I set alpha to 0, the first image pops in then fades to 0 and stays there. Maybe I should rewind and restate my problem...

 

The app is working but the images disapear and the new ones appear rather abruptly.

 

I need to rotate between arbitrary images and I want a nice transition between them. Like you would in a slide show. 0.png --> 1.png --> 2.png --3.png ... back to 0.png...

 

How would I accomplish this?

 

Thanks 

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: Fading images in Flex...

I dont have the Tweener right in front of me, but it would be something like this:

 

private var _current_image : int = 0;

private var _images : Array = new Array();

 

////////////////////////////////////////////////////// 

private function init() : void

{

  // fill image array 

  // set each image alpha to 0, except for 1st one

  this.nextAnimate(); 


//////////////////////////////////////////////////////////////////

private function nextAnimate() : void

{

  var next_index : int = this._current_image;

  if( next_index == this._images.length )

  {

    next_index = 0; 

  } 

 

  Tweener.addTween( this._images[this._current_image],

                    { alpha:0.0, time:1.0, onComplete: nextAnimate } );

  Tweener.addTween( this._images[next_index],

                    { alpha:1.0, time:2.0, delay:0.5, onComplete: nextAnimate } );

  this._current_image = next_index; 

 

 

You will have to play around with the values. 

Please use plain text.