Hi,
I have a similar kind of a problem i.e. i need to show a preloader
till the data is not available on the screen. can u plz send the the
details so that i can use it in my code...
Thanks Regards
Shivani
--- In flexcoders@yahoogroups.com, rudmonster [EMAIL PROTECTED]
wrote:
Hello,
I posted an answer this morning but I dont see it so let me try
again
(first time posting :)
All you need to do is extend mx.preloader.Download progressbar then
override the FlexEvent.INIT_COMPLETE you can then control when
your
preloader will end ...see here (sorry ...I am paraphrasing my code
dont
have it with me but you will get the idea)
public class Preloader extends DownloadProgressBar {
public var splash:SplashScreen;
public function CustomPreloader()
{
super();
splash = new splashScreen();
this.addChild(splash) ;
}
override public function set preloader(
preloader:Sprite ):void
{
preloader.addEventListener( FlexEvent.INIT_COMPLETE ,
FlexInitComplete );
}
private function FlexInitComplete( event:Event ):void
{
splash.comp= true; // When this is true I know that the
swf
has finished downloading
dispatchEvent( new Event( Event.COMPLETE ) );
}
}
so over riding and binding a var to true I can use another event
(like a
database query result event to call another function inside of my
splash
sprite .as file to remove itself like this:
public function startupComplete( event:ResultEvent):void
{
if( this.comp) closeSplash() ;
}
public function closeSplash( ):void
{
if( this.alpha 0){
this.alpha = this.alpha - fadeOutRate;
this.parent.removeChild(this);
}
}
if this sounds like what you want I can send you all my code to do
this
.
Rudmonster :)
--- In flexcoders@yahoogroups.com, hannes.stockner mail@ wrote:
Now I have a possible solution:
CustomPreloader:
private function onFlexInitComplete(event:Event):void
{
//now we can access the Application.application
Application.application.addEventListener(AppReadyEvent.READY,
onAppReadyEvent);
}
private function onAppReadyEvent(event:AppReadyEvent):void
{
dispatchEvent(new Event(Event.COMPLETE));
}
Application:
//dispatch AppReadyEvent if you want remove the preloader
Application.application.dispatchEvent(new
AppReadyEvent(AppReadyEvent.READY));
What do you think about it?
--- In flexcoders@yahoogroups.com, dave_defusion david.spurr@
wrote:
I'm just trying to do the same thing for our app today and there
must
be a way, surely it's quite a common requirement. All I want to
do
is
load the runtime styles a quick check to the backend, but the
loading the styles is the most important thing.