-
Scores will not show up after load
I have a splash intro for my game. After you click play it loads like this
loadMovieNum("game.swf", 1)
stop();
Then in the game, the score does not show up or work. Now when I load the game.swf by itself, the score works and shows up.
Here is the script for score im using
(Script for the number thats suppose to show)
onClipEvent(load){
score=0
}
(How you add the score after clicking right answer)
on(press){
_root.scorer.score+=1
}
Thanks for help!
-
When you know are.
Because you're loading in the swf from another file, the swf doing the loading is now the "_root". So when you refer to root, you're calling the loader shell file, where the score doesn't actually exist.
Instead of using "_root" you can try using "this" or "_parent" until you reach the level where your variable exists.
In AS2, which it seems you're using, it would go something like this...
Code:
on(press){
this.scorer.score+=1
}
or
Code:
on(press){
this._parent.scorer.score+=1
}
or
Code:
on(press){
this._parent._parent.scorer.score+=1
}
until you reach the level where your score is. Not sure how many movieclips deep your button is nested.
-
Originally Posted by Son of Bryce
Because you're loading in the swf from another file, the swf doing the loading is now the "_root". So when you refer to root, you're calling the loader shell file, where the score doesn't actually exist.
Instead of using "_root" you can try using "this" or "_parent" until you reach the level where your variable exists.
In AS2, which it seems you're using, it would go something like this...
Code:
on(press){
this.scorer.score+=1
}
or
Code:
on(press){
this._parent.scorer.score+=1
}
or
Code:
on(press){
this._parent._parent.scorer.score+=1
}
until you reach the level where your score is. Not sure how many movieclips deep your button is nested.
Thanks for reply,
I put in all three options but the score simply does not show up at all after loading the .swf file. I dont understand it
onClipEvent(load){
score=0
}
is it because its onClipEvent? Like said before, it works when I play it from the original file, but if loaded the score disappears!
-
Did the scores already show up after loading? Have you tried using the ActionScript 3 for your game script?
-
Senior Member
Have you tried using the ActionScript 3 for your game script?
AS3 wanted to be like Java so much, while AS1/2 were more like JavaScript. Now look where AS3 is and where JavaScript is But really, I made myself to love these closures, instead of making a class an/or method for everything. They could probably drop "this" keyword, and have JS still useable.
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
|