Layer design problems

so do i then give the panel an ID and do getElementByID on the panel then do the start animation stuff?

what do you currently do to "start the animation"? I suppose you get the layer element and then call show() on it!?



you would do the same that you're doing with the layer with the panel now. maybe having the panel set to visible = false by default and always having the audio layer visible all the time that only contains the panel which is invisible.



a panel really is not so much different from a layer besides that the layer has the screensize dimensions.



there really are different ways to do that really. you could add an onShow/onHide effect to the panel which gets triggered with element.show() and element.hide() too.

oh wow - didnt realise there was such a thing as a timer class! Thats awesome! I presume its thread safe etc!



Thanks very much for bringing it to my attention - will implement this and let you know how it all goes!

Hmmm I tried that but it doesnt actually work. The timer actually seems to fire 2 times! And also the audiopanel never slides in.



Before I was doing the following :



 public static void showAudioTrack(){
        audioLayer.showWithoutEffects();
        audioLayer.startEffect(EffectEventId.onStartScreen, new EndNotify() {

            @Override
            public void perform() {
        
            }
        });
    }



Which worked but fills the screen with the element...

actually it's nice (= odd) that I'm not the only one having problems helping renegadeandy …  :wink:



I just tried Tumaini example code and it works perfectly well!



The only thing I need to change is to set the "audioLayer" to visible="true":


<layer id="audioLayer" backgroundColor="#003f" childLayout="center" visible="true">



so that the layer is actually visible because in Tumainis solution we'll only show/hide the panel and not the layer.

You could easily have the layer hidden all the time too and just show() it before we want to display the audioPanel but those "advanced" stuff is not appropriate for every nifty user ... and the extra layer does not hurt at all because it is empty all the time anyway.

I've just called showAudioTrack() in my onStartScreen() but I suppose you could call it when a button has been pressed or some state in your application changes. The timer did not fire two times when I tried it! Do you import the right timer class?

Right, ok so yes it works in a sense.



SO changing visible to false



then doing



audioLayer.show();

audioPanel.show();



timer


audioLayer.hide();
              audioPanel.hide();

Works - but the audio layer fills the entire screen.

What I really want is just a small component added to the view for 3 seconds then for it to be disappear again. Do I need it to exist within a layer? How do I make an opaque layer!?

Well, the easiest thing you could do in my opinion is to do what void wrote and change the visibility of the layer to true.

If you don't want the layer to show (be transparent, it is already opaque, since you can see it), just remove the backgroundColor attribute. Below is my suggestion:

<layer id="audioLayer" childLayout="center">



Then you can remove audioLayer.hide() and show().

Good luck!

Yipeee!! Thats the ticket! Cheers guys!