-
[F8] Simple script issue
Code:
on(release){
if(_root.system.command = "/openfile/v2-rocket"){
v2._visible = true;
} else {
_root.system.command = "/openfile/WrongCommand";
v2._visible = false;
}
}
Anyone see an error with this script?
It seems to be ignoring the if command, and makes "v2" visible if the if command is correct or not.
-
Senior Member
Originally Posted by TonyScarface
Code:
on(release){
if(_root.system.command = "/openfile/v2-rocket"){
v2._visible = true;
} else {
_root.system.command = "/openfile/WrongCommand";
v2._visible = false;
}
}
Anyone see an error with this script?
It seems to be ignoring the if command, and makes "v2" visible if the if command is correct or not.
It's the old double equals trick ("==" vs. "=");
You need to do this:
PHP Code:
on(release){
if(_root.system.command == "/openfile/v2-rocket"){
v2._visible = true;
} else {
_root.system.command = "/openfile/WrongCommand";
v2._visible = false;
}
}
By using a single equals sign you are setting the variable to the value, not comparing it.
Hope this helps.
d.
-
Thanks for the reply =)
The thing is, first I tried using "==" then just "=".
When I use "==", the button doesn't reply at all.
When I use "=" the button reacts, but it reacts no matter if the if command is correct or wrong.
I've always used "==" , and this have never been an issue.
Any advice?
-
FK'n_dog
add a trace to see if your logic/path is correct -
on(release){
trace(_root.system.command);
}
-
<p align="left"></p>
That's the response I got :S
The thing is, ive got the same problem with all the if commands im using :S
-
FK'n_dog
and command is a dynamic textfield ?
is this the variable name or the instance name ?
make it the instance name only.
on(release){
trace(_root.system.command.text); // output = ?
}
-
Aaaah... The one thing I didn't test was .text :P
Thanks alot mate
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|