-
Are these scripts the same? They are to pass a code to another MC.
Code:
tellTarget ("_root.Controller") {
Gotojail = 0;
}
and
Code:
_root.Controller:Gotojail = 0;
or maybe this one
Code:
tellTarget (_root.Controller:Gotojail = 0);
I dont know if I need the quotations around the address. Any knowledge you have on this would be greatly appreciated.
Thanks,
JZ
-
curmudgeon
yes they are the same except fo one slip up . use the second one with a dot instaed of a colon thus :
Code:
_root.Controller.Gotojail = 0;
"tell target" is depreciated syntax and may not survive the next version of flash
-
swampy-
does : do anything in AS?
-
So would this also be ok using the same type of syntax? It originates in another MC off the main timeline.
Code:
If (_root.Controller:Gotojail = 0){
gotoAndPlay ("Jail");
}
-
Hmmm Im passing the variable to MC instance Controller and the variable in it is called Gotojail. In order to reference the variable it should be:
Code:
_root.Controller:Gotojail = 0
or
Code:
_root.Controller.Gotojail = 0
My Flash 4 book (sorry I havent saved enough for a Flash 5 one yet) tells me that it used to be the : method to reference a variable in a MC. But it is . method now in Flash 5??
-
yes you must use the period instead of the colon.
....this is starting to sound like high school sex ed class
dan
-
LOL
Sorry Im still trying to adjust to Flash 5 scripting.
So I take it that when you use the . method Flash 5 automatically looks for a variable named whatever comes after the . What if you have a variable and a child MC both named the same thing, inside that MC?? How does it know which one?
Thanks,
JZ
[Edited by Liquid Genius on 06-15-2001 at 04:39 PM]
-
curmudgeon
broken down it means
_root go up to the main timeline
.controller look in the controller mc
. Gotojail look in the Gotojail variable
= 0
all the dots do is seperate the objects and variables.
-
They should have different names, right. It makes for more readable and understandable code anyway. In version 5 it could be a variable, movieclip, or text box. They are all targeted the same way.
Dan
-
Eureka!
Thats great guys! Thanks for the help. It is all starting to make sense now.
John
-
Not to bother you anymore than I have, but......
When do I use the single = and when the == ?
-
i think the single = is to assign value to something like:
var number = 5;
and the two == is to determine equality:
if ( number == 5 ) {
movieOne.gotoAndPlay ();
}
dan
-
curmudgeon
single are for when you assign a value to a variable:
ie
Code:
_root.Controller:Gotojail = 0
and == for comaprison i.e
Code:
if( _root.Controller:Gotojail == 0) {
do this
}
beat me to it !
-
Awesome! Well thats all the questions I have for now...youve helped me immensely!
JZ
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
|