I have several buttons(its a map project) with several country maps.
I would like to on rollover to have the name of country to change.
I tried this:
-
created a dynamic text field called “txtfield” and placed it strategically where I want the text to appear and change based on the map selected/rolled over.
-
I have added the following script to the button:
on(rollover) {
txtfield.txt = “IRAQ”;
}
it did not work…
what do I do wrong, please.
first, it shouldn’t be
txtfield.txt = "IRAQ";
but
txtfield.text = "IRAQ";
so it is “text” after the dot, not “txt”; and second, I suggest to put the code for the buttons in the timeline, not attached directly to the buttons; I mean you have to give buttons instance names and then refer to them by actionscript in the timeline, like:
myButtonInstanceName.onRollOver = function(){
txtfield.text = "IRAQ"
}
cheers…
Thank you, thank you, exactly… it worked… now similar question
how to change the image using the same method:
- createa place holder for the image(how) and then use same process to have it changed???
could you pleas help a bit more.
I wil appreciate it.
thank you
iraq.onRollOver = function(){
txtfield.text = “IRAQ”;
mctrans.image = “flag_iraq.jpg”;
}
iraq.onRollOut = function(){
txtfield.text = “”;
mctrans.image = “”;
}
I know it is wrong…
I created an empty movie clip, named it in the properties window for AC as “mstrans”
I was hoping to have it working, obviously – I failed.
ok, i figure it out:
- open library and drag the Loader component onto the stage.
- give it a AC name “mc_loader”
- in the action layer add these(in blue)
iraq.onRollOver = function(){
txtfield.text = “IRAQ”;
[COLOR=“Blue”]mc_loader.contentPath = “flag_iraq.png”;[/COLOR]
}
iraq.onRollOut = function(){
txtfield.text = “”;
[COLOR=“Blue”]mc_loader.contentPath = “”;[/COLOR]
}
if your files are located in the diferent folders then:
[COLOR=“Blue”]mc_loader.contentPath = “foldername/flag_iraq.png”;[/COLOR]