Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

problem with a digital signage application

Guest
Jan 08, 2013 Jan 08, 2013

hello all,

i'm trying to develop a digital signage application for the company i work for, with flash cs6. it is actually composed of two applications, one is server side, and other is installed on tv displays that have an integrated computer running windows xp. the server application is nothing but a form that an administrator uses to enter data that is stored in a mysql database through some php. that is working fine.

my problem is with the client that runs in the displays. the app is actually quite simple: there are "sections" of different sorts of information that it should load from the mysql tables, therefore loading text, image and videos that are all stored in the server. thing is the loaders run in parallel with timers. the timers are responsible for calling movieclips and frames, so that i don't need to animate everything in the timeline and the app keeps running from section to section in loop. and there is where i'm finding problems. i am not being able to find a proper way to program such loaders in a way that goes along well with the timers. so the final result is that images and videos are partially or never loaded, making the client app run in odd ways. here's an example of one of the sections of the app:

import flash.utils.Timer;

import flash.display.MovieClip;

import flash.events.Event;

import flash.events.TimerEvent;

import fl.transitions.*;

import fl.transitions.easing.*;

var randomNumber:Number = Math.random();

var xAnivItemRef:Number = 75;

var yAnivItemRef:Number = 140;

var anivArray:Array = new Array  ;

var endingTimer:Timer = new Timer(10000);

var loopTimer:Timer = new Timer(500);

var counter:uint = 0;

var fotosURL:String = "http://www.maxionline.com.br/maxi_sds/server/img/aniversariantes/";

var current_time = new Date();

var i:uint = 0;

var alphaTween:Tween;

var aniversariante_mc:MovieClip;

var numAniversariantes:uint;

endingTimer.addEventListener(TimerEvent.TIMER, leaveEvents);

loopTimer.addEventListener(TimerEvent.TIMER, loadAniv);

function setTitleMonth(event:Event = null)

{

          var month:String = current_time.getMonth();

          switch (month)

          {

                    case "0" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "janeiro!";

                              break;

                    case "1" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "fevereiro!";

                              break;

                    case "2" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "março!";

                              break;

                    case "3" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "abril!";

                              break;

                    case "4" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "maio!";

                              break;

                    case "5" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "junho!";

                              break;

                    case "6" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "julho!";

                              break;

                    case "7" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "agosto!";

                              break;

                    case "8" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "setembro!";

                              break;

                    case "9" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "outubro!";

                              break;

                    case "10" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "novembro!";

                              break;

                    case "11" :

                              anivTitle_mc.anivTitlePt2_mc.month_txt.text = "dezembro!";

                              break;

                    default :

                              break;

          }

}

function anivSetup(event:Event = null):void

{

          var anivLoader:URLLoader = new URLLoader();

          anivLoader.dataFormat = URLLoaderDataFormat.TEXT;

          anivLoader.load(new URLRequest("http://www.maxionline.com.br/maxi_sds/client/dataRecoverAniv.php?_rand=" + randomNumber));

          anivLoader.addEventListener(Event.COMPLETE, getAnivData);

}

function getAnivData(evt:Event = null):void

{

          var anivDataStr:String = evt.target.data;

          var anivDataArray:Array = anivDataStr.split("&");

          var numItemsStr:String = anivDataArray[anivDataArray.length - 1].substr(5);

          var numItems:Number = Number(numItemsStr) * 4;

          numAniversariantes = numItems/4;

          anivDataArray.splice(anivDataArray.length - 1, 1);

          for (var i:uint=0; i<numItems; i++)

          {

                    anivArray.push(anivDataArray);

          }

          loadAniv();

          anivMask_mc.gotoAndPlay("on");

          endingTimer.start();

          loopTimer.start();

}

function loadAniv(event:Event = null):void

{

          var aniversariante:anivItem_mc = new anivItem_mc();

          aniversariante.name = "aniversariante" + counter;

 

          if (numAniversariantes > 12)

          {

                    if (counter < 4)

                    {

                              aniversariante.y = yAnivItemRef + (220 * counter);

                              aniversariante.x = xAnivItemRef;

                    }

                    if (counter >= 4 && counter < 8)

                    {

                              aniversariante.y = yAnivItemRef + (220 * (counter - 4));

                              aniversariante.x = xAnivItemRef + 1355;

                    }

                    if (counter >= 8 && counter < 12)

                    {

                              aniversariante.y = yAnivItemRef + (220 * (counter - 8));

                              aniversariante.x = xAnivItemRef + 250;

                    }

                    if (counter >= 12 && counter < 16)

                    {

                              aniversariante.y = yAnivItemRef + (220 * (counter - 12));

                              aniversariante.x = xAnivItemRef + 895;

                    }

          }

          if (numAniversariantes > 8 && numAniversariantes <= 12)

          {

                    if (counter < 4)

                    {

                              aniversariante.y = yAnivItemRef + (220 * counter);

                              aniversariante.x = xAnivItemRef;

                    }

                    if (counter >= 4 && counter < 8)

                    {

                              aniversariante.y = yAnivItemRef + (220 * (counter - 4));

                              aniversariante.x = xAnivItemRef + 1355;

                    }

                    if (counter >= 8 && counter < 12)

                    {

                              aniversariante.y = yAnivItemRef + (220 * (counter - 8));

                              aniversariante.x = xAnivItemRef + 250;

                    }

          }

          if (numAniversariantes > 0 && numAniversariantes <= 8)

          {

                    if (counter < 4)

                    {

                              aniversariante.y = yAnivItemRef + (220 * counter);

                              aniversariante.x = xAnivItemRef + 200;

                    }

                    if (counter >= 4 && counter < 8)

                    {

                              aniversariante.y = yAnivItemRef + (220 * (counter - 4));

                              aniversariante.x = xAnivItemRef + 1150;

                    }

          }

          anivLoader_mc.addChild(aniversariante);

          aniversariante_mc = MovieClip(root).aniv_mc.anivLoader_mc.getChildByName("aniversariante" + counter);

          aniversariante_mc.anivName_txt.text = anivArray;

          aniversariante_mc.day_mc.anivDay_txt.text = anivArray[i + 1];

          var imgLoader:Loader = new Loader();

          imgLoader.load(new URLRequest(fotosURL + anivArray[i + 3]));

          imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,imageLoading);

          imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoaded);

          var fadein:TransitionManager = new TransitionManager(aniversariante_mc);

          fadein.startTransition({type:Fade, direction:Transition.IN, duration:1, easing:Strong.easeOut});

          counter++;

          i = i + 4;

          if (i >= anivArray.length)

          {

                    loopTimer.stop();

                    loopTimer.removeEventListener(TimerEvent.TIMER, loadAniv);

          }

}

function leaveEvents(event:TimerEvent):void

{

          endingTimer.removeEventListener(TimerEvent.TIMER, leaveEvents);

          endingTimer.stop();

          anivMask_mc.gotoAndPlay("off");

          play();

}

function imageLoading(evt:ProgressEvent):void

{

          var loaded:Number = evt.bytesLoaded / evt.bytesTotal;

          updateProgress(loaded);

}

function updateProgress(vl:Number)

{

          aniversariante_mc.photo_mc.preloader_mc.loadingBar_mc.width = vl * aniversariante_mc.photo_mc.preloader_mc.loadingBar_mc.width;

}

function imageLoaded(event:Event):void

{

          var loadInfo:LoaderInfo = (event.target as LoaderInfo);

          aniversariante_mc.photo_mc.photoLoader_mc.addChild(loadInfo.content);

}

anivSetup();

setTitleMonth();

stop();

the .fla can be downloaded here:

http://www.maxionline.com.br/maxi_sds/sds_client.fla

any advice would be greatly appreciated!

many thanks!

TOPICS
ActionScript
890
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 08, 2013 Jan 08, 2013

As soon as you want to load multiple files in a time-sensitive environment, you will not get happy with the native Timer Class.

You need a flexible solution that can predict loading_times, set priorities etc.

Last year I had a project where i needed that and got very lucky to stumble upon LoaderMax

This framework has the features I mentioned, and a lot more. It´s well worth to try out and it`s free.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 09, 2013 Jan 09, 2013

Impressive! I wonder whether you would be better served (pun intended) by investing in a digital signage appliance that will take care of the zones and timing for you?  Your work would not be wasted as quite a few products work with Flash and/or HTML.  Some are very affordable and have no recurring costs.  Assuming you will need a computer to play back your content anyway, it may make sense to purchase a dedicated digital signage player and spend your time designing the content.  If you have any questions, let me know.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 10, 2013 Jan 10, 2013
LATEST

thanks moccamaximum, i'll give loadermax a try

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines