3 Replies Latest reply on Jul 16, 2007 10:03 AM by ntsiii

    need HELP using the flash.utils.Timer

      ** i've posted this before in the wrong category and was directed to ask the question in this forum.....

      i've built something similar to the "built in slideshow player" in flex2. My application is like a picture gallery where each picture has a description(s) - you can click on an image thumbnail and the thumbnail will appear along with its data. The image and data is pulled thru an XML file

      I would like to incorporate a button in my application that when clicked it automatically cycles thru each item(picture) using a start / stop / pause button

      I've looked at the coding behind the flex slideshow app but I'm still a novice flex coder.....can someone help me on how to get started or even just point me in the right direction??

      any help would be great thank you



      recieved 1 reply by Tracy

      Have a Timer set the selectedIndex of your display component (depending on what it is, you did not say)



      im using a tile grid with picture thumbnails, where when u click a thumbnail, the larger version of the picture appears with the associated data.

      i believe this is what you mean when you apply a "timer" to it....

      i appologize for being a complete noob when it comes to the flex language but how would i go about applying the timer to the tilegrid??

      do i have to add a <mx:script> function?
        • 1. Re: need HELP using the flash.utils.Timer
          ntsiii Level 3
          There is no "tile grid". What are you using? How are you populating it? Post some code if necessary.
          • 2. need HELP using the flash.utils.Timer
            EYEKON_1 Level 1
            sorry, not tile grid...."TILE LIST" - I appologize my background isnt of a developer/coder, I do more graphic design/web design stuff. This happened when I showed some of the execs where I work at a demo of FLEX 2.0 on the adobe site. They were like "cool...lets incorporate this into technology..." so its been a crash course ever since then for me.... well enough about that... :P

            I am populating my tile list by an external XML file.

            <mx:HTTPService id="myService" url="data/playlist.xml"/>

            code snip of my XML:

            <document seqn="1" document_id="1095" xmlns:ms="urn:schemas-microsoft-com:xslt">
            <settings />
            <name>All Div - FTM All - All Shops - All Sources</name>
            <item document_id="1095" garment_colour_id="14052" seqn="1">

            <item document_id="1095" garment_colour_id="14030" seqn="3">

            Code Snippet of my TILE LIST:

            <mx:TileList id="myTileList" dataProvider="{myService.lastResult.document.items.item}" itemRenderer="myRenderer" width="100%" height="100%" backgroundAlpha="0.0" borderStyle="none" themeColor="#333333" selectedIndex="0" cornerRadius="6" change="renderPage();"/>

            I'm trying to figure out the slideshow application that came with adobe flex. I know I have to "import flash.utils.timer" in the script area, but then I get lost on what i should include or not. The slideshow application that came with adobe flex has all this extra fancy feature which I dont really need in my application. All i want my application to do is just have a button that acts as a start and stop button that cycles thru my xml items, each having maybe a length of 4 seconds each. Fade in/Fade Out transition would be nice, but not necessary.

            I believe that I change my duration in: (copied from Adobe FLEX slideshow app)

            override protected function childrenCreated():void
            slideshowTimer = new Timer(5000, 0);
            slideshowTimer.addEventListener(TimerEvent.TIMER, onShowNext);
            controlsTimer = new Timer(3000, 0);
            controlsTimer.addEventListener(TimerEvent.TIMER, onControlsTimeOut);

            where the "5000" is where I would change it to "4000" ...correct?

            Thank You for helping me out with this, it is greatly appreciated :D

            • 3. Re: need HELP using the flash.utils.Timer
              ntsiii Level 3

              Why are you using an override method?
              override protected function childrenCreated():void

              What is controlsTimer going to do?

              First make sure the onShowNext method is getting called. (trace )

              Then increment myTileList.selectedIndex.

              Of course, you will need to check the dataProvider length and set the index to 0 when it reaches the end.