I need to take 10 instances of a library button and place them on different locations of the stage. I need to give each of them a unique name, URL, and position them on the stage according to database information. Any help would be great!.
If you put your button inside a movieclip then you can pick that clip from the library using attachMovie.
You'll have to set the mc an identifier and check 'export for actionscript' in the 'linkage' properties (select the clip in the library and right click to get to this option).
Then the code for attaching 10 instances would be similar to:
for (var i=1;i<=10;i++){
this.attachMovie('libraryClip', 'stageClip'+i, i);
var activeClip=this['stageClip'+i];
//pick up database info and apply it
activeClip._x=db_XValue;
activeClip.URL=db_URLValue;
}
I changed the code to this and the problem is that it makes the link for all of them the same
for(mynum = 0;mynum<5;mynum++) {
this.attachMovie('propstar', 'stageClip'+i, mynum);
var activeClip=this['stageClip'+i];
//pick up database info and apply it
activeClip._x=100 * mynum;
activeClip._y=100 * mynum;
//activeClip.URL= "
this.attachMovie('propstar', 'stageClip'+mynum, mynum);
var activeClip=this['stageClip'+mynum];
//pick up database info and apply it
activeClip._x=50 * mynum;
activeClip._y=50 * mynum;
activeClip.URL=db_URLValue;
it doesn't attach the URL to each button. I also tried getURL() function and that just loads up a bunch of pages. but it doesn't attach the URL to the actual button.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.