Be a Supporter!

TypeError: Error #1009

  • 1,170 Views
  • 31 Replies
New Topic Respond to this Topic
Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
TypeError: Error #1009 2013-08-25 06:07:51 Reply

Hey there,
first of all, sorry if i'm breaking any rules, i just signed up, and spent like 4 hours reading topics about that Error #1009 and couldnt get any clue to solve my problem, i hope you guys can give me a hand!

I'm making a rpg survival-like game, and i have a package for my monster class, and every time i hit them, i get that error to pop in my output:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at monster/enterFrameEvents()[L:\FlashGame\Knight\monster.as:21]

My package code goes like this

package
{
	import flash.display.*;
	import flash.events.*;

	public class monster extends MovieClip
	{
		private var _root:MovieClip;

		public function monster()
		{
			addEventListener(Event.ADDED, beginClass);
			addEventListener(Event.ENTER_FRAME, enterFrameEvents);
		}
		private function beginClass(event:Event):void
		{
			_root = MovieClip(root);
		}
		private function enterFrameEvents(event:Event):void
		{
			if( _root.mapa.hero.x >= this.x )
			{
				this.x += 3;
				this.gotoAndStop('AndandoD');
			}
			if( _root.mapa.hero.x <= this.x )
			{
				this.x -= 3;
				this.gotoAndStop('AndandoE');
			}
		}
	}
}

It keeps poping that error out as i kill the enemies, hope you guys can help me out.
Thanks in advance.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-25 08:09:36 Reply

welcome =)

At 8/25/13 06:07 AM, Hagarth wrote: import flash.display.*;
import flash.events.*;

It does not produce overhead, but for readability's sake only import the classes that you need.
Your class is very small and doesn't use that many.
If you were using most classes of either package, the * solution is more appropriate.

You don't have to learn the packages by heart.
Use some proper code editor and they will be included automatically when you enter a class name.

public class monster extends MovieClip
{
private var _root:MovieClip;

Remember that as2 is gone for good.
Using a reference to root or _root (they are not the same thing) to reference other objects generally causes headaches.
You should not use that method, because it creates dependencies.

public function monster()
{
addEventListener(Event.ADDED, beginClass);

In order to wait for root (or stage) to be available, you should listen for the ADDED_TO_STAGE Event.
They are not necessarily available if only ADDED was dispatched.

addEventListener(Event.ENTER_FRAME, enterFrameEvents);

Adding an ENTER_FRAME Event to a lot of objects is a problem for the performance.
You should rather use a single ENTER_FRAME handler in your Main class and call methods on each object.

private function beginClass(event:Event):void
{
_root = MovieClip(root);

Casting to MovieClip (or any other dynamic class) makes debugging harder, because chances are that you will not get an error at compile time, but a silent failure of the application.

private function enterFrameEvents(event:Event):void
{
if( _root.mapa.hero.x >= this.x )

This is one of the aforementioned dependencies. Your class relies on an object "mapa" containing "hero".
You will not be able to reuse your class in any other context.

Apart from that, this code depends on this structure.
If you need to place the hero into another container or you apply other changes, all classes that relyy on the previous structure have to be changed - the depend on it.

Instead, if your class needs a reference to the hero object, pass a reference to it to your class.

this.x += 3;

You do not need "this".

this.gotoAndStop('AndandoD');

Working with frames can cause problems. It's recommended to use them for animation.

It keeps poping that error out as i kill the enemies, hope you guys can help me out.

This depends on what you do to "kill" the enemy. You should post that code.

The general problem is that you never remove the listener from your object.
The ENTER_FRAME keeps running and probably causes the error.

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-25 18:17:26 Reply

Thanks for the answer.

Heres the code of `killing` enemies

for(var i=0; i <= j; i++) // Laço for, para verificação do Array dos inimigos, cria a variaável i começando em 0, e enquanto ela for menor que j(inimigos) ela adiciona mais um a i e verifica se colidiu com algum dos inimigos armazenados no Array, nas posições j.
			 {
				 if(enemies[i] != null && mapa.hero.hero.SwordArm.hitTestObject(enemies[i])) // Verifica se a posição i dos inimigos no Array j é diferente de null ( != - diferente ) e testa colisão dos inimigos com o braço da espada.
				 {
					 trace("Bateu");
					 enemies[i].hp.scaleX -= 0.2; //Tira 0.2 de hp da barra de hp do inimigo
					 if(enemies[i].hp.scaleX <=0) // Verifica se o inimigo perdeu todo o hp pra poder remover do palco
					 {
					 	enemies[i].parent.removeChild(enemies[i]); //Pega a posição i verificada pelo hitTestObject e remove o inimigo que estava na posição i verificada do palco.
						trace(enemies.length);
						mortos++;
						
					 }
					 if(mortos == 10)
					 {
						 SoundMixer.stopAll();
						 mapa.gotoAndStop(2);

					 }
				 }
			 }

I created a var mortos to count enemies killed, and when it reaches the maximus spawned at lvl 1, i chance to lvl 2 thats in the frame 2 of mapa. At the moment i hit any enemy, the error starts to pop repeatidly, and sometimes it crashes the game, the main character starts to lose HP without colliding with the enemy. Btw, don`t mind the comments on the code, it`s for my later reference x) as i`m new to AS.

I got another error too, i created a game over screen, for when the Hero hp reaches 0, it goes to the game over, but it doesn`t play the frames

addEventListener(Event.ENTER_FRAME, health); // Função para retirar o HP ao entrar em contato com os inimigos
	function health (Event)
	{
		for(var i=0; i <= j; i++)
		{
			if(enemies[i] != null && mapa.hero.hero.torso.hitTestObject(enemies[i])) // Se houver colisão com o torso do herói pelos inimigos, ele vai perder 0.01 de hp
			   {
				  	    hp.scaleX -= 0.01; // Remove 0.01 de hp da barra de hp do hero
						
			   }
				   
			if(hp.scaleX <= 0) // Verifica se o hp desceu até 0.
				   {
					   // Game Ends//
					   SoundMixer.stopAll();
					   gotoAndPlay(349);
				   }
			  
		}
	}

It goes to the frame 349 where i got my Game Over Background, but it does not play the entire game over animation frames.

Thanks again

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-25 18:42:05 Reply

Btw, i still couldnt make the error go away, i rewrote the package to make those changes on the imports and the `this` but the error i still couldnt fix, where exactly i should put the removeEventListener?
(Sorry for the noob question but im kinda new to AS, and that package was given to me by my teacher, and he didnt know ho to explain how packages work, or even to get the problem fixed)

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-25 21:53:09 Reply

At 8/25/13 06:17 PM, Hagarth wrote: Thanks for the answer.

Heres the code of `killing` enemies

for(var i=0; i <= j; i++) // Laço for, para verificação do Array dos inimigos, cria a variaável i começando em 0, e enquanto ela for menor que j(inimigos) ela adiciona mais um a i e verifica se colidiu com algum dos inimigos armazenados no Array, nas posições j.
{
if(enemies[i] != null && mapa.hero.hero.SwordArm.hitTestObject(enemies[i])) // Verifica se a posição i dos inimigos no Array j é diferente de null ( != - diferente ) e testa colisão dos inimigos com o braço da espada.
{
trace("Bateu");
enemies[i].hp.scaleX -= 0.2; //Tira 0.2 de hp da barra de hp do inimigo
if(enemies[i].hp.scaleX <=0) // Verifica se o inimigo perdeu todo o hp pra poder remover do palco

Try to encapsulate things into the classes and use abstraction to your advantage.

If your enemies have a health variable, create a numeric variable that stores this health.
This makes it a lot easier to think about it.
It's not tied to some scale that can only take certain numbers or whatever.
This abstraction helps you to think about your problem, not the programming language.

To encapsulate this, use a setter and getter function to change the value of health.
In the setter for example, you can check if the health reaches zero, and dispatch an Event. (advanced stuff)

private var _health:int = 100;

public function set health (value:int):void
{
        _health = value;
        if(_health <= 0) trace("dead");

        //do additional stuff like updating the health of the healthbar
}
public function get health ():int
{
        return _health;
}

Basically: If you want health, use health. If you want scale use scale.
You have the tools to be precise about what you want and do exactly that.

I created a var mortos to count enemies killed,

That's not necessary. You have your enemy objects in an array.
If one dies, remove it from the array.
If the array is empty, all enemies are gone.

and when it reaches the maximus spawned at lvl 1, i chance to lvl 2 thats in the frame 2 of mapa. At the moment i hit any enemy, the error starts to pop repeatidly, and sometimes it crashes the game, the main character starts to lose HP without colliding with the enemy.

Btw, don`t mind the comments on the code, it`s for my later reference x) as i`m new to AS.

By all means: English only.
Even if you're the only one reading them (you aren't) and I don't speak Portuguese.

At 8/25/13 06:42 PM, Hagarth wrote: Btw, i still couldnt make the error go away, i rewrote the package to make those changes on the imports and the `this` but the error i still couldnt fix, where exactly i should put the removeEventListener?

The best idea: nowhere.

If you do not have an event listener in the first place, there's no need to remove it.
As said earlier, you should not add the ENTER_FRAME to every enemy anyway.

You have all the enemies in an array.
Call the method on each of those in your main game loop instead of letting them do their own thing.

how packages work

packages are folders, nothings fancy, nothing special

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-25 23:17:00 Reply

Sorry about the portuguese, never thought i would need to show the code to anyone else than me, specially anyone who doesn`t speak portuguese, but ill take your advice and write the comments in english too. I really appreciate your help and the time you spent answering me, but now i have more questions than answers, i think i got the idea of the health thing, but i actually dont know where to write those things, the HP bar works with the scale of a rectangle with instance name of hp, this is how my teacher told me to do, this rectangle movie clip is inside the movie clip of the monster, above its head. I really wish i could finish the game, or at least get close to it. Well, anyway, thanks for the answer again.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 06:50:03 Reply

At 8/25/13 11:17 PM, Hagarth wrote: now i have more questions than answers

Don't worry. If your current setup works, keep it.
You should focus on the ENTER_FRAME to get rid of the error.

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 07:35:50 Reply

I dont know what to do with the enter frame to get it fixed, on the debug mode it says the error is in the if(_root... line, but i dont get it

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 08:21:11 Reply

At 8/26/13 07:35 AM, Hagarth wrote: I dont know what to do with the enter frame to get it fixed, on the debug mode it says the error is in the if(_root... line, but i dont get it

What do you not get? One of the references in in this line is null and you try to access member of it.
You can trace each one to find out which is null.

Again, the core of the problem is the ENTER_FRAME lingering on after you removed the enemy.
To solve this, do not add such an event handler to each enemy.
Instead call your enterFrameEvents method from your main class (which runs one ENTER_FRAME for all objects) by iterating over all enemies.

When killing an enemy, take it out of the array to stop its method from being called.

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 09:24:57 Reply

I thought about that before i created the var to count the dead i told u b4, but i dont know the code to remove from the array, i tried to find it on the adobe help and was not successful, can u tell me how?

kkots
kkots
  • Member since: Apr. 16, 2013
  • Offline.
Forum Stats
Supporter
Level 10
Blank Slate
Response to TypeError: Error #1009 2013-08-26 10:21:59 Reply

At 8/26/13 09:24 AM, Hagarth wrote: I thought about that before i created the var to count the dead i told u b4, but i dont know the code to remove from the array, i tried to find it on the adobe help and was not successful, can u tell me how?

To remove an element from an array use code

someArray.splice(index,1);

index is the index of the element that you want to remove. After this method is applied, there's no hole remaining in the array.


BBS Signature
Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 10:48:10 Reply

To remove an element from an array use code

someArray.splice(index,1);

index is the index of the element that you want to remove. After this method is applied, there's no hole remaining in the array.

I did this, and still get the error,
enemies.splice( i, 1);

The error still pops out

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 11:19:36 Reply

At 8/26/13 10:48 AM, Hagarth wrote: I did this, and still get the error,
enemies.splice( i, 1);

The error still pops out

Did you remove the ENTER_FRAME?
How does your code look like now?

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 11:21:46 Reply

Did you remove the ENTER_FRAME?
How does your code look like now?

U mean remove the ENTER_FRAME from the enemy package?

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 11:26:06 Reply

How does your code look like now?
addEventListener(Event.ENTER_FRAME, controle); 
function controle (Event)
{
	if(atakando == true)
	{
		if(mapa.hero.hero.currentFrame >= 11)
		   {
			   atakando = false 
			   		if(viraD == true) 
					{
			   			mapa.hero.gotoAndStop('Dpara');
		   			}
					else 
					{
						mapa.hero.gotoAndStop('Epara');
					}
		   }
		  
		 else
		 {
			 for(var i=0; i <= j; i++)
			 {
				 if(enemies[i] != null && mapa.hero.hero.SwordArm.hitTestObject(enemies[i])) 
				 {
					 trace("Hit");
					 enemies[i].hp.scaleX -= 0.2;
					 if(enemies[i].hp.scaleX <=0 && enemies[i] != null) 
					 {

						enemies[i].parent.removeChild(enemies[i]); 
						enemies.splice(i,1);
						trace (enemies);
						//mortos++;
						
					 }
					 if(mortos == 10)
					 {
						 SoundMixer.stopAll();
						 mapa.gotoAndStop(2);

					 }
				 }
			 }
		 }
	}
}
milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 14:02:33 Reply

At 8/26/13 11:21 AM, Hagarth wrote:
Did you remove the ENTER_FRAME?
How does your code look like now?
U mean remove the ENTER_FRAME from the enemy package?

Enemy is not a package, but a class.

Yes, you should not add the listener to the enemy class but instead call the method from the main class.

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 15:02:46 Reply

Enemy is not a package, but a class.

Yes, you should not add the listener to the enemy class but instead call the method from the main class.

How exactly i call the method from the main class?

(Sorry for the noob answer, but this is still dark to me)

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 15:07:27 Reply

At 8/26/13 03:02 PM, Hagarth wrote: How exactly i call the method from the main class?

Like any other method of objects.
You are calling methods already.

<object reference>.<method name>();

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 15:12:42 Reply

<object reference>.<method name>();
package  
{
	import flash.display.MovieClip;
	import flash.events.Event;


	public class monster extends MovieClip
	{
		private var _root:MovieClip;
		
		public function monster()
		{
			addEventListener(Event.ADDED, beginClass);
			addEventListener(Event.ENTER_FRAME, enterFrameEvents);
			
		}
		private function beginClass(event:Event):void
		{
			_root = MovieClip(root);
		}
		private function enterFrameEvents(event:Event):void
		{
			if( _root.mapa.hero.x >= this.x )
			{
				x+= 3;
				this.gotoAndStop('AndandoD');
			}
			if( _root.mapa.hero.x <= this.x )
			{
				x -= 3;
				this.gotoAndStop('AndandoE');
			}
		}
	}

This is my code
I should remove

public function monster()
		{
			addEventListener(Event.ADDED, beginClass);
			addEventListener(Event.ENTER_FRAME, enterFrameEvents); // Remove this?
			
		}
milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 15:21:37 Reply

At 8/26/13 03:12 PM, Hagarth wrote: addEventListener(Event.ENTER_FRAME, enterFrameEvents); // Remove this?

yes

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 15:27:18 Reply

yes

Okay, now they dont move, they die, and get removed as well, no errors, but they stopped moving as before.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to TypeError: Error #1009 2013-08-26 15:57:45 Reply

At 8/26/13 03:27 PM, Hagarth wrote:
yes
Okay, now they dont move, they die, and get removed as well, no errors, but they stopped moving as before.

That's because the event handling method is not called anymore.
You have to call it from main, in its ENTER_FRAME method

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 18:04:05 Reply

That's because the event handling method is not called anymore.
You have to call it from main, in its ENTER_FRAME method

Now i dont get it, wasnt i supposed to remove it from main? now i have to put it there again?

MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Online!
Forum Stats
Supporter
Level 16
Game Developer
Response to TypeError: Error #1009 2013-08-26 18:08:06 Reply

At 8/26/13 06:04 PM, Hagarth wrote:
That's because the event handling method is not called anymore.
You have to call it from main, in its ENTER_FRAME method
Now i dont get it, wasnt i supposed to remove it from main? now i have to put it there again?

One enterframe handler per game. From that enterframe, you update everything else by creating an update method for each thing and calling that.

From your single enterframe, call thing.update() on everything to update the game rather than bogging down the game with more enterframes. And please, create an update method in your classes before doing that, don't come back saying update method not found -_-

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-26 18:16:55 Reply

One enterframe handler per game. From that enterframe, you update everything else by creating an update method for each thing and calling that.

From your single enterframe, call thing.update() on everything to update the game rather than bogging down the game with more enterframes. And please, create an update method in your classes before doing that, don't come back saying update method not found -_-

Sorry to bother, but i actually dont know how to do all that stuff, thanks anyway for the help.

davidgilbert
davidgilbert
  • Member since: Aug. 21, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-28 14:43:39 Reply

At 8/25/13 06:07 AM, Hagarth wrote: package
{
import flash.display.*;
import flash.events.*;

public class monster extends MovieClip
{
private var _root:MovieClip;

public function monster()
{
addEventListener(Event.ADDED, beginClass);
addEventListener(Event.ENTER_FRAME, enterFrameEvents);
}
private function beginClass(event:Event):void
{
_root = MovieClip(root);
}

Try changing addEventListener(Event.ADDED, beginClass); to addEventListener(Event.ADDED_TO_STAGE, beginClass);


Play free games at gilbert family farm.

Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-28 16:08:03 Reply

Try changing addEventListener(Event.ADDED, beginClass); to addEventListener(Event.ADDED_TO_STAGE, beginClass);

OMG! It worked! *__________*
Thankyou Very much! Its been like a week of nightmares cuz of that error! Even my teacher didnt know what to do, or maybe he didnt want to help anyway, because today was the last class, idk.

I only need to fix the last one, to keep the developing of the game, its about another ENTER_FRAME (Why always the ENTER_FRAME) >.<

addEventListener(Event.ENTER_FRAME, health);
function health(Event)
{
	for (var i=0; i <= j; i++)
	{
		if (enemies[i] != null && mapa.hero.hero.torso.hitTestObject(enemies[i]))
		{
			HitPoints.scaleX -=  0.01;

		}

		if (HitPoints.scaleX <= 0)
		{
			SoundMixer.stopAll();
			gotoAndStop('GameOver');
		}

	}
}

The error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at Heroi_fla::MainTimeline/health()[Heroi_fla.MainTimeline::frame2:252]

I Already tried to remove the listener, on the frame 3 (the gameover frame) but it still pop`s out the error.

kkots
kkots
  • Member since: Apr. 16, 2013
  • Offline.
Forum Stats
Supporter
Level 10
Blank Slate
Response to TypeError: Error #1009 2013-08-28 18:38:00 Reply

At 8/28/13 04:08 PM, Hagarth wrote:
I Already tried to remove the listener, on the frame 3 (the gameover frame) but it still pop`s out the error.

Did you try to remove it like this:

removeEventListener(Event.ENTER_FRAME,health);

?


BBS Signature
Hagarth
Hagarth
  • Member since: Aug. 25, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to TypeError: Error #1009 2013-08-28 21:06:25 Reply

At 8/28/13 06:38 PM, kkots wrote:
At 8/28/13 04:08 PM, Hagarth wrote:
I Already tried to remove the listener, on the frame 3 (the gameover frame) but it still pop`s out the error.
Did you try to remove it like this:

removeEventListener(Event.ENTER_FRAME,health);

?

Yeah

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to TypeError: Error #1009 2013-08-28 23:27:51 Reply

It seems that you're rather new at AS3 coming from AS2, where "_root.player.body.hitbox.hitTest(_root.walls.wall1)" may have worked there, it isn't acceptable in proper coding. Consider taking a step back and learning AS3 as if it was a fresh new experience.

Also I've seen the issues of ENTER_FRAME events on the forum, so I've made this video to discuss a good structure to make them. Although it's a pretty advanced tutorial.

So get back to the basics of the language, your issues seems to be embedded deep within what looks like a few years of bad practices in programming. If you have any more general questions feel free to ask!


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature