all groups > flash actionscript > february 2005 >
You're in the

flash actionscript

group:

null ( {-_-} )


Re: null ( {-_-} ) David Stiller
2/8/2005 3:38:33 PM
flash actionscript:
GhettoFabFlah,

[quoted text, click to view]

You bet. You practically wrote it, too.

on (press) {
if (recharge == false) {
gotoAndPlay(1);
}
}

Notice a couple things. They may look small, but they're *very*
important. There are two (2) equals signs in the if() statement. Loop up
your operators in the ActionScript dictionary (F1 key) and you'll see
there's a difference between one = and two == ... they mean different
things. Notice also how the gotoAndPlay() method works. That one's in the
dictionary too. ;)

[quoted text, click to view]

If you don't want it to do anything when recharge is true, don't write
code for it. If you only code for a value of false, then it will only apply
when the value is false. Get it?


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

null ( {-_-} ) GhettoFabFlah
2/8/2005 8:30:29 PM
Hello Again Everyone! Is there a way to say like on (press) and if( recharge =
false) gotoandplay frame 1, But then have it say on press if recharge = true
(this is what i dont get) how do you have it say don't do anything?
Re: null ( {-_-} ) TimSymons
2/8/2005 8:43:54 PM
You can do this pretty simply with AS2 by attaching a class to a movieClip
Button. // Class Definition // class myClass extends MovieClip { private var
recharge:Boolean = false; // Constructor // public function myClass() { //
do nothing // } private function onPress():Void { if (!recharge) {
recharge = true; this._parent.gotoAndPlay(1); }
} } Make your button a movieClip and use the above as it's class. The class
assumes that the movieClip button is a child of the timeline you want to move
to frame 1. If the timeline is the _root timeline then replace this._parent
with _root. HTH. Tim
Re: null ( {-_-} ) Jeckyl
2/9/2005 8:11:49 AM
on (press) {
if (recharge) {
// do nothing if true
} else {
gotoAndPlay(1);
}
}

or

on (press) {
if (! recharge) {
gotoAndPlay(1);
}
}


--
All the best,
Jeckyl

Re: null ( {-_-} ) Jeckyl
2/9/2005 8:12:51 AM
Creating a class for that is probably overkill .. especially for someone who
appears to be very much a newbie ;)
--
All the best,
Jeckyl

Re: null ( {-_-} ) David Stiller
2/9/2005 10:07:22 AM
True enough, but only jump in when your aim is to completely get wet.
You don't use a hammer to squash the insect on your forehead!


David
stiller (at) quip (dot) net
"Luck is the residue of good design."





[quoted text, click to view]

Re: null ( {-_-} ) TimSymons
2/9/2005 3:01:14 PM
AddThis Social Bookmark Button