A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Simple quesiton for createEmptyMovieClip in AS2

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Posts
    2

    Simple quesiton for createEmptyMovieClip in AS2

    Hi there,

    I was working on dynmic loading contents, I have done some code to list all thumbs on the stage and was going to assign URL for each moveclip.

    It seems doesn't work for assigning links at the moment. Would you please help me take a look of this? Anything wrong?

    Cheers

    Code:
    var thumbHorizontalGap = 110;
    //var url:String = "http://img0.gmodules.com/ig/images//weather_welcome_image.jpg";
    
    var arrURLs:Array = ["http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/perilendhouse/perilendhouse-100.gif", "http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/sallyssalon/sallyssalon-100.gif", "http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/riseofatlantis/riseofatlantis-100.gif"];
    
    for (var i:Number = 0; i < arrURLs.length; i++) {
    	var url:String = arrURLs[i];
    
    	_root.createEmptyMovieClip("vThumb"+i, i+1000);
    	vidThumb = eval("vThumb"+i);
    
    	vidThumb._y = i*thumbHorizontalGap;
    	vidThumb.loadMovie(url);
    
    	vidThumb.onRollOver = function() {
    		getURL("http://www.google.com","_self");
    	};
    	
    	//trace(vidThumb);
    }
    
    /*
    function openURL(url) {
    
    getURL(url);
    
    }
    */

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    PHP Code:
    var thumbHorizontalGap 110;
    //var url:String = "http://img0.gmodules.com/ig/images//weather_welcome_image.jpg";

    var arrURLs:Array = ["http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/perilendhouse/perilendhouse-100.gif""http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/sallyssalon/sallyssalon-100.gif""http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/riseofatlantis/riseofatlantis-100.gif"];

    for (var 
    i:Number 0arrURLs.lengthi++) {
        var 
    url:String arrURLs[i];

        
    vidThumb this.createEmptyMovieClip("vThumb"+ii+1000);
        
    vidThumb.createEmptyMovieClip("holder",1);
        
    vidThumb._y i*thumbHorizontalGap;
        
    vidThumb.holder.loadMovie(url);

        
    vidThumb.onRollOver = function() {
            
    trace(this._name);
            
            
    //getURL("http://www.google.com","_self");
        
    };

    create a holder to load images. The replace the mc they are loaded into, thus deleting your rollOver code.

    gparis

  3. #3
    Junior Member
    Join Date
    Jan 2008
    Posts
    2
    wowow.. AWESOME!

    I was curious, why we have to create another MC to load the image. humm... in my code, vidThumb has already assigned to be a MC and loads images.

    Cheers

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    why we have to create another MC to load the image
    The (images) replace the mc they are loaded into, thus deleting your rollOver code
    gparis

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