Bonjour à tous,
Je suis debutant en Flex et après avoir fait quelques tutoriels, j'ai decidé de passer à la creation d'une application (Flex1.mxml)
C'est une application de tri de nom utilisateur en fonction que soit un "M","Mme" ou "Mlle".
Je ne souhaite pas ecrire le Script dans de le fichier "mxml"......mais dans une fichier actionScript à part ( Contact.as)
Le nom de mes utilisateurs sont dans un fichier "xml" (Contact.xml)
Je suis debutant en ActionScript et j'aimerais savoir au niveau de Flex où faire le lien vers ma methode ?
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 <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="findContact.send()" layout="absolute"> <mx:Script> <![CDATA[ import com.itesoft.flex.action.Contact; // Code ActionScript 3.0 directement intégré dans le fichier MXML // Ce code pourrait être placé dans un fichier séparé avec l'extension .as } ]]> </mx:Script> <mx:HTTPService id="findContact" url="C:\Etu\Flex1\Contact.xml" useProxy="false" /> <mx:Panel x="10" y="10" width="475" height="400" layout="absolute" title="{findContact.lastResult.rss.channel.title}"> <mx:ComboBox x="30" y="25" id="cbxNumPosts" change="sort()"> //comment faire le lien vers mon fichier ActionScript "Contact.as" et sa methode sort() ?" ? <mx:Object label="Monsieur" data="M" /> <mx:Object label="Madame" data="Mme" /> <mx:Object label="Mademoiselle" data="Mlle" /> </mx:ComboBox> <mx:DataGrid id="dgPosts" x="20" y="60" width="400" dataProvider="{findContact.lastResult.rss.channel.contacts.item}"> <mx:columns> <mx:DataGridColumn headerText="Status" dataField="status"/> <mx:DataGridColumn headerText="Nom" dataField="name" /> <mx:DataGridColumn headerText="Prenom" dataField="firstName" width="150" /> </mx:columns> </mx:DataGrid> </mx:Panel> <mx:Panel x="480" y="10" width="300" height="400" layout="absolute" title="Information Utilisateur"> <mx:TextArea x="10" y="10" width="100" htmlText="{dgPosts.selectedItem.name}" height="26" borderStyle="none"/> <mx:TextArea x="10" y="44" width="100" htmlText="{dgPosts.selectedItem.firstName}" height="24" borderStyle="none"/> </mx:Panel> </mx:Application>
Mervi à vous.
Partager