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!

How to set the name of a movie-clip to a variable? 1

Status
Not open for further replies.

DrumAt5280

Technical User
Sep 8, 2003
194
US
How do I set the instance name of a movie-clip to a variable?

I tried this within the movie-clip but it doesn't work:
on (rollOver) {
var gridLabel = _root.GridHotSpot;
}

Want I want is to mouse over the movie clip "GridHotSpot" which has a instance name of "E4", I want E4 to appear in the dynamic text field named "gridLabel" which is inside the movie clip.

Thanks.

 
trace(_root.GridHotSpot._name)

Should output "E4".

Whether...

var gridLabel = _root.GridHotSpot._name;

...Would show up in your textfield, depends on your actual textfield's setup.
 
I forgot about _name, thanks. However it is not working in the output-window or the text field. I must be referencing it incorrectly. I tried the following:

trace(this.GridHotSpot._name);
trace(_parent.GridHotSpot._name);
trace(_root.GridHotSpot._name);

Each time I tried, the output-window reads "undefined".

The way I have it set up is actionscipt is located on the button "hotspot" - the "hotspot" button is located within the movie clip "GridHotSpot" - and the instance of the "GridHotSpot" is labeled "E4".
 
Can you post a link to your .fla, or a simple mockup .fla replicating the problem, zipped up and in MX only format?
 
Oldnewbie, I placed a link to the FLA file on this page:


The link says "for Oldnewbie" on the top. The file is 4meg.

Thanks for looking at it for me. I will take that link down once you have downloaded it. You will notice that the swf on the page above is a slightly different version of the FLA posted.
 
OK! Got it!
Will see what I can do and suggest! Maybe only somewhat later though!
 
Ummmmmmmmh!

Don't know anything about CF, and although with the following I get the gridLabel bit going and I can trace it, it doesn't call the appropriate picture when I use gridLabel as the value of gridId, in the on(release) handler...
Maybe you can pick it up from here? Probably knowning more about CF than I do...
Code:
on (rollOver) {
    gotoAndStop ("highlite");
	var gridLabel = this._name;
	trace(gridLabel);	
}
on (rollOut) {
    gotoAndPlay ("fade");
}
// BELOW I WOULD LIKE TO REPLACE "E4" WITH GridHotSpot._name so it will take you to the correct page
on (release) {
	getURL("[URL unfurl="true"]http://www.boulder-fsbo.com/neighborhoods/grid.cfm?gridId=gridLabel&cityId=13");[/URL]
}
 
Ahhhhhhhhhhhhhh! Had fond the appending of the variables inside the double quotes a bit curious, but did not think of trying the above!

Great if it now works as you want!

Till next time... [bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top