Slideshow of issues with a variable time for each photo

Hi all

I migrated from AS1 to AS3 and the boy, a lot has changed...

In any case, to learn and understand AS3, I'm editing a slide show that I found through thetechlabs. I want to play SWF and JPG. These files are transmitted via an XML file. I added an element called < delaytime > in the XML file, which replaces the time that a photo is displayed in the slide show.

I changed the function onSlideFadeIn() as follows:

function onSlideFadeIn():void {
     slideTimer.removeEventListener(TimerEvent.TIMER, nextSlide);
     slideTimer = new Timer(xmlSlideshow..file[intCurrentSlide].@time);
     slideTimer.addEventListener(TimerEvent.TIMER, nextSlide);
     if(bolPlaying && !slideTimer.running)
     slideTimer.start();
}

However, when I run it, I get this error message:

## [Tweener] Error: [object Sprite] raised an error while executing the 'onComplete'handler. 
TypeError: Error #1010: A term is undefined and has no properties.
at slideshow_fla::MainTimeline/onSlideFadeIn()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at caurina.transitions::Tweener$/::updateTweenByIndex()
at caurina.transitions::Tweener$/::updateTweens()
at caurina.transitions::Tweener$/onEnterFrame()

It stops at the first photo of my slide show. When I push the 'next' button, it displays the next picture, but I get the same error message again.

When I comment out this line:

slideTimer = new Timer(xmlSlideshow..file[intCurrentSlide].@time);

the slideshow works OK, but without the delaytime specified in the XML file.

I'm lost here, what am I missing?

Any help to get back on track is much appreciated!

Thanks in advance, broadband

Dirk

Here is the complete, if you need:

// import tweener
import caurina.transitions.Tweener;
// delay between slides
const TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:Number = 1;
// flag for knowing if slideshow is playing
var bolPlaying:Boolean = true;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// current slide link
var strLink:String = "";
// current slide link target
var strTarget:String = "";
// url to slideshow xml
var strXMLPath:String = "slideshow-data2.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
function initSlideshow():void {
     // hide buttons, labels and link
     mcInfo.visible = false;
     btnLink.visible = false;
    
     // create new urlloader for xml file
     xmlLoader = new URLLoader();
     // add listener for complete event
     xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
     // load xml file
     xmlLoader.load(new URLRequest(strXMLPath));
    
     // create new timer with delay from constant
     slideTimer = new Timer(TIMER_DELAY);
     // add event listener for timer event
     slideTimer.addEventListener(TimerEvent.TIMER, nextSlide);
    
     // create 2 container sprite which will hold the slides and
     // add them to the masked movieclip
     sprContainer1 = new Sprite();
     sprContainer2 = new Sprite();
     mcSlideHolder.addChild(sprContainer1);
     mcSlideHolder.addChild(sprContainer2);
    
     // keep a reference of the container which is currently
     // in the front
     currentContainer = sprContainer2;
    
     // add event listeners for buttons
     btnLink.addEventListener(MouseEvent.CLICK, goToWebsite);
     btnLink.addEventListener(MouseEvent.ROLL_OVER, showDescription);
     btnLink.addEventListener(MouseEvent.ROLL_OUT, hideDescription);
     mcInfo.btnPlay.addEventListener(MouseEvent.CLICK, togglePause);
     mcInfo.btnPause.addEventListener(MouseEvent.CLICK, togglePause);
     mcInfo.btnNext.addEventListener(MouseEvent.CLICK, nextSlide);
     mcInfo.btnPrevious.addEventListener(MouseEvent.CLICK, previousSlide);
    
     // hide play button
     mcInfo.btnPlay.visible = false;
}

function onXMLLoadComplete(e:Event):void {
     // show buttons, labels and link
     mcInfo.visible = true;
     btnLink.visible = true;
    
     // create new xml with the received data
     xmlSlideshow = new XML(e.target.data);
     // get total slide count
     intSlideCount = xmlSlideshow..image.length();
     // switch the first slide without a delay
     switchSlide(0);
}
function fadeSlideIn(e:Event):void {
     // add loaded slide from slide loader to the
     // current container
     addSlideContent();
    
     // clear preloader text
     mcInfo.lbl_loading.text = "";
    
     // check if the slideshow is currently playing
     // if so, show time to the next slide. If not, show
     // a status message
     if(bolPlaying) {
          mcInfo.lbl_loading.text = "Next slide in " + TIMER_DELAY / 1000 + " sec.";
     } else {
          mcInfo.lbl_loading.text = "Slideshow paused";
     }
    
     // fade the current container in and start the slide timer
     // when the tween is finished
     Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:onSlideFadeIn});
}

function onSlideFadeIn():void {
     slideTimer.removeEventListener(TimerEvent.TIMER, nextSlide);
     slideTimer = new Timer(xmlSlideshow..file[intCurrentSlide].@time);
     slideTimer.addEventListener(TimerEvent.TIMER, nextSlide);
     if(bolPlaying && !slideTimer.running)
     slideTimer.start();
}

function togglePause(e:MouseEvent):void {
     // check if the slideshow is currently playing
     if(bolPlaying) {
          // show play button
          mcInfo.btnPlay.visible = true;
          mcInfo.btnPause.visible = false;
         
          // set playing flag to false
          bolPlaying = false;
          // set status message
          mcInfo.lbl_loading.text = "Slideshow paused";
          // stop the timer
          slideTimer.stop();
     } else {
          // show pause button
          mcInfo.btnPlay.visible = false;
          mcInfo.btnPause.visible = true;
         
          // set playing flag to true
          bolPlaying = true;
          // show time to next slide
          mcInfo.lbl_loading.text = "Next slide in " + TIMER_DELAY / 1000 + " sec.";
          // reset and start timer
          slideTimer.reset();
          slideTimer.start();
     }
}
function switchSlide(intSlide:int):void {
     // check if the last slide is still fading in
     if(!Tweener.isTweening(currentContainer)) {
          // check, if the timer is running (needed for the
          // very first switch of the slide)
          if(slideTimer.running)
          slideTimer.stop();
         
          // change slide index
          intCurrentSlide = intSlide;
         
          // check which container is currently in the front and
          // assign currentContainer to the one that's in the back with
          // the old slide
          if(currentContainer == sprContainer2)
          currentContainer = sprContainer1;
          else
          currentContainer = sprContainer2;
         
          // hide the old slide
          currentContainer.alpha = 0;
          // bring the old slide to the front
          mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
         
          //Van hier
          if (currentContainer.numChildren > 0) {
               var slideObjRef:DisplayObject = currentContainer.getChildAt(0);
               currentContainer.removeChildAt(0);
               slideObjRef = null;
          }
         
          //Tot hier
         
          // delete loaded content
          clearLoader();
         
          // create a new loader for the slide
          slideLoader = new Loader();
          // add event listener when slide is loaded
          slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
          // add event listener for the progress
          slideLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
          // load the next slide
          slideLoader.load(new URLRequest(xmlSlideshow..image[intCurrentSlide].@src));
         
          // show description of the next slide
          mcInfo.lbl_description.text = xmlSlideshow..image[intCurrentSlide].@title;
         
          // set link and link target variable of the slide
          strLink = xmlSlideshow..image[intCurrentSlide].@link;
          strTarget = xmlSlideshow..image[intCurrentSlide].@target;
          mcInfo.mcDescription.lbl_description.htmlText = xmlSlideshow..image[intCurrentSlide].@desc;
         
          // show current slide and total slides
          mcInfo.lbl_count.text = (intCurrentSlide + 1) + " / " + intSlideCount + " Slides";
     }
}
function showProgress(e:ProgressEvent):void {
     // show percentage of the bytes loaded from the current slide
     mcInfo.lbl_loading.text = "Loading..." + Math.ceil(e.bytesLoaded * 100 / e.bytesTotal) + "%";
}
function goToWebsite(e:MouseEvent):void {
     // check if the strLink is not empty and open the link in the
     // defined target window
     if(strLink != "" && strLink != null) {
          navigateToURL(new URLRequest(strLink), strTarget);
     }
}
function nextSlide(e:Event = null):void {
     // check, if there are any slides left, if so, increment slide
     // index
     if(intCurrentSlide + 1 < intSlideCount)
     switchSlide(intCurrentSlide + 1);
     // if not, start slideshow from beginning
     else
     switchSlide(0);
}
function previousSlide(e:Event = null):void {
     // check, if there are any slides left, if so, decrement slide
     // index
     if(intCurrentSlide - 1 >= 0)
     switchSlide(intCurrentSlide - 1);
     // if not, start slideshow from the last slide
     else
     switchSlide(intSlideCount - 1);
}
function showDescription(e:MouseEvent):void {
     // remove tweens
     Tweener.removeTweens(mcInfo.mcDescription);
     // fade in the description
     Tweener.addTween(mcInfo.mcDescription, {alpha:1, time:0.5, y: -37});
}
function hideDescription(e:MouseEvent):void {
     // remove tweens
     Tweener.removeTweens(mcInfo.mcDescription);
     // fade out the description
     Tweener.addTween(mcInfo.mcDescription, {alpha:0, alpha:1, time:0.5, y: 25});
}
function clearLoader():void {
     try {
          // get loader info object
          var li:LoaderInfo = slideLoader.contentLoaderInfo;
          // check if content is bitmap and delete it
          if(li.childAllowsParent && li.content is Bitmap){
               (li.content as Bitmap).bitmapData.dispose();
          }
     } catch(e:*) {}
}
function addSlideContent():void {
     // empty current slide and delete previous bitmap
while(currentContainer.numChildren){Bitmap(currentContainer.getChildAt(0)).bitmapData.dispose(); currentContainer.removeChildAt(0);}
// create a new bitmap with the slider content, clone it and add it to the slider container
var bitMp:Bitmap = new Bitmap(Bitmap(slideLoader.contentLoaderInfo.content).bitmapData.clone());
currentContainer.addChild(bitMp);
}
// init slideshow
initSlideshow();

almost everything is possible.  There is no way to tell without looking at your xml file.

Create a new fla, load your xml and make great use of the trace function to see what you do.

Tags: Adobe Animate

Similar Questions

  • I look integrated in the block of the legend of slide show, a widget like "Accordion" for, with one click, or by the way with the mouse, open a new caption for each photo. I tried with 'Accordion' Muse, it does not work. I haven't tried to copy and paste,

    Issue.

    I look integrated in the block of the legend of slide show, a widget like "Accordion" for, with one click, or by the way with the mouse, open a new caption for each photo. I tried with 'Accordion' Muse, it does not work. I haven't tried to copy and paste, but no result. The widget disappear into the legend of block. disappear. Do you have a solution?

    Thank you

    Loïc

    Accordion Panel tabs should, with click and open the container.

    Please provide the url of the site where it does not, also if you can provide an example where we can see the exact action, then it would help us.

    Thank you

    Sanjit

  • How to measure the time for each mapping?

    I use oracle11g with OWB.

    I have several mapping and each dimension tables to update the mapping.

    I want to measure how long it takes to complete each mapping. What is the best way to find the total time for each mapping.

    One way is, we can have POST MAPPING and PROCESS of MAPPING PRE. I can trigger the stored procedure to enter the start time and the end time of each match. On this basis, I can calculate the total time for each mapping. But I have 50 mapping. Now, I need to write 50 different stored procedure and open the POST-PROCESSING of the MAPPING and PROCESS OF MAPPING of the PRE for each mapping. It is complex.

    Is there another way, we enter the total for each mapping of execution? Y at - it that no data in OWF_ MGR dictionary can help on this?

    I would be grateful if someone can help me on this.

    He will remain forever unless you purge it explicitly.

    See you soon
    Katia

  • For the last week or three Firefox updated two or three times for each update and sometimes for no apparent reason...

    For the last week or three Firefox updates two or three times for each update. Sometimes it refreshes without obvious reason. For example, I'll be in the middle of typing in the message forum block & it refreshes. Or by filling out an online form. Or simply viewing a page.

    You can check for problems caused by an extension that is not working properly.

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance).

    • Do NOT click on the reset button on the startup window Mode without failure.
  • How to acquire of various AI channels simultaneously with a different range for each of them?

    How to acquire of various AI channels simultaneously with a different range for each of them?

    In LabView, I found some examples but in C it is not seem to be any.

    Or you can add channels one by one with individual instructions: the follwing code compilation and runs without error on vitual DAQ hardware:

    ERR = DAQmxCreateTask ("", &taskH); ")
    ERR = DAQmxCreateAIVoltageChan (taskH, ' Dev1/ai0', 'AI0', DAQmx_Val_Cfg_Default,-5,0, 5.0, DAQmx_Val_Volts, "");
    ERR = DAQmxCreateAIVoltageChan (taskH, ' Dev1/ai1', 'AI1', DAQmx_Val_Cfg_Default,-10,0, 10.0, DAQmx_Val_Volts, "");
    DAQmxStartTask (taskH);
    ERR = DAQmxReadAnalogF64 (taskH, 5, 10.0, DAQmx_Val_GroupByChannel, val, 10, & read, 0);
    DAQmxClearTask (taskH);

  • Select the emp with a maximum salary for each hr.emp manager_id

    Hello
    Can someone help me to do this without doing any partitioning or analytical f:

    Select the emp with a maximum salary for each hr.emp manager_id.

    HR. EMPLOYEES Table Description: =.
    EMPLOYEE_ID
    FIRST NAME
    LAST_NAME
    HIRE_DATE
    JOB_ID
    SALARY
    COMMISSION_PCT
    MANAGER_ID
    DEPARTMENT_ID

    TX, all the guys
    Mario

    Hi, Mario,.

    Here's one way:

    SELECT       *
    FROM       hr.employees
    WHERE       (manager_id, salary) IN (
                                          SELECT    manager_id
                              ,               MAX (salary)
                              FROM     hr.employees
                              GROUP BY  manager_id
                                   )
    ;
    

    mario17 wrote: Hi,
    Can someone help me to do this without doing any partitioning or analytical f:

    Do you mean analytical functions?
    Why you don't want to use the analytical functions? Analytical functions, permitting the simpler, more robust and more effective to achieve these results, wouldn't you want that?

  • Web Gallery - different caption for each photo - broken?

    It's something I've done successfully with versions before LR2.5 but for some reason that I cannot now create different captions for each photo.  The help page in line said: "to display a different caption or title for each photo, click on the menu of settings customized to the right of title or a legend and choose Edit. In the patterns of text editor that appears, insert the IPTC title or caption metadata element, and then click Done. »

    This does not happen.  If I create a title for the first photo, it appears for all others.  If I change the caption for the second picture, everything changes, including the first caption of the photo.  Is this a new bug, or am I just missing something?

    I can always change the HTML gallery, but it is not an elegant solution, to say the least.

    Help appreciated.

    DN

    Enter the title or caption in the library, in the metadata Panel. And select the items in the grid. The titles that you change apply to the web gallery, not the individual photos.

  • I want different titles for each photo in a web gallery. The help file says:

    To display a different caption or title for each photo, click on the menu of settings customized to the right of title or a legend and choose Edit. In the model text editor that appears, insert the piece of metadata, IPTC title or caption, and click done.


    But what I do, the latest edition is for every picture the same.


    I have to select the image in a different way, I've already tried?

    Has chosen not to change, choose TITLE and LEGEND in the drop-down list.

    Then change the TITLE and CAPTION for each photo in the library/metadata Panel

    Then, each photo will be another caption/title

  • analyze two times for each run?

    Oracle 11.2.0.3 Std Ed One

    Oracle Linux 64-bit 5.6

    New guy was trying to use MS Data Integrator for 1.7 million lines of charge of MSSQL to Oracle.  Process took more than 4 hours.  I started an on the session 10046 trace, let it run for about 5 minutes, then produced the report tkprof.  As I expected, the process was slow-by-slow transformation, issuing an INSERT for each line.  But what I wasn't expecting, it is the count analysis was twice the number of execution.  I am at a loss to explain this.

    callCountycentral processing unitelapseddiscquerycourselines

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Parse 832261.211.210000
    Run 4161341,4143.1954173228278641613
    Go get 0.000.000000

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Total 12483942,6244,4154173228278641613

    Chess in the library during parsing cache: 1

    Lack in the library during execution cache: 1

    Optimizer mode: ALL_ROWS

    I convinced the new guy to let me write a simple PL/SQL proc to do an INSERT... SELECT and it ran in under 4 minutes...  but I'm still curious about this count analysis.  In fact, I'm a bit puzzled by the results on my proc as well.  This time, 1 run (as expected) but ZERO parsed?

    callCountycentral processing unitelapseddiscquerycourselines

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Parse00.00
    0.000000
    Run1106.03193.34144849822433678739292
    Fetch00.000.000000

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    total1106.03193.34144849822433678739292

    Chess in the library during parsing cache: 0

    Lack in the library during execution cache: 1

    Optimizer mode: ALL_ROWS

    The analysis of the user id: 656(recursive depth: 1).

    Clearly it 'parse' without 'run '.

    I've seen this before.

    Here is an example how it occurs when:

    SQL statement with some analysis but no executions or extraction on the remote database SQL Distributed (Doc ID 580301.1)

    Analysis number is high, but no executions (Doc ID 1335913.1)

  • Breaking point taking up too much time for each step for every time to Jdeveloper 11.1.1.7

    Hi all

    I use Jdeveloper to ADF application development 11.1.1.7 and I use 64 bit JDK. When I run my application in debug mode, if the program control passes to the location of the breakpoint taking too in time for the next step (F8) a few times because of this I need to restart the server from WL. During this time of progress/loading showing symbol on the screen. I don't know why this is happening... ? Please someone help me on this.

    Vinoth-

    Try closing the Panel of the Structure of the ADF. I noticed a lot of requres JDev struggle to maintain synchronization with the Structure of the ADF. It helps in the design of JSF page and in brakepoints in support beans and other JSF related classes.

    I also had problems with 64 bit JDK on Windows and came back to 32-bit. (do not remember if I had WLS crashes but I know I had a lot of problems)

    Try growing JDev memory and heap WLS.

  • get the time for each transaction

    Hi Master,

    Someone asked me a question.

    I have a pl/sql block with multiple DML operations. How do you know how much time took each DML operation (not on a single table, tables different operations are underway in my pl/sql block)?  Like this

    Update statement

    INSERT statement

    Remove the statement

    I replied like that... Use dbms_utility.get_time... If each statement how long it takes... We can easily find...!  Once, he said... no I want to use predefined packages. DBA does not accept.

    How can I fix this... Masters?

    Please advise... !!!

    Concerning

    AR


    DBA will no longer accept pkgs installation... !!

    Create an account of RTO and defend his position to not use standard Oracle supplied packages, take the DBA.

    Therefore, these packages should already be installed.

    (Some essential element of the information seems to be missing).

    Since no valid rationale was given for this crazy requirement (IMHO), the correct solution may possibly be: replace your DBA.

    (I'd love to hear from experienced 'why' people, this requirement would be valid.)

    MK

  • Setting date and time for several photos

    Thank you for providing the space for new users and thank you in advance for your help.

    Currently, I'm moving across lightroom and apple aperture/iphoto 5.

    The part of OCD I like to have my library organized, and I noticed that when I transferred my library everywhere he is in a bit of a mess, so I'm currently putting together the library and it cleaning (around 18000 photos)

    Anyway, I almost settled on a folder structure (YYYY/MM - I for the number of photos I have try on the nut until days could be for many - happy to receive Advisor on it also)

    For the most part, the photos have the date and time of the beginning of the digital age (for me from 2006)

    Photos prior to 2006 are in the negative, and I am currently underway with these scanned and imported into the library, I have a lot each month.  Set the date and time from the date of creation, this is where I am running into trouble.

    I looked around the web and various forums without success.

    First of all, I organize the pictures in the correct order.  Then I select the first photo and then select it the remaining photos.  I then select the date/time setting in the menu and select the first option, ajuster to adjust to the new date and time, say on 01/01/1990 to 1200 hours.

    The result I get is the first photo (the photo so good term) 01/01/1990 @ 1200 as the date and time, others have 01/01/1990 Date (if I'm lucky), and the time of jumping around.  Sometimes it wont even change the date time for the remaining photos.

    What I want to achieve is the time even for all the photos when I select a lot, or increment in time by a lump (is to say 1 minute (1200/1201/1202) or 1 second (1200:00 / 1200:01 / 1200:02)) and I seem not to be able to work it to do this automatically, currently, I have to do this by adjusting each photo (some 200 at a time) which is really manual labor)) intensive

    Thanks in advance and hoping an easy solution

    Concerning


    Dean

    I have had success using EXIF change of Basepath.com, but is not

    free. There are other publishers had EXIF free that may be useful to

    you. Some are better than others, and all have a learning curve. I suggest

    make a copy of some files you want to change and make a test of some of

    the available candidates. Search for "EXIF editors" and you can see what is

    available.

  • Export PNG with the correct name, for each layer, script file frame foreach

    Hello guys,.

    I am trying to find a script that exports each separately from the layer in PNG, for each image, with the correct name. By example, if the layer is named snail and lies in a forest of group name and is like 6, export this layer as a PNG named forest.snail.06.png (recursion if possible) and this for each layer, for each image...

    I found a software named Layerex, they speak here about layers export Flash | Global Facilitation network

    But I could not find... If you guys know how to do, it would be so awesome...

    Take care

    Simon

    Using jsfl.

  • How to set the time for each slide in the slide show?

    Length of blade, pan and zoom, melted chained, etc. is adjustable for each slide or have all the same?

    If they can be individualized, what I don't see.

    Use Lightroom CC 2015.

    Thank you

    Leo Sopicki

    These features are not in the Lightroom Slideshow module. You will need to use another third party software to create these types of slideshows.

  • Essbase - lead time for each statement in difficulty

    Hello world

    is there a way to monitor the execution of each statement to fix time in a business rule? I mean using a log file that returns the time as each statement of correction required for its calculation.

    Thank you all ;)

    Maurizio

    Published by: MauriceFIX on 6-mar-2013 3.28

    You can take a look on the essbase application log, it is also useful to have a read of the following calculation
    SET MSG - http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/frameset.htm?set_msg.html
    NOTICE - the VALUE http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/frameset.htm?set_notice.html

    See you soon

    John
    http://John-Goodwin.blogspot.com/

Maybe you are looking for