Bonjour,
Je suis en ce moment en train de créer un site en full flash et j'ai un gros problème que je n'arrive pas à régler depuis 1 semaine.
Je vous envoie donc ma page ContentPage.as et Contact.as:
Contact.as
Code ActionScript :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package fr.odin.content
{
	import com.greensock.TweenMax;
 
	import flash.display.DisplayObject;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;
	import flash.text.TextField;
	import flash.utils.Dictionary;
 
	public class Contact extends ContentPage
	{
		public var sendBtn:SimpleButton;
		public var formPrenom:TextField;
		public var formNom:TextField;
		public var formAdresse:TextField;
		public var formVille:TextField;
		public var formCodePostal:TextField;
		public var formPays:TextField;
		public var formTelephone:TextField;
		public var formEmail:TextField;
		public var formMessage:TextField;
		private var defaultContent:Dictionary;
 
		public function Contact()
		{
			super();
		}
	// Le problème est liée à cet override ci-dessous
 
 
	override protected function init():void
	{
		defaultContent = new Dictionary();
 
		var d:DisplayObject;
		var t:TextField;
		var n:int = numChildren;
		while( n-- )
		{
			d = getChildAt(n);
			if ( d is TextField )
			{
				t = TextField( d );
				t.embedFonts = true;
				defaultContent[t] = t.text;
 
			}
		}
		sendBtn.addEventListener( MouseEvent.CLICK, onSend );
		super.init();
	}
 
	private function onSend( event:MouseEvent = null ):void
	{
		if ( 1 )
		{
			//envoyer les données
 
			var vars:URLVariables = new URLVariables();
			vars.nom = formNom.text;
			vars.prenom = formPrenom.text;
			vars.adresse = formAdresse.text;
			vars.cp = formCodePostal.text;
			vars.ville = formVille.text;
			vars.pays = formPays.text;
			vars.telephone = formTelephone.text;
			vars.email = formEmail.text;
			vars.message = formMessage.text;
			var req:URLRequest = new URLRequest( 'http://odin.netau.net/envoimail.php');
			req.method = URLRequestMethod.POST;
			req.data = vars;
 
			var sender:URLLoader = new URLLoader();
			sender.load( req );
 
			//fermer le formulaire
			sendBtn.removeEventListener( MouseEvent.CLICK, onSend );
			formPrenom. text = 'Envoyer !' ;
			formNom.text = 'Envoyer !';
			formAdresse.text = 'Envoyer !';
			formVille.text = 'Envoyer !';
			formPays.text = 'Envoyer !';
			formCodePostal.text = 'Envoyer !';
			formEmail.text = 'Envoyer !';
			formTelephone.text = 'Envoyer !';
			formMessage.text = 'Merci pour votre message. Nous vous repondrons dans les plus brefs délais.';
			TweenMax.to( sendBtn, .6, { autoAlpha: 0} );
		}
	}
 
	}
}
ContentPage.as:
Code ActionScript :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package fr.odin.content
{
	import flash.display.MovieClip;
	import com.greensock.TweenMax;
 
	public class ContentPage extends MovieClip
	{
		private var _isInit:Boolean;
 
		public function ContentPage()
		{
			_isInit = false;
			visible = false;
			alpha = 0;
			super();
		}
 
		protected function init():void
		{
			_isInit = true;
		}
 
		public function show():void
		{
			if ( !_isInit )
			{
				init();
			}
 
			TweenMax.to( this, .45, { autoAlpha: 1} );
		}
		public function hide():void
		{
			TweenMax.to( this, .25, { autoAlpha: 0} );
		}
 
	}
}
Voila les erreurs qui apparraissent sous flash lors de la compilation et de la lecture sous flash:
Sortie:
TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
at fr.odin.content::Contact/init()
at fr.odin.content::ContentPage/show()
at fr.odin::Site/onMenuChange()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fr.odin.menu::Menu/selectItem()
at fr.odin.menu::Menu/onClick()
Normalement il n'y a aucun problème au niveau des pages Menu.as ou Site.as mais je vous ajoute les codes tout de même:

Menu.as:
Code ActionScript :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package fr.odin.menu
{
	import SWFAddress;
 
	import com.greensock.TweenMax;
	import com.greensock.easing.Quad;
 
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
 
 
	[Event(name="menuChange", type="fr.odin.menu.MenuEvent")]
 
	public class Menu extends MovieClip
	{
		public var menuMask:MovieClip;
		public var menuTexture:MovieClip;
 
		private var xmlLoader:URLLoader;
		private var xmlData:XML;
		//private var menuItems:Array;
		private var currentItem:MenuItem;
 
		public function Menu()
		{
			init();
		}
 
		private function init():void
		{
			menuTexture.mask= menuMask;
 
			xmlLoader = new URLLoader();
			xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
			xmlLoader.load( new URLRequest( 'data/xml/menu.xml' ) );
 
		}
 
		private function onXMLLoadComplete( event:Event = null ):void
		{
	xmlData = new XML( xmlLoader.data );
	var items:XMLList = xmlData.item;
	var n:int = items.length();
	var mi:MenuItem;
	while ( n--)
	{
		mi = new MenuItem( items[n] );
		mi.y = n * MenuItem.ITEM_HEIGHT;
		addChild( mi );
	}
		addEventListener( MouseEvent.CLICK, onClick );
 
		var path:String = SWFAddress.getPath();
		if ( path.length < 2 )
		{
			selectID( items[0].@uid );
		}
 
		SWFAddress.addEventListener( SWFAddressEvent.CHANGE, onSWFAddressChange );
		}
	private function onClick( event:MouseEvent = null):void
	{
		if ( event.target is MenuItem && currentItem != event.target )
		{
 
			selectItem( MenuItem( event.target ) );
			SWFAddress.setValue( currentItem.id );
 
		}
	}
	private function onSWFAddressChange( event:SWFAddressEvent ):void
	{
		if ( event.pathNames.length )
		{
			var nid:String = event.pathNames[0];
 
			if (!currentItem || currentItem.id != nid )
			{
				selectID( nid );
			}
		}
	}
 
	private function selectID( nid:String ):void
	{
		var d:DisplayObject;
		var n:int = numChildren;
		while ( n-- )
		{
			d = getChildAt( n );
			if ( d is MenuItem && MenuItem(d).id == nid )
			{
				selectItem( MenuItem(d) );
				break;
			}
		}
	}
 
	private function selectItem( ni:MenuItem ):void
	{
		if ( currentItem ) currentItem.selected = false;
 
		currentItem = ni;
		currentItem.selected = true
		TweenMax.to( menuMask, .4, {y: currentItem.y - 5, ease: Quad.easeOut } );
 
		dispatchEvent( new MenuEvent( currentItem.id ) );
	}
	}
	}

Site.as:
Code ActionScript :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package fr.odin
{
	import com.greensock.TweenMax;
	import com.greensock.easing.Quad;
 
	import flash.display.DisplayObject;
	import flash.display.Graphics;
	import flash.display.MovieClip;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.utils.Dictionary;
 
	import fr.odin.content.Acceuil;
	import fr.odin.content.Atelier;
	import fr.odin.content.Cartons;
	import fr.odin.content.Catalogue;
	import fr.odin.content.Contact;
	import fr.odin.content.ContentPage;
	import fr.odin.content.Infos;
	import fr.odin.content.Photos;
	import fr.odin.content.Videos;
	import fr.odin.content.Webcam;
	import fr.odin.menu.Menu;
	import fr.odin.menu.MenuEvent;
 
	public class Site extends MovieClip
	{
		public static var contentOffset:int;
 
		public var fond2:MovieClip;
		public var carton:MovieClip;
		public var logo:MovieClip;
		public var creation:MovieClip;
		public var zig_d:MovieClip;
		public var zig_g:MovieClip;
		public var fond1:MovieClip;
		public var etablissment:MovieClip;
		public var menu:Menu;
		public var zig_bas:MovieClip
 
		private var content:Sprite;
		private var contentBg:Shape;
		private var contentDictionnary:Dictionary;
		private var currentContent:ContentPage;
 
		public function Site()
		{
			if ( stage ) init();
			else addEventListener( Event.ADDED_TO_STAGE, init );
 
		}
 
		private function init( event:Event = null ):void
		{
			removeEventListener( Event.ADDED_TO_STAGE, init );
 
			var n:int = numChildren;
			var d:DisplayObject;
 
			for( var i:int = 0; i < n; i++ )
			{
				d = getChildAt(i);
 
				switch(d)
				{
				case menu:
					TweenMax.from( d, 1, { alpha:0, delay: 2, ease: Quad.easeOut } )
					break;
 
				case fond1:
 
					break;
 
				case fond2:
 
					break;
 
				default:	
				TweenMax.from( d, .6, { alpha:0, y: -d.height, delay: .3 * i, ease: Quad.easeOut } )
				break;
 
				}
 
 
			}
 
			contentOffset = 202;
 
			//crée les rubriques
			content = new Sprite();
			content.x = contentOffset;
			content.y = 128;
			content.alpha = 0
			addChild( content );
 
			contentBg = new Shape();
			var g:Graphics = contentBg.graphics;
			g.beginFill( 0xfcf7f0, 0.3 );
			g.drawRect ( 0, 0, 698, 355 );
			g.endFill();
			content.addChildAt( contentBg, 0 );
 
			contentDictionnary = new Dictionary();
			contentDictionnary['acceuil'] = content.addChild( new Acceuil() );
			contentDictionnary['atelier'] = content.addChild( new Atelier() );
			contentDictionnary['catalogue'] = content.addChild( new Catalogue() );
			contentDictionnary['cartons'] = content.addChild( new Cartons() );
			contentDictionnary['infos'] = content.addChild( new Infos() );
			contentDictionnary['photos'] = content.addChild( new Photos() );
			contentDictionnary['videos'] = content.addChild( new Videos() );
			contentDictionnary['webcam'] = content.addChild( new Webcam() );
			contentDictionnary['contact'] = content.addChild( new Contact() );
 
			//écouter le menu
		menu.addEventListener( MenuEvent.MENU_CHANGE, onMenuChange );
 
		}
	private function onMenuChange( event:MenuEvent ):void
	{
		if ( content.alpha ==0 ) TweenMax.to( content, 5, { alpha: 1} ) && TweenMax.from ( content, 3, { x: 600 } );
 
 
		if ( currentContent ) currentContent.hide();
 
		currentContent = ContentPage( contentDictionnary[event.itemID] );
		currentContent.show();
	}
	}
}

Si vous avez besoin d'autre information dite moi je vous enverrai les fichiers complémentaires !
Merci d'avance