PDA

View Full Version : cant create instance name on movie clip. plz help


gabadoo
04-05-2002, 02:25 PM
hello this is prolly a supernewb question, but Im stuck and need help. I was doing the attachmovie tutorial, and i understand how everything works, however when i try to do the following
"newname A unique instance name for the movie clip being attached" I am stumped. for instance say i have movie clip A and B. A is on the timeline somewhere and movie clip B is in the library. I can set the instance name for movie clip A becuase its on the stage. I set the linkage property for movie clip B and give it a unique indentifier, but how do i set the instance name for movie clip B if its not on the stage.
the example has a button which calls the instance name for the clip of "newname1", but how did they set that.
on(release) {
main.attachMovie("att1", "newname1", 1);
}

Any help would be greatly appreciated, and remember Im a newb so asumme nothing hehe. Ok thanks

Gabriel

jimburton
04-05-2002, 02:44 PM
If it's just a one-off then you can call the new instance whatever unique name you like:

main.attachMovie("att1", "newname1", 1);

is fine where the clip has the linkage name att1 and _level1 is free. If you want to attach a series of them then you frequently need to do things like:

topdepth=10;
xPos = 50;
yPos=50;
for(var i=0;i<myVar;i++) {
main.attachMovie("att1","newname"+i,topDepth);
main["newname"+i]._x = xPos;
main["newname"+i]._y = yPos;
topDepth++;
yPos+=25;
}

which would attach clips called "newname0" at level 10, "newname1" at level 11 etc starting at 50,50 then at 50,75...50,100 etc

Does that help any?

gabadoo
04-07-2002, 12:20 AM
umm, i think my question was not clear. Im having problems giving movie clip B an instance name. The second movie clip is in the library, but when i open up the instance panel, the fields are grayed out, so i cannot give it an instance name. However when i move the clip onto the stage, I am then able to give it an instance name. But i dont want it on the stage, i want to load it from clip A which is on the main timeline. So Im missing something obvios here, but I just dont see it, hehe. Ok thanks for the reply, and other suggestions?

FiZzIk
04-07-2002, 05:09 AM
you seem to have misunderstood, the button attaches the clip (defined by the linkage name) att1, it is then given the UNIQUE instance name of newname1 (because if two mc's were called the same name how would they know who you are talking to), then you place it on a certain level.


on (release) {
main.attachMovie("att1", "newname1", 1);
}


att1 = the linkage name you specify for the movie you want to attach

newname1 = this will BECOME the instance name of the attached movie

1 = the level you are attaching the movie to