Skip to content

What's superInstance‎ do? #13

Closed Answered by Kriptel
rodney528 asked this question in Q&A
Discussion options

You must be logged in to vote

By setting superInstance to a non-null value, you are telling scripts that it should change variables in the parent class, if any exist.

source

var object:FlxSprite = new FlxSprite(100,0);
var script:RuleScript = new RuleScript();
script.superInstance = object;
// ... script execute

script

trace(x); // 100, because sprite's x value is 100
x = 200;
trace(x) // 200, It will also change for the object

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rodney528
Comment options

Answer selected by rodney528
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants