Button code problem

Hi i have a problem with telling flash to look for my movie clip problem is that it has no instance name as the movie clip is added via action script but it has a linkage id called pane7, and within the movieclip has a button called one so how do i tell flash to look for this?

pane7.one.onRelease = function() {
gotoAndPlay(10);
}

If you attach it you have to give it a new (instance) name

this.attachMovie("pane7", "new_mc", 99)

and then you can refer to the new name

new_mc.one.onRelease = function() {
//if you want 'one' to gotoandplay 10
this.gotoAndPlay(10);
}

or if the path is more complicated

var new_mc = nav.top_mc.attachMovie("pane7", "new_mc", 99);
new_mc.one.onRelease = function() {
this.gotoAndPlay(10);
}

scotty(-:

*EDIT

yes that works but not quite, it creates a new instance (sorry maybe i wasnt clear enough on what i wanted or what was happering the movie clip pane7 is already on the timeline moving spining around with other images and when you click on pane7 it jumps to frame 10 on the timeline

this link is the source file
http://www.funnycrew.co.uk/SpinningImages15.fla

Many thanks for your help

Next time use [noparse]


[/noparse] tags for readibility
If I look at your original question I think you want this

for (i=0; i<16; i++) {
	attachedObj = theScene.attachMovie(paneArray*, "pane"+i, i);
	attachedObj.angle = angleStep*i;
	attachedObj.radius = 170;
	attachedObj.x = Math.cos(attachedObj.angle)*attachedObj.radius;
	attachedObj.z = Math.sin(attachedObj.angle)*attachedObj.radius;
	attachedObj.y = 30;
	attachedObj.display = displayPane;
	objectsInScene.push(attachedObj);
	attachedObj.one.onRelease = function() {
		this.gotoAndPlay(10);
	};
}

scotty(-:

[quote=scotty]Next time use [noparse]


[/noparse] tags for readibility

ill rember that for next time,

sorry but did you read my edit imade which should be alot clearer thanks

LOL, no where do think I got your code from:)
You want every pane to goto frame 10?

scotty(-:

:slight_smile: no different frames if possible but i only really need pane7 to go to frame 10 thanks

Here you go, I’ve left some panes out of the code, you can add these.
Important is that you give the button (in all the panes) an instancename ‘one’

stop();
this.createEmptyMovieClip("theScene", 1);
theScene._x = 290;
theScene._y = 220;
objectsInScene = new Array();
//twodimensional array the number is the frame you want goto
var paneArray:Array = [["pane", 10], ["pane1", 20], ["pane2", 30], ["pane3", 40], ["pane4", 50], ["pane5", 60], ["pane6", 70], ["pane7", 10]];
spin = 0;
focalLength = 250;
displayPane = function () {
	var angle = this.angle-spin;
	var x = Math.cos(angle)*this.radius;
	var z = Math.sin(angle)*this.radius;
	var y = this.y;
	var scaleRatio = focalLength/(focalLength+z);
	this._x = x*scaleRatio;
	this._y = y*scaleRatio;
	this._xscale = this._yscale=40*scaleRatio;
	this.swapDepths(Math.round(-z));
};
angleStep = 2*Math.PI/15;
for (i=0; i<15; i++) {
	//get the first element of each array item
	attachedObj = theScene.attachMovie(paneArray*[0], "pane"+i, i);
	attachedObj.angle = angleStep*i;
	attachedObj.radius = 160;
	attachedObj.x = Math.cos(attachedObj.angle)*attachedObj.radius;
	attachedObj.z = Math.sin(attachedObj.angle)*attachedObj.radius;
	attachedObj.y = 30;
	attachedObj.display = displayPane;
	//give each pane its id
	attachedObj.id = i;
	//inside the panes give all the buttons an instancename one
	attachedObj.one.onRelease = function() {
		_root.gotoAndStop(paneArray[this._parent.id][1]);
	};
	objectsInScene.push(attachedObj);
}
panCamera = function () {
	spin += this._xmouse/4000;
	for (var i = 0; i<objectsInScene.length; i++) {
		objectsInScene*.display();
	}
};

scotty(-:

THANKS thats perfect i bow down to the Flash Guru :slight_smile:

sorry to ask for you help again scotty but, for some reason when you click on pane7 and it gotos frame 10 the carosuel is still there even though inthe time line the action script isnt placed at frame 10 so how can i get the carasouel to stop and disapear when u click on a pane and if i add a back button to say frame 10 the carasouel reapears? thanks here my new sourse file

http://www.funnycrew.co.uk/web2.fla

to view the effect click link below (but dont worrie about the gap that appear in the caroseul effect because pane13 and 14 for some reason where playing up when i created that swf)

http://www.nwmsltd.com/shared2.html

thanks again martin

Here you go:

displayPane = function () {
	var angle = this.angle-spin;
	var x = Math.cos(angle)*this.radius;
	var z = Math.sin(angle)*this.radius;
	var y = this.y;
	var scaleRatio = focalLength/(focalLength+z);
	this._x = x*scaleRatio;
	this._y = y*scaleRatio;
	this._xscale = this._yscale=40*scaleRatio;
	//changed next line so all panes are on a removable depth
	this.swapDepths(8000+Math.round(-z));
};
angleStep = 2*Math.PI/15;
for (var i = 0; i<15; i++) {
	//get the first element of each array item
	attachedObj = theScene.attachMovie(paneArray*[0], "pane"+i, i);
	attachedObj.angle = angleStep*i;
	attachedObj.radius = 160;
	attachedObj.x = Math.cos(attachedObj.angle)*attachedObj.radius;
	attachedObj.z = Math.sin(attachedObj.angle)*attachedObj.radius;
	attachedObj.y = 30;
	attachedObj.display = displayPane;
	//give each pane its id
	attachedObj.id = i;
	//inside the panes give all the buttons an instancename one
	attachedObj.one.onRelease = function() {
		_root.gotoAndStop(paneArray[this._parent.id][1]);
		//remove the panes
		removePanes();
	};
	objectsInScene.push(attachedObj);
}
function removePanes() {
	for (var i = 0; i<15; i++) {
		theScene["pane"+i].removeMovieClip();
	}
}

In the target frames have a back button that with gotoAndStop(1) action

scotty(-: