Bonjour ,

j'ai vu sur un post que pour obtenir la résolution de l'écran il faut faire :
this.parentApplication.height
this.parentApplication.width

J'ai donc essayé de mettre ça dans la partie actionscript de mon mxml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="unTest()">
    <mx:Script>
    	public function unTest():void {
			var i:Number = this.parentApplication.height;
			var j:Number = this.parentApplication.width;
    	}
	</mx:Script>
</mx:Application>
et là lorsque j'execute j'ai l'erreur suivante :

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 test/unTest()[D:\DevJEE2008\workspace\test\flex_src\test.mxml:5]
at test/___test_Application1_creationComplete()[D:\DevJEE2008\workspace\test\flex_src\test.mxml:2]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9051]
at mx.core::UIComponent/set initialized()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1167]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:698]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]
at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]

et si je debug, il me dit que mon parentApplication est null...

Voilà, donc je me demande si c'est bien ça qu'il fallait faire en fait...

merci !
Pascale38