-
i'm the Best of doing nothing
Using vars from different frames?
Hey everyone, im still trying to understand how exactly i supposed to use flash vars.
so bear with me, i will try my best to explain the situation.
i have a custom class i made, where it stores vars inside:
Code:
package {
public class PHPClass extends EventDispatcher {
var stats = {HP:Number, MP: Number, Nickname:String};
public function PHPClass() {
//constructor code
}
}
}
now, to use this class, for some reason, i need to create it,
so here i am at frame number 1 at my code, i do
var PHP:PHPClass = new PHPClass;
now what this allows me to do, when i write "PHP" then adding a dot (.) after that, i see the hint box what vars should i be using.
so far so good?
now, when i switch to frame 2 at my flash game, i no longer can use the hint box anymore but the command is still usable,
so like PHP.stats.HP = 20.0; still working, but i have no hint box to use anymore.
is there any way i can declare a var inside my 2nd frame so it will be using the same var i created at 1st frame?
because something like:
(on 2nd frame)
var NewPHP:PHP; does not work..
i hope i explained the situation clear enough, if no please tell me ill provide an example code.
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
|