-
Dont know what subject this could have
I hope you get this:
_root.currentbomb = this._name
Currentbomb is a variable i created earlier in the movie. I now define it as the name of a new oject.
Lets say currentbomb = bomb3
If i then want to call _root.bomb3._x but using the variable instead of writing bomb3 how do I do then?
Can i write something like this?:
_root."currentbomb"._x
Im really lost !!!!
-
try this
code:
_root[currentbomb]._x
or this
code:
_root[_root.currentbomb]._x
it has been a while, but if memory serves me, one of these should work.
You are calling a variable of a variable, and this is the path you have to use... I think!!!
Last edited by preprint; 12-16-2003 at 05:45 PM.
If it was easy, everyone would do it.
-
Now i wrote this code:
if (_root.[currentbomb]._x < this._x){
this.gotoAndPlay(8)
}
but an error message accure:
**Error** Scene=Scene 1, layer=men, frame=1:Line 1: Expected a field name after '.' operator.
if (_root.[currentbomb]._x < this._x){
Total ActionScript Errors: 1 Reported Errors: 1
-
I just updated my first post...
try one of those.
Ifthose don't work, I'm lost : (
If it was easy, everyone would do it.
-
one thing too...
it looks as if you are comparing the MC to itself, because if your previous script you made _root.currentbomb = this._name
and then you are comparing _root.currentbomb._x < this._x
if this code is all on the same MC, that may be one of the problems.
Like I said, it has been a while since I have been able to work in Flash!
Let me know
I am leaving for the day, may be someone else knows if my sugestions don't work.
If it was easy, everyone would do it.
-
darn Its correct code ! Well now I ran into a new prob:
I want to do something IF a certain movie is and fra 3 or before. how do i write that?
onClipEvent(enterFrame){
_root.check2_txt.text = _root[_root.currentbomb]._x;
if (_root[_root.currentbomb]._x < this._x and <BR>this._frame < 3</BR>){
this.gotoAndPlay(8)
}
Where i wrote "this._frame < 3" is where i dont know what to write.
-
darn Its correct code ! Well now I ran into a new prob:
I want to do something IF a certain movie is and fra 3 or before. how do i write that?
onClipEvent(enterFrame){
_root.check2_txt.text = _root[_root.currentbomb]._x;
if (_root[_root.currentbomb]._x < this._x and <B>this._frame < 3</B> ){
this.gotoAndPlay(8)
}
Where i wrote "this._frame < 3" is where i dont know what to write.
__________________
Wee mee Newbie
www.Bigbabies.dk
-
try this:
code:
onClipEvent(enterFrame){
_root.check2_txt.text = _root[_root.currentbomb]._x;
if (_root[_root.currentbomb]._x < this._x && this._frame < 3) {
this.gotoAndPlay(8)
}
the word "and" has to be written as "&&" when you are checking the value of two or more variabes in a conditional.
Also, in your last post, were you trying to bold text? If so, in the FK forums, "code" is enclosed in brackets "[ ]"
If it was easy, everyone would do it.
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
|