A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Help with attachMovie()

  1. #1
    Rainy Day Member eightamrock's Avatar
    Join Date
    Jun 2003
    Location
    Neshanic Station NJ
    Posts
    303

    Help with attachMovie()

    Hey guys,

    Ok I have this code
    Code:
    thumbCount = 10;
    row = 1;
    for (var k = 1; k <= this.thumbCount; k++, row++) {
    	this.attachMovie("thumb","thumb" + k, k);
    	clip = this["thumb" + k].thumb.temp.thumbholder;
    	clip.loadMovie("images/"+ k + ".jpg");
    	this["thumb" + k]._x = row * 71;
    	this["thumb" + k]._y = 175;
    }
    //
    Now the question is how do I get the following script to attach to each instance of the generated movieclips.
    Code:
    //
    on(rollOver){
    this.thumb.gotoAndPlay("in");
    }
    on(release, releaseOutside){
    loadMovie("images/" + k + ".jpg",_root.empty);
    }
    //
    As you can see Im trying to generate 10 thumbnails that when clicked open the corresponding picture.

    Is there a better way?

    Thanks In advance
    Last edited by eightamrock; 03-01-2005 at 08:43 PM.
    "Shhhhh I have insomnia and Im trying to sleep it off."

  2. #2
    Novemberain Master
    Join Date
    Sep 2004
    Location
    Void
    Posts
    390
    Code:
     this["thumb" + k].onRelease = function()
     {
    	// Needed code here
     }
    And the same way with onRollOver & onRollOut... using this keyword inside of these functions you can refer to the button you're working with. So it is possible to track image downloading progress and so on.


    Never give up...

  3. #3
    Flashkit Veteran joejoe2288's Avatar
    Join Date
    Apr 2004
    Location
    Hickville, Oregon
    Posts
    2,554
    code:

    //add this code so it runs the entire time
    for(i = 1;i <= this.thumbCount;i++) {
    this["thumb" + i].onRollOver = function() {
    this["thumb"+ i].thumb.gotoAndPlay("in");
    }
    this["thumb" + i].onRelease = this["thumb" + i].onReleaseOutside = function() {
    loadMovie("images/" + i + ".jpg",_root.empty);
    }
    }


    hope it works
    So tired of all the fighting....

    http://joejoe2288.kawanda.net

  4. #4
    Rainy Day Member eightamrock's Avatar
    Join Date
    Jun 2003
    Location
    Neshanic Station NJ
    Posts
    303
    I tried both of these methods, however all the links are looking for "11.jpg" so somewhere in the code its not posting the initial variable number from when it was created.
    hmmm.....
    "Shhhhh I have insomnia and Im trying to sleep it off."

  5. #5
    Rainy Day Member eightamrock's Avatar
    Join Date
    Jun 2003
    Location
    Neshanic Station NJ
    Posts
    303
    I figured it out for those of you who helped and are curious

    this is on the first frame of the movie
    Code:
    thumbCount = 10;
    row = 1;
    for (var k = 1; k <= this.thumbCount; k++, row++) {
    	this.attachMovie("thumb","thumb" + k, k);
    	clip = this["thumb" + k].thumb.temp.thumbholder;
    	clip.loadMovie("images/"+ k + ".jpg");
    	this["thumb" + k]._x = row * 71;
    	this["thumb" + k]._y = 175;
    	this["thumb" + k].thumb.image = k;
    	}
    this is inside the duplicated MC in the first frame

    Code:
    image = "";
    this is on the button in the MC

    Code:
    on(rollOver){
    	this.gotoAndPlay("in");
    }
    on(release){
    	loadMovie("images/"+image+".jpg",_root.empty);
    }
    Thanks for all your help

    "Shhhhh I have insomnia and Im trying to sleep it off."

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