i would like to create a model-button which i can use several times. the textline should come from a variable…
see Array (object), for and MovieClip.attachMovie in the actionscript dictionary =)
you can use something like that:
- make a mc, place a button inside this mc.
- add one layer for actions and one layer for the dynamic txt box, on this mc, on top of the button layer.
- select the dynamic text box and on properties panel write label on the var field.
- on the actions layer pplace this code:
[AS]
label=this._name;
[/AS]
there! now you have a generic button that will have the text matching his instance name.
for the actions on these buttons you can use something like that:
[AS]
on (press){
getURL(this._name+".html");
}
[/AS]
wow :!:
that is nice kax!
thanks =)
but assuming he’s just started with flash… yours is easier to understand =)
thanks to you guys. i will work with your examples…
and you are right kax, i’m just starting with flash, but hope to give it back to the community someday what i get from you guys…
but one more question: so it’s not possible to add a dynamic textfield to an ordinary macrom. button in each frame?
thanks again…
jns
yeah, you can. =)
but now that mx allows you to have mouse events [size=1]onPress onRelease onReleaseOutside onRollOut onRollOver onDragOut onDragOver[/size] in movie clips… it’s more practical [size=1]at least for me[/size] use movie clips instead of buttons
so i worked around with your scripts and there both really fine.
kax script is nice, but i have already so much functions to my buttons that i will use it somewhere else…
[COLOR=blue]Guig0s[/COLOR] script works fine, but unfortunately i have to use the instance name for a mouseover script (see: http://www.kirupaforum.com/forums/showthread.php?s=&threadid=18263)
maybe you have a hint to solve this problem??? would be fantastic…
thanks a lot…:hangover:
well you can assign the label to a variable instead of the clip´s _name.
something like:
[AS]
label = buttonName;
[/AS]
instead of
[AS]label = this._name
[/AS]
and on main stage you place this code:
[AS]
_root.button1.buttonName= home;
_root.button2.buttonName= portfolio;
…
[/AS]
where button1, button2… is the instance name of your buttons.
got it?
perfect!!
yeah!!!
thank you very very much!!!
np dude
glad to help =)