MX actionscript quez
- Started
- Last post
- 15 Responses
- Mick
How do you telltarget an expression with dot syntax in flash MX?
- autonoma0
_root.movieClipOne.movieClipTwo...
- Mick0
I need the name of the MC to come from an expression.
eg.
tellTarget ("bird" & count) {
play();
}this doesn't seem to work for me....
_root.("bird" & count).gotoAndPlay("homeF
rame");
- autonoma0
"bird" and "count" are two seperate movie clips?
- Mick0
"bird" is a text string, count is a variable.
I'm targeting a group of MCs called Bird1, bird2, bird3, bird4, etc.
Actions from various buttons are setting the value of count to one of the numbers.
- neeko0
i dont quite get what youre saying here, or id offer my two cents...
do you know how you'd do it in 5, then we could translate.
- neeko0
oops. ignore my previous post, you posted while i was typing it.
- Mick0
OK, if you can answer this then it will help me enough...
How do you do this in dot syntax....
tellTarget (1+2) {
play();
}1+2 is any expression
- unknown0
If I got this correctly, you want to access the dynamicly generated name depending on the value of the variable?
If this is so, this is how you access the object:_root["PrefixToMCname"+i].gotoAn...
Cheers.
- Mick0
Thanx Boz - that does the trick.
- neeko0
that would only target one MC though, corect? and hes trying to target two or more at the same time if i read correctly?
not sure of the syntax for that off hand...
- neeko0
ok then...
lets say you wanted to tell 2 or more dynamically generated movie clips to do something, using one line of code. whats the syntax for that?
- autonoma0
You need to create a custom function. You can place it on the main timeline, but you'll have to make it global. Something like this:
_global.action = function (a,b) {
c=a+b;
c.gotoAndPlay(2);
}To call it, just type this into your button's actions:
action (bird,2);
- autonoma0
I'll be damned if I get this much help this quick when I ask a Flash question!
- neeko0
ah ya... thats the stuff. custom functions. super.
thank you.
- ershinn0
Try using the eval() expression.