dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with rotator code

  1. #1
    Junior Member
    Join Date
    Jul 2004
    Posts
    19

    Help with rotator code

    Ok, I've been going through the code in this tutorial:
    http://www.flash-db.com/Tutorials/lo...ata.php?page=1

    I've got some issue with the code below. I need to know how to access the properties of the loaded clip(s) so I can tell when it is finished and load another one from the array.

    This is the output of the banner.php script(wrapped for readability):
    Code:
    image0=http://www.listinventory.com/file_uploads/banners/banner.swf&
    image1=http://www.listinventory.com/file_uploads/banners/crimp.swf&cant=2
    Code:
    import fl.containers.UILoader;
    
    var ar_movies:Array = new Array();
    var ar_links:Array = new Array();
    
    //Create the URLLoader instance
    var xLoader:URLLoader = new URLLoader();
    var aLoader:UILoader  = new UILoader;
    
    addChild(aLoader);
    aLoader.scaleContent = false;
    aLoader.height = 90;
    aLoader.width = 715;
    
    //the data will come as URL-encoded variables
    xLoader.dataFormat = URLLoaderDataFormat.VARIABLES
    
    //Load using an URLRequest
    xLoader.load(new URLRequest("http://www.listinventory.com/libs/class/banner.php"));
    
    //onLoad handler listener
    xLoader.addEventListener(Event.COMPLETE, onDataLoad)
    
    //add a listener for the complete event
    function onDataLoad(evt:Event){
      for(var i:uint=0; i<evt.target.data.cant; i++){
        // Push the values into the arrays
        this.ar_movies.push(evt.target.data["image"+i]);
        this.ar_links.push(evt.target.data["link"+i]);
      }
      // Now load the first movie into the loader
      aLoader.source = ar_movies[0]; // movie now shows!!!
    
    }
    // Now, how do I setup an event listener to wait for the 
    // movie to finish and then load the next one in the UILoader?

  2. #2
    Junior Member
    Join Date
    Jun 2010
    Posts
    9
    use timer, else - is impossible

  3. #3
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You can dispatch an event from your childmovie and listen to it in your parent movie. Another possibility is to use this scheme, which works also for movie communication.

    http://flashscript.biz/flblogger/?p=10
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center