[flexcoders] Re: Communication between custom preloader and the application

2008-09-02 Thread João
I am doing this because:

- I want my preloader to make an end transition (imagine a fade out)
when it reaches 100%;
- I want my application to make a start transition (imagine a fade In)
when it's loaded;

While the preloader is fading out, the application already started to
fade in. So when the preloader disappears, the application intro
coreography is almost finished. I need my application intro
coreography to start only when the preloader ended it's fade out
animation.

I have solved this by using Max' tip, by calling a
Application.application.initCoreography() method. 

Thanks,

João Saleiro

---
CTO @ Webfuel
Adobe Community Expert
Co-founder of the Portuguese RIA Community



--- In flexcoders@yahoogroups.com, Pedro Sena [EMAIL PROTECTED] wrote:

 Hi João,
 
 Why are you trying to do this? Just for curiosity...
 
 Regards
 
 On Mon, Sep 1, 2008 at 9:33 AM, João [EMAIL PROTECTED] wrote:
 
Hello,
 
  I have created a custom application preloader as described here:
 
 
http://www.onflex.org/ted/2006/07/flex-2-preloaders-swf-png-gif-examples.php
 
  I need my preloader to communicate with the application, by
  dispatching an event or calling a method on the appliaction where it
  resides, but I'm not being able to make them communicate.
 
  Any suggestions?
 
  Thanks,
 
  João Saleiro
 
   
 
 
 
 
 -- 
 /**
 * Pedro Sena
 * Systems Architect
 * Sun Certified Java Programmer
 * Sun Certified Web Component Developer
 *
 * Net Sar
 * www.netsar.com.br
 */





[flexcoders] Re: Communication between custom preloader and the application

2008-09-01 Thread maximecowez
Hi João,

the mx.core.Application class has a static getter 'application', so
once your application is initialized you can simply reference your
application using Application.application from within tour preloader
class.

like this:

addEventListener(FlexEvent.INIT_COMPLETE, initCompleteHandler);

private function initCompleteHandler(event:Event):void {
Application.application.doSomething();
//or
Application.application.addEventListener(Event.SOME_EVENT,
someHandler);
} 

hope this helps,
Max

--- In flexcoders@yahoogroups.com, João [EMAIL PROTECTED] wrote:

 Hello,
 
 I have created a custom application preloader as described here:

http://www.onflex.org/ted/2006/07/flex-2-preloaders-swf-png-gif-examples.php
 
 I need my preloader to communicate with the application, by
 dispatching an event or calling a method on the appliaction where it
 resides, but I'm not being able to make them communicate. 
 
 Any suggestions?
 
 Thanks,
 
 João Saleiro





RE: [flexcoders] Re: Communication between custom preloader and the application

2008-09-01 Thread Alex Harui
However, a good preloader does not reference any UIComponent based classes 
otherwise they have to be loaded before the preloader can show up (which 
defeats the purpose of a preloader).  I would use the systemManager to do 
communication.  The preloader and the application can both see it.  The 
systemManager even dispatches an applicationComplete event when the application 
signals that it is ready.

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
maximecowez
Sent: Monday, September 01, 2008 6:55 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Communication between custom preloader and the 
application


Hi João,

the mx.core.Application class has a static getter 'application', so
once your application is initialized you can simply reference your
application using Application.application from within tour preloader
class.

like this:

addEventListener(FlexEvent.INIT_COMPLETE, initCompleteHandler);

private function initCompleteHandler(event:Event):void {
Application.application.doSomething();
//or
Application.application.addEventListener(Event.SOME_EVENT,
someHandler);
}

hope this helps,
Max

--- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, João 
[EMAIL PROTECTED] wrote:

 Hello,

 I have created a custom application preloader as described here:

http://www.onflex.org/ted/2006/07/flex-2-preloaders-swf-png-gif-examples.php

 I need my preloader to communicate with the application, by
 dispatching an event or calling a method on the appliaction where it
 resides, but I'm not being able to make them communicate.

 Any suggestions?

 Thanks,

 João Saleiro