Be a Supporter!

Not working AS2.0

  • 248 Views
  • 5 Replies
New Topic Respond to this Topic
Janj
Janj
  • Member since: Nov. 10, 2009
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Not working AS2.0 2011-07-16 09:34:11 Reply

Hello. I'm using these codes:

//1
on(release) {
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.score+=100;
}

//2
on(release) {
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.score+=100;
}

//3
on(release) {
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.waterfludd.nextFrame();
_root.score+=150;
}

//4
on(release) {
_root.waterfludd.prevFrame();
_root.waterfludd.prevFrame();
_root.waterfludd.prevFrame();
_root.waterfludd.prevFrame();
}

//5
on(release){
	_root.energia.prevFrame();
}

//7
on(release){
	this.nextFrame();
}

all on different mc's.
But the scripts don't execute! _root.score stays the same, so do waterfludd and energia! I've already defined the instance names, why don't the scripts execute?

Janj
Janj
  • Member since: Nov. 10, 2009
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Not working AS2.0 2011-07-16 09:52:54 Reply

Well, the only thing not working is score, and that's a dynamic text. I've set the var/instance names to 'score'

cdjproductions
cdjproductions
  • Member since: Jul. 2, 2010
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Not working AS2.0 2011-07-16 10:03:53 Reply

If all you need is changing the text, then...

_root.score.replaceText(0, 9, this.score)

The 0 and 9 are the starting and stopping points for what part of the text you're changing, then it replaces it with the number from the score. Hope this helps!


This account is now defunct and will now serve as an alt - _)-UltimateCJ64-(_
Seriously, I'm serious.

Janj
Janj
  • Member since: Nov. 10, 2009
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Not working AS2.0 2011-07-16 10:07:31 Reply

Wait, it's fixed.

cdjproductions
cdjproductions
  • Member since: Jul. 2, 2010
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Not working AS2.0 2011-07-16 10:09:36 Reply

Whoops, I meant _root.score, not this.score

my bad

This account is now defunct and will now serve as an alt - _)-UltimateCJ64-(_
Seriously, I'm serious.

cdjproductions
cdjproductions
  • Member since: Jul. 2, 2010
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Not working AS2.0 2011-07-16 10:12:37 Reply

Oh, never mind.
Thing is, you can't have a root movieclip/dynamictext with the same instance name as a root variable you have.
Change the name of the text box to scoreText, then do the replaceText


This account is now defunct and will now serve as an alt - _)-UltimateCJ64-(_
Seriously, I'm serious.