View Full Version : [AS2] what do i do if i want to keep the money from the first frame if i use a new fr
ccoonnyy
02-22-2009, 10:21 PM
hello i need some help with my flash project , im doing a game wich involves money and stuff like that, but what do i do if i want to keep the money from the first frame if i use a new frame?
like this , i have 100 money then i use 50 when i reach frame 2 (by clicking something) my money resets to 100 again
ntou45
02-22-2009, 10:33 PM
you're probably redefining your money variable each time you go to a new frame.
could you attach the file?
ccoonnyy
02-22-2009, 10:44 PM
how do i do that?
ccoonnyy
02-22-2009, 10:55 PM
heres the file , its a bit messy as you se... but i dont want it like everything on the first frame like that
ccoonnyy
02-22-2009, 11:56 PM
how do i keep my money if i enter annother frame ? lets say im one the first frame and i hade 100 money then i enter second fram my money resets to 100 again even if i spended some ?
im newb so if anyone can explain i would be happy
kkbbcute
02-23-2009, 03:15 AM
Firstly, don't triple/double post, edit your last post instead.
Secondly, haven't really looked at your file but make sure that you are not using an onEnterFrame function to define your money or like ntou45 said, make sure you don't redefine your money at every frame.
ccoonnyy
02-23-2009, 04:07 PM
how do i keep my money if i want to go to annother frame in my game ?
because everytime i use
on(release){
gotoAndPlay(_root._currentFrame + 1)
}
my money resets to what it was in the beginning , i havent done any variables because i dont know how they work
Ganks
02-23-2009, 04:11 PM
You really need to be more specific.
We have no idea what you are referring to.
Provide more information, or provide your FLA.
atomic
02-23-2009, 04:16 PM
First it's _currentframe and not _currenFrame...
Second, you do need to use a variable, so attach your .fla.
ccoonnyy
02-23-2009, 04:17 PM
like this , i done a static text wich is named money, and in my game you start with 100 money,
money = 100;
when i buy stuff in my game i use money = money - (price)
but my problem is i have the whole game on one frame because when i use gotoAndStop(2) my money from the first fram resets to 100 again
sry , my english isnīt the best , hope you understand
ccoonnyy
02-23-2009, 04:19 PM
heres my fla ,
bluemagica
02-23-2009, 04:50 PM
don't double post, edit your last one!!
Now...to solve it, just use _global variables!
example:- _global.money = 31;
it wont change its value throughout your swf unless you change the value yourself!
ccoonnyy
02-23-2009, 04:58 PM
thank you bluemagica , how do i link them to a dynamic textbox ? so that the values show there?
bluemagica
02-24-2009, 03:28 AM
like movieclips, your textbox must also have a instance name, right? so you just put the text there, like:
mytextbox.text = _global.money;
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.