Select to view content in your preferred language

Robert's Splash Widget - setTimeout - Load Delay

1886
4
Jump to solution
01-06-2012 04:46 AM
philippschnetzer
Frequent Contributor
I have several things going on when my app first loads and if the user clicks the Agree button on the splash widget as quickly as possible the rest of things that are loading sometimes get messed up/repositioned...

So, I would like to put a short load delay on the splash widget to give everything enough time to load before the user enters the site....

Ive tried to include this:

setTimeout(init, 4000);


at the end of the init function but the initial splash page still loads and then an additional splash page loads every 4 seconds...

Thanks for helping!!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Phillip,



  Will this work for you?:

Code for the SplashTitleWindow
protected function addButtons():void             {                 for (var i:int = 0; i < _buttons.length(); i++)                 {                     var btnURL:String = _buttons.@url;                     var btnLabel:String = _buttons.@label;                     var btnAction:String = _buttons.@action;                     var btn:Button = new Button();                     btn.label = btnLabel;                     btn.name = btnURL;                     switch (btnAction)                     {                         case "close":                         {                             btn.addEventListener(MouseEvent.CLICK, btnClose);                             btn.enabled = false;                             setTimeout(enableAgree, 4000);                             function enableAgree():void{                                 Button(bGroup.getElementAt(0)).enabled = true;                             }                             break;                         }                         case "redirect":                         {                             btn.addEventListener(MouseEvent.CLICK, btnRedirect);                             break;                         }                         case "link":                         {                             btn.addEventListener(MouseEvent.CLICK, btnLink);                             break;                         }                     }                     bGroup.addElement(btn);                 }             }

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Phillip,



  Will this work for you?:

Code for the SplashTitleWindow
protected function addButtons():void             {                 for (var i:int = 0; i < _buttons.length(); i++)                 {                     var btnURL:String = _buttons.@url;                     var btnLabel:String = _buttons.@label;                     var btnAction:String = _buttons.@action;                     var btn:Button = new Button();                     btn.label = btnLabel;                     btn.name = btnURL;                     switch (btnAction)                     {                         case "close":                         {                             btn.addEventListener(MouseEvent.CLICK, btnClose);                             btn.enabled = false;                             setTimeout(enableAgree, 4000);                             function enableAgree():void{                                 Button(bGroup.getElementAt(0)).enabled = true;                             }                             break;                         }                         case "redirect":                         {                             btn.addEventListener(MouseEvent.CLICK, btnRedirect);                             break;                         }                         case "link":                         {                             btn.addEventListener(MouseEvent.CLICK, btnLink);                             break;                         }                     }                     bGroup.addElement(btn);                 }             }
0 Kudos
philippschnetzer
Frequent Contributor
Perfect, thanks Robert!!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Phillip,

   I am not sure what it looks like yet but there is suppose to be an answered button now that you push to give me points for answering your post.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Hmm... There is definitely going to be a learning curve here... You marked your own response as the answer.
0 Kudos