Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clip link..

Status
Not open for further replies.

iranor

Programmer
Jun 17, 2004
174
CA
Hi everyone.

I have a swf file that contains only clips, numbered from 1 to 20.

Another swf file need to load that file and display the different clips in a small "clip holder" resizing them to display. (clip holder is a two-piece clip, that displays the number on the bottom and the image on the top).

The problem I got, is that my main clip tries to load the clip holder pieces in the library swf. How can I load the clip holder pieces from the main clips, but import in its image zone the image from the library? Also, I would appreciate any hint to improve my code :)

This is my code:
Library.swf
Code:
  var FramesList = new Array(1, 2, 3, 4, 5, 6, 7); //I don't know if there are ways of getting an array of the frames in a clip, so i'm using this
  var FramesAmount = FramesList.length;

  //in the library, there are 20 simple clips numbered from 1 to 20.

Main.swf
Code:
function setSprites(sFile)
{
   this.createEmptyMovieClip("SpritesHolder", 1);
		
   var SpritesLoader = new MovieClipLoader();
   SpritesLoader.addListener(this);
   SpritesLoader.loadClip(sFile, SpritesHolder);
}

function onLoadInit(SpritesMc)
{
   for(var i=0; i<4; i++)
   {
      var SpriteID = SpritesMc.FramesList[i];

      SpritesHolder.attachMovie("ClipHolder", "ClipHolder"+i, 10+i, {_x: 134*i, y:0, ClipID: SpriteID});
     
      var HolderLink = eval("this.SpritesHolder.ClipHolder"+i);
      HolderLink.ClipImage.attachMovie(SpriteOD, "Clip"+SpriteID, 5+i, {_x:0, _y:0});
   }

ClipHolder clip
Code:
//This clip has 1 clip for the image (ClipImage) and a text zone for the clip ID. It resize them using xscale and yscale and adds a small red point at its x=0, y=0 location.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top