i have a swf, that creates 12 buttons dynamically from sites.txt by duplicating b_transmitter, then it is positioned onscreen. when a button is Roledlover i want to create a movie clip that is 50px X 50px and positioned on top of the button that created it and centered.
ive had a go, but its a bit screwy. the newly created movieclip inherits some of the button features such as the rollover function and wont center on the button but rather top left aligned.
the swf can be found http://www.cghub.co.nz/ethermap/test/index.htm
Code:b_transmitter._visible= false; //hide transmitter. will be duplicated files = new Array(); lv = new LoadVars(); lv.onLoad = function() { count=0; // transmitters in format of id|name|easting|northing|range fl = this.transmitters; files = fl.split("|"); c = files.length-1; for (i=0; i<c; i++) { duplicateMovieClip ("b_transmitter", files[i], i); button = eval(files[i]); button.location_id = files[i]; i++; button.location_name = files[i]; i++; var_easting = files[i]; var_x = 2730000 - var_easting; var_x_percent = var_x/120000; var_x_percent = 1-var_x_percent; var_x = 1200 * var_x_percent; setProperty (button, _x, var_x); button.easting = var_x; i++; var_northing = files[i]; var_y = 6520000 - var_northing; var_y = var_y/100; setProperty (button, _y, var_y); i++; button.location_range = files[i]; trace(button+ "count=" + count); button.onRollOver = function () { reset_buttons(); this.nextFrame(); var button_x = this._x var button_y = this._y this.createEmptyMovieClip("range",this.getNextHighestDepth()); with (this.range) { _x = 0; _y = 0; trace("button_x - " + button_x); //drawCircle(size); lineStyle(0.1, 0x97BE6B, 100); beginFill(0x0000FF,25); moveTo(0, 0); lineTo(50, 0); lineTo(50, 50); lineTo(0, 50); lineTo(0, 0); } }; button.onRollOut = function() { // this.range.removeMovieClip(); } count=count+1; } } lv.load("sites.txt"); reset_buttons = function(){ c = files.length-1; for (i=0; i<c; i++) { _root[files[i]].gotoAndStop(1); i=i+4 } }




Reply With Quote