<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flashxpress &#187; Flash général</title>
	<atom:link href="http://www.flashxpress.net/category/ressources-flash/flash-general/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flashxpress.net</link>
	<description>Ressources pour la création et les technologies du web</description>
	<lastBuildDate>Thu, 09 Feb 2012 01:00:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Nouveautés Flash Player 11.2 &#8211; mouseLock, right click et cie..</title>
		<link>http://www.flashxpress.net/ressources-flash/nouveautes-flash-player-11-2-mouselock-right-click-et-cie/</link>
		<comments>http://www.flashxpress.net/ressources-flash/nouveautes-flash-player-11-2-mouselock-right-click-et-cie/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 11:56:00 +0000</pubDate>
		<dc:creator>alama</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>
		<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[Flash Player 11.2]]></category>
		<category><![CDATA[middle_click]]></category>
		<category><![CDATA[MouseEvent.RIGHT_CLICK]]></category>
		<category><![CDATA[mouseLock]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=6842</guid>
		<description><![CDATA[Nouveautés Flash Player 11.2 (Beta au 7/12/2011) Les nouveautés principales que la majorité des programmeurs risquent d&#8217;utiliser tournent autour de la gestion souris. Voyons ça en détail. !! Les swfs d&#8217;exemples necessitent le Player 11.2 (beta) ou supérieur !! Téléchargez la beta 11.2 ici Gestion du right clic et du middle clic de la souris [...]]]></description>
			<content:encoded><![CDATA[<h1>Nouveautés Flash Player 11.2 (Beta au 7/12/2011)</h1>
<p>Les nouveautés principales que la majorité des programmeurs risquent d&#8217;utiliser tournent autour de la gestion souris. Voyons ça en détail.</p>
<p><strong>!! Les swfs d&#8217;exemples necessitent le Player 11.2 (beta) ou supérieur !!<br />
</strong></p>
<p><a href="http://labs.adobe.com/downloads/flashplayer11-2.html" target="_blank">Téléchargez la beta 11.2 ici</a></p>
<h1>Gestion du right clic et du middle clic de la souris</h1>
<p>Commençons par la plus simple, on peut désormais écouter des événements <strong><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">RIGHT_CLICK</span></strong> et <strong><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">MIDDLE_CLICK</span></strong>.</p>
<p>Concernant le middle clic, sur la plupart des souris, c&#8217;est l&#8217;enfoncement de la roulette.</p>
<p>Concernant le clic droit, par défaut, le clic droit fait apparaître le menu contextuel natif de Flash. Menu que l&#8217;on peut d&#8217;ailleurs modifier en partie, en ajoutant de nouvelles entrées. Depuis la version 11.2, le simple fait d&#8217;ajouter un écouteur d&#8217;événement sur le clic droit désactive le menu natif de Flash. Cela permet de faire d&#8217;autres choses au clic droit, ou de faire son propre menu avec son propre skin et ses propres entrées&#8230;</p>
<p>Aucune classe native de menu contextuel ne pourra servir de base, il faudra créer à 100% son menu et le gérer. L&#8217;avantage est une liberté totale.</p>
<p>Voici un simple exemple, il est évident qu&#8217;en situation réelle, il faudra créer une classe pour ce menu et la faire autrement avec des méthodes &laquo;&nbsp;addItem&nbsp;&raquo;, etc., plus un contrôle de positionnement en bord d&#8217;application, que je n&#8217;ai pas pris la peine de faire&#8230; Ici, c&#8217;est juste pour l&#8217;exemple.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_rightclic_1220829289"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://www.covergraph.com/blog/flash/player11.2features/rightclic.swf" />
	<param name="scale" value="noscale" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.covergraph.com/blog/flash/player11.2features/rightclic.swf"
			name="fm_rightclic_1220829289"
			width="400"
			height="300">
		<param name="scale" value="noscale" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Code de test:</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p6842code3'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p68423"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p6842code3"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Alama
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> menuItems<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> menu<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> output<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000000;">&#41;</span>
				<span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">else</span>
				<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ADDED_TO_STAGE</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ADDED_TO_STAGE</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// entry point</span>
			menuItems = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000066; font-weight: bold;">;</span>
			makeExampleMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			output = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">autoSize</span> = <a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Action: &quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>output<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span>RIGHT_CLICK<span style="color: #000066; font-weight: bold;">,</span> mouseRightClikHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span>MIDDLE_CLICK<span style="color: #000066; font-weight: bold;">,</span> mouseMiddleClikHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> mouseClikHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #3f5fbf;">/*__________________________________________________________________________________
		*
		*  Events Handlers
		* __________________________________________________________________________________
		*/</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> mouseRightClikHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Action: <span style="">\&quot;</span>Right Click<span style="">\&quot;</span>&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> mouseMiddleClikHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Action: <span style="">\&quot;</span>Middle Click<span style="">\&quot;</span>&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> mouseClikHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Action: <span style="">\&quot;</span>Left Click<span style="">\&quot;</span>&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> menuClickHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stopPropagation</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Action: Click on <span style="">\&quot;</span>&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> menuItems<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\&quot;</span>&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> menuItemOverHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			menuItems<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">textColor</span> = 0xff6600<span style="color: #000066; font-weight: bold;">;</span>
			menuItems<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> menuItemMouseOutHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			menuItems<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">textColor</span> = 0xffffff<span style="color: #000066; font-weight: bold;">;</span>
			menuItems<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #000066; font-weight: bold;">.</span>5<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #3f5fbf;">/*__________________________________________________________________________________
		*
		*  Privates Functions
		* __________________________________________________________________________________
		*/</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> makeExampleMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			menu = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000000; font-weight:bold;">6</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #009900; font-style: italic;">// ! casting just for AutoCompletion helper</span>
				<a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span>menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">autoSize</span> = <a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000066; font-weight: bold;">;</span>
				<a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span>menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">selectable</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Ceci est l'Item &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">textColor</span> = 0xffffff<span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseEnabled</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = i <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span> = i<span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">buttonMode</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000066; font-weight: bold;">,</span> menuItemOverHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OUT</span><span style="color: #000066; font-weight: bold;">,</span> menuItemMouseOutHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x000000<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> i <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #000066; font-weight: bold;">.</span>5<span style="color: #000066; font-weight: bold;">;</span>
				menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>btn<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>menuItems<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> menuClickHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>menu<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h1>Le mouseLock et le movementMouse</h1>
<p>Une autre nouvelle fonctionnalité est le <strong>mouseLock</strong>. Le but ici est de rendre la souris active tout le temps! Même en dehors du stage (donc, en dehors de l&#8217;animation et même de l&#8217;écran).</p>
<p>Seule restriction, le <strong>mouseLock </strong>n&#8217;est possible qu&#8217;on mode <strong>fullScreen </strong>! Si on essaye de l&#8217;activer en mode normal, cela génère une erreur d&#8217;exécution visible par le player debugger.</p>
<p>Lorsque le <strong>mouseLock </strong>est <strong>activé</strong>, le <strong>curseur </strong>de la souris <strong>disparaît </strong>! A la base, c&#8217;est logique, puisque dans ce mode, nous n&#8217;avons pas besoin de savoir où se trouve réellement la souris. &laquo;&nbsp;Ha bon&nbsp;&raquo;, vous allez me dire.. Oui! dans ce mode, seules les variations de souris nous intéressent.. Voici l&#8217;explication..</p>
<p>Normalement, quand a besoin de connaître les coordonnées de la souris, on lit une des propriétés <strong>stageX</strong>(Y) ou <strong>localX</strong>(Y) d&#8217;un évènement <code>MouseEvent</code>. Lorsque le <strong>mouseLock </strong>est <strong>actif</strong>, ces propriétés sont fixée à <strong>0 </strong>et ne peuvent plus servir! On peut être tenté d&#8217;utiliser <code>le stage.mouseX(Y)</code>, mais celui-ci ne fonctione plus non plus&#8230; Il renverra n&#8217;importe quoi, basé sur un delta que nous allons voir ci après. Donc, en mode &laquo;&nbsp;<strong>mouseLock</strong>&laquo;&nbsp;, on oublie le système de coordonnées classique.</p>
<p>Par contre, deux nouvelles propriétés ont été ajoutées à <code>MouseEvent</code>! Il s&#8217;agit de <strong>movementX </strong>et <strong>movementY</strong>. Ces nouvelles propriétés, à l&#8217;inverse des anciennes, ne sont actives qu&#8217;en mode mouseLock! Le reste du temps, elles sont fixées à 0.</p>
<p>Le &laquo;&nbsp;movement&nbsp;&raquo; est en fait un deltaMouse, le nombre de pixels de déplacement qui a eu lieu entre 2 appels de l&#8217;<code>Event</code> mouseMove.</p>
<p>Cette nouveauté peut servir à plein de choses&#8230; surtout pour les jeux et certaines applications&#8230; On est plus contraint à la taille de l&#8217;animation, on peut juste regretter que cette <strong>fonctionalité ne soit disponible qu&#8217;en fullScreen</strong>..</p>
<p>Dans l&#8217;exemple ci dessous, je fais tourner un jog shuttle sans math, juste grace au <strong>movementX</strong>.</p>
<p><strong>Pour passer en fullScreen, veuillez cliquer sur le rectangle noir</strong>.</p>
<p>On peut voir que les propriétés <strong>mouseX(Y)</strong> ne fonctionnent qu&#8217;en <strong>normalScreen </strong>et que les <strong>movementX(Y)</strong> ne fonctionnent qu&#8217;en <strong>fullScreen</strong>. Cela est dû à <strong>l&#8217;activation du mouseLock</strong> au moment du passage en fullScreen.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_mouselock_285287942"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://www.covergraph.com/blog/flash/player11.2features/mouselock.swf" />
	<param name="scale" value="noscale" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.covergraph.com/blog/flash/player11.2features/mouselock.swf"
			name="fm_mouselock_285287942"
			width="400"
			height="300">
		<param name="scale" value="noscale" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Code simple qui permet de tester la chose.</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p6842code4'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p68424"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p6842code4"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span>StageDisplayState<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html"><span style="color: #004993;">StageScaleMode</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Alama
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> menuItems<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> menu<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> output<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> shuttle<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000000;">&#41;</span>
				<span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">else</span>
				<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ADDED_TO_STAGE</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ADDED_TO_STAGE</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// entry point</span>
			output = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">autoSize</span> = <a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Stage Size = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot; X &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>output<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> btn<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
			btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x000000<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>btn<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">buttonMode</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> btnClickHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			shuttle = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x333333<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x999999<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span>
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">260</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>shuttle<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">RESIZE</span><span style="color: #000066; font-weight: bold;">,</span> stageResizeHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_MOVE</span><span style="color: #000066; font-weight: bold;">,</span> stageMouseMoveHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/*__________________________________________________________________________________
		 *
		 *  Events Handlers
		 * __________________________________________________________________________________
		 */</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnClickHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">displayState</span> = StageDisplayState<span style="color: #000066; font-weight: bold;">.</span>FULL_SCREEN<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span>mouseLock = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> stageResizeHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Stage Size = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot; X &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> stageMouseMoveHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			output<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Stage Size = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot; X &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span> <span style="color: #000066; font-weight: bold;">+</span>
			<span style="color: #990000;">&quot;<span style="">\n</span>mouseX: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageX</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot; - mouseY: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageY</span> <span style="color: #000066; font-weight: bold;">+</span>
			<span style="color: #990000;">&quot;<span style="">\n</span>movementX: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span>movementX <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot; - movementY: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span>movementY<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			shuttle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">rotation</span> <span style="color: #000066; font-weight: bold;">+</span>= e<span style="color: #000066; font-weight: bold;">.</span>movementX<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h1>Conclusion</h1>
<p>Ces nouvelles fonctionnalités vont sans doute trouver un certain succès auprès des programmeurs&#8230; Surtout la gestion du clic droit et le fait de pouvoir faire ses propres menus contextuels.</p>
<p>Le mouseLock est très bien lorqu&#8217;on souhaitera avoir un contrôle qui va au-delà de l&#8217;espace de l&#8217;animation et même au-delà de l&#8217;écran (défilement de quelque chose, jeux, ..).</p>
<p>Il y a encore d&#8217;autres nouveautés telles que la mise à jour automatique du Player en arrière plan (tâche de fond) ou le décodage de la video (h264) en background, dans un thread séparé.</p>
<p>Les exemples de code (et swfs) présents sur cette page sont très primaires, ils ont pour but de démystifier les nouvelles fonctionnalités du Flash Player 11.2. A chacun d&#8217;y trouver un usage propre et de développer ses algorithmes persos&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/nouveautes-flash-player-11-2-mouselock-right-click-et-cie/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Nouvelles fonctionnalités de Flash CS5.5</title>
		<link>http://www.flashxpress.net/ressources-flash/nouvelles-fonctionnalitees-de-flash-cs5-5/</link>
		<comments>http://www.flashxpress.net/ressources-flash/nouvelles-fonctionnalitees-de-flash-cs5-5/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 12:10:12 +0000</pubDate>
		<dc:creator>Olivier</dc:creator>
				<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[CS5.5]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=6325</guid>
		<description><![CDATA[Hello Flash world ! Après avoir listé quelques features de la CS5.5, nous allons dans cet article vous en dire davantage sur Flash CS 5.5. Pas besoin de le cacher, la plupart est en rapport avec le développement multi-écrans. Voici quelques-unes des nouveautés donc de Flash CS 5.5 : Aide à la gestion des calques [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/headerFlashCS55.png"><img class="alignnone size-full wp-image-6353" title="headerFlashCS55" src="http://www.flashxpress.net/wp-content/uploads/2011/04/headerFlashCS55.png" alt="" width="630" /></a></p>
<p>Hello Flash world !</p>
<p>Après avoir listé quelques features de la CS5.5, nous allons dans cet article vous en dire davantage sur Flash CS 5.5. Pas besoin de le cacher, la plupart est en rapport avec le développement multi-écrans.</p>
<p>Voici quelques-unes des nouveautés donc de Flash CS 5.5 :</p>
<p><strong>Aide à la gestion des calques simplifiée <span style="font-size: 9px;">(ENFIN :p)</span>.</strong></p>
<p>Flash CS5.5 nous permet de faire directement des couper / copier / coller / dupliquer de calque dans un même document voir même d&#8217;un document à un autre !</p>
<p>Le menu contextuel a été quelque peu modifié.</p>
<p>Voici ce que nous obtenons maintenant lors du clic droit sur un calque dans Flash CS5.5 :</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/cliqueDroitCalqueCS552.png"><img class="alignnone size-full wp-image-6329" title="cliqueDroitCalqueCS552" src="http://www.flashxpress.net/wp-content/uploads/2011/04/cliqueDroitCalqueCS552.png" alt="" width="314" height="502" /></a></p>
<p>J&#8217;ai d&#8217;ailleurs effectué quelques tests et n&#8217;ai rencontré aucun problème.</p>
<p>Ces fonctionnalités simples et efficaces nous feront gagner un temps fou. Je me rappelle de ces longues animations image par image créées en oubliant de les imbriquer dans un clip. C&#8217;était quand même un peu galère de réorganiser l&#8217;imbrication du document. Et bien cette époque est révolue ! <img src='http://www.flashxpress.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<p><strong>Une palanquée de nouveaux snippets de code</strong></p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/snippetCodecs55.png"><img class="alignnone size-full wp-image-6332" title="snippetCodecs55" src="http://www.flashxpress.net/wp-content/uploads/2011/04/snippetCodecs55.png" alt="" width="332" height="380" /></a></p>
<p>De supers nouveaux snippets, notamment pour les périphériques tactiles, AIR et AIR mobiles,  des actions simples mais très utiles que l&#8217;on retrouve dans la plupart des applications. On trouve des snippets pour par exemple :</p>
<p>- La fermeture de l&#8217;application</p>
<p>- La réduction de l&#8217;application</p>
<p>- La restauration de l&#8217;application</p>
<p>- Le chargement de fichier</p>
<p>- L&#8217;enregistrement de fichier</p>
<p>- La gestion de la géolocalisation</p>
<p>- La gestion d&#8217;évènements tactiles</p>
<p>- La gestion de l&#8217;accéléromètre</p>
<p>Bref, au total plus de 70 snippets plus efficaces les uns que les autres.</p>
<p>&nbsp;</p>
<p><strong>La transformation d&#8217;un symbole en bitmap</strong></p>
<p>Et on continu avec les killer features !</p>
<p>Flash CS5.5 nous donne la possibilité d&#8217;exporter un symbole tel qu&#8217;un Clip en bitmap, et cela en vue d&#8217;une optimisation mobile of course !</p>
<p>Nous avons le choix entre deux formats, le JPEG ou le PNG / GIF</p>
<p>Concrètement, comment ça se passe ?</p>
<p>Plusieurs possibilités :</p>
<p>- Soit un symbole contenant uniquement des formes vectorielles ou d&#8217;autres symboles, mais aucune animation n&#8217;est présente. Si l&#8217;on fait clic droit sur le symbole puis convertir en Bitmap, un bitmap sera créé dans la bibliothèque et le symbole sur la scène remplacé par ce nouveau bitmap.</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/convertionSymboleBitmap.png"><img class="alignnone size-thumbnail wp-image-6336" title="convertionSymboleBitmap" src="http://www.flashxpress.net/wp-content/uploads/2011/04/convertionSymboleBitmap-e1302599149412-310x84.png" alt="" width="310" height="84" /></a></p>
<p>- Soit un symbole. Vous souhaitez le transformer en bitmap mais uniquement lors de la compilation de l&#8217;application.  Dans le panneau des Propriétés, un nouveau menu est maintenant disponible : &laquo;&nbsp;Exporter en temps que bitmap&nbsp;&raquo;. Dans ce cas, lors de l&#8217;export, le symbole sera directement exporté en bitmap ! Très bon.</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/optionExportClip.png"><img class="alignnone size-full wp-image-6337" title="optionExportClip" src="http://www.flashxpress.net/wp-content/uploads/2011/04/optionExportClip.png" alt="" width="279" height="72" /></a></p>
<p>Le gros avantage de cette seconde technique est que votre objet est toujours un objet vectoriel et qu&#8217;il conserve tous les avantages de ce format puisque ce n&#8217;est qu&#8217;à l&#8217;export qu&#8217;il est &laquo;&nbsp;bitmapisé&nbsp;&raquo;.</p>
<p>&nbsp;</p>
<p><strong>Mise à l&#8217;échelle du contenu d&#8217;un document lors du redimensionnement de la scène</strong></p>
<p>Peut-être avez-vous déjà dû produire une application en plusieurs formats. Par exemple une version pour iPhone, une pour iPad, une pour un device  Android&#8230;Les résolutions d&#8217;écran sont différentes, et vous devrez  si vous n&#8217;utilisez pas de layout manager, dupliquer le projet et passer  un temps incalculable à redimensionner vos symboles, recaler vos  animations, etc.</p>
<p>Dans cette nouvelle  mouture de Flash CS5.5 cette longue et éprouvante expérience se réduit à  quelques secondes (notez qu&#8217;il faudra quand même retoucher deux, ou trois  choses derrière, mais globalement c&#8217;est plutôt pas mal) !</p>
<p>Voici la procédure :</p>
<p>1) Votre application est terminée. Vous vous apprêtez à faire les différentes versions</p>
<p>2) Vous dupliquez votre projet</p>
<p>3) Ouvrez une copie de ce projet et rendez-vous dans la boîte de dialogue &laquo;&nbsp;Paramètres du document&nbsp;&raquo;</p>
<p>4) Redimensionnez votre scène à votre convenance</p>
<p>5) Cochez la case &laquo;&nbsp;Mettre à l&#8217;échelle le contenu avec la scène&nbsp;&raquo;</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/redimentionAppCS55.png"><img title="redimentionAppCS55" src="http://www.flashxpress.net/wp-content/uploads/2011/04/redimentionAppCS55-e1302601540281-310x52.png" alt="" width="310" height="52" /></a></p>
<p>6) Confirmez en cliquant sur OK</p>
<p>Flash  va redimensionner et replacer les différents élément de votre  application !</p>
<p>&nbsp;</p>
<p><strong>Boite de dialogue &laquo;&nbsp;Paramètres du publication&nbsp;&raquo; simplifiés</strong></p>
<p>Voici une toute petite feature qui fait quand même du bien !</p>
<p>La boite des paramètres de publication a été épurée et la petite case à cocher pour générer les SWC est bien plus accessible :</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/boiteDialogueParametreDePublicationCS55.png"><img class="alignnone size-medium wp-image-6338" title="boiteDialogueParametreDePublicationCS55" src="http://www.flashxpress.net/wp-content/uploads/2011/04/boiteDialogueParametreDePublicationCS55-549x700.png" alt="" width="549" height="700" /></a></p>
<p>&nbsp;</p>
<p><strong>Sauvegarde automatique de vos précieux documents toute les x minutes</strong></p>
<p>Voila LA case anti-coupure de courant ! LA case qui vous aidera à ne pas frapper sur vos collègues lorsque par &laquo;&nbsp;inadvertance&nbsp;&raquo; ils ont appuyés sur le bouton rouge de la multiprise&#8230;bref, je vous présente la case à cocher de &laquo;&nbsp;Sauvegarde automatique&nbsp;&raquo;. Celle-ci est disponible dans la boite de dialogue &laquo;&nbsp;Paramètres du document&nbsp;&raquo;, juste en dessous de la cadence d&#8217;animation de votre document :</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2011/04/paraDocCS55.png"><img class="alignnone size-full wp-image-6340" title="paraDocCS55" src="http://www.flashxpress.net/wp-content/uploads/2011/04/paraDocCS55.png" alt="" width="568" height="255" /></a></p>
<p>&nbsp;</p>
<p>Voila pour les features qui paraissent les plus juteuses !</p>
<p>Pour plus d&#8217;info :</p>
<p>- <a href="http://www.adobe.com/fr/products/flash.html" target="_blank">Présentation de Flash Professional CS5.5</a></p>
<p>- <a href="http://www.adobe.com/fr/products/flash/features.html" target="_blank">Nouvelles fonctionnalités de Flash Professional CS 5.5</a></p>
<p>Amicalement.</p>
<p>Olivier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/nouvelles-fonctionnalitees-de-flash-cs5-5/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Séparation du design et du code dans Flash &#8211; part 3</title>
		<link>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-3/</link>
		<comments>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-3/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 16:27:51 +0000</pubDate>
		<dc:creator>Nicolas Gans</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>
		<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Best practices]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex Builder]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=4477</guid>
		<description><![CDATA[Ces trois tutoriels font suite à un séminaire donné chez Adobe France le 23 novembre 2009, par Nicolas Gans, responsable pédagogique plate-forme Flash au centre de formation Regart.net. Ils reprennent les slides et les exemples montrés lors de cette journée. Le séminaire est divisé en trois parties : - Séparation du design et du code [...]]]></description>
			<content:encoded><![CDATA[<p>Ces trois tutoriels font suite à un séminaire donné chez Adobe France le 23 novembre 2009, par <a href="http://www.twitter.com/nicolasgans" target="_blank">Nicolas Gans</a>, responsable pédagogique plate-forme Flash au centre de formation <a href="http://www.regart.net" target="_blank">Regart.net</a>.</p>
<p>Ils reprennent les slides et les exemples montrés lors de cette journée.</p>
<p>Le séminaire est divisé en trois parties :</p>
<p><a href="http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-1">- Séparation du design et du code dans Flash &#8211; part 1 : séparation .fla et .as</a><br />
<a href="../ressources-flash/separation-du-design-et-du-code-dans-flash-part-2">- Séparation du design et du code dans Flash &#8211; part 2 : compiler des .fla différents</a><br />
<a href="../ressources-flash/separation-du-design-et-du-code-dans-flash-part-3">- Séparation du design et du code dans Flash &#8211; part 3 : coder et compiler avec Flex Builder</a></p>
<h3>Problématiques abordées :</h3>
<p><em>Comment développer un projet en Flash et fluidifier les échanges au sein d’une équipe composée de designer Flash et de développeurs AS3 .<br />
</em></p>
<p><em>Quelles sont les bonnes pratiques (séparation et communication entre éléments du design et code), les techniques (librairies partagées, SWC),  outils (FlashDevelop, Flex Builder) ?</em></p>
<h1>Coder et compiler des projets Flash avec Flex Builder</h1>
<p>Travailler avec un éditeur AS3 robuste et puissant, basé sur Eclipse, cross-plateform.<br />
Bénéficier du compilateur du Flex SDK, plus rapide.</p>
<h2>Créer un projet AS3 dans Flex Builder</h2>
<p>Etape 1</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_1.png"><img class="alignnone size-thumbnail wp-image-4557" title="projet_AS3_1" src="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_1-310x150.png" alt="projet_AS3_1" width="310" height="150" /></a></p>
<p>Etape 2</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_2.png"><img class="alignnone size-thumbnail wp-image-4558" title="projet_AS3_2" src="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_2-310x150.png" alt="projet_AS3_2" width="310" height="150" /></a></p>
<p>Etape 3 : choisir le nom de la classe du document</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_3.png"><img class="alignnone size-thumbnail wp-image-4559" title="projet_AS3_3" src="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_3-310x150.png" alt="projet_AS3_3" width="310" height="150" /></a></p>
<p>Etape 4 : le projet est maintenant crée. On créera ses classes dans le dossier &laquo;&nbsp;src&nbsp;&raquo;, via un clic droit sur le dossier &gt; New &gt; ActionScript class</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_4.png"><img class="alignnone size-thumbnail wp-image-4560" title="projet_AS3_4" src="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_4-310x150.png" alt="projet_AS3_4" width="310" height="150" /></a></p>
<p>Etape 5 : la compilation. La compilation en mode debug est préférable en production : elle permet de récupérer les trace() et les erreurs à l&#8217;exécution dans le panneau de sortie (il faudra peut-être installer le <a href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">player de debug</a> sur votre machine). Une fois le projet terminé, on pourra compiler en mode Release.</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_5.png"><img class="alignnone size-thumbnail wp-image-4561" title="projet_AS3_5" src="http://www.flashxpress.net/wp-content/uploads/2009/11/projet_AS3_5-310x150.png" alt="projet_AS3_5" width="310" height="150" /></a></p>
<h2>Faire la liaison Asset en bibliothèque / Classe par code</h2>
<ul>
<li>But : reproduire une liaison de bibliothèque de Flash au sein de Flex Builder</li>
<li>Utilisation d’Embed avec un swf contenant les assets pour en extraire les symboles exportés</li>
<li>Placer l’Embed juste avant      la déclaration de la classe</li>
<li>Défaut :<br />
Aucun code placé dans le clip ne sera exécuté<br />
Pas d’utilisation de composants possible</li>
</ul>
<h3>Exemple : 08_Liaison_asset_classe_par_code_avec_FB [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/08_Liaison_asset_classe_par_code.zip">Télécharger l'exemple</a>]</h3>
<p><strong><span style="text-decoration: underline;">NOTE</span></strong> : pour ouvrir l&#8217;exemple, passer par fichier &gt; importer et importer directement l&#8217;archive .zip au sein de Flex Builder.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4477code9'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p44779"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4477code9"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> asfiles
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
&nbsp;
	<span style="color: #009900; font-style: italic;">// on associe un asset de la librairie à notre classe = comme si on faisait une liaison par code</span>
	<span style="color: #000000;">&#91;</span>Embed <span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;../assets/assets.swf&quot;</span><span style="color: #000066; font-weight: bold;">,</span> symbol=<span style="color: #990000;">&quot;Personnage_asset&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Personnage <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> message_txt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Personnage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> clignote<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">loop</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">loop</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">alpha</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h2>Utiliser un SWC pour les assets graphiques</h2>
<ul>
<li>Pas de complétion si on      travaille avec des clips de la bibliothèque embedés avec la 1ere méthode.</li>
<li>On ne peut pas cibler les      occurrences placées sur la scène d’un MC.</li>
<li>Solution : utiliser      un SWC.</li>
<li>Introspection automatique      de la classe, FD est capable d’aller chercher automatiquement les      occurrences sur la scène.</li>
<li>On pourra mettre du code dans ses MovieClip : le code timeline sera conservé avec les SWC</li>
</ul>
<p>Pour générer un .swc dans Flash, cocher la case exporter SWC dans les paramètres de publication</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/creation_swc_dans_flash.png"><img class="alignnone size-thumbnail wp-image-4534" title="creation_swc_dans_flash" src="http://www.flashxpress.net/wp-content/uploads/2009/11/creation_swc_dans_flash-310x150.png" alt="creation_swc_dans_flash" width="310" height="150" /></a></p>
<p>Quand vous compilez votre SWF via CTRL + ENTREE, un SWC est automatiquement crée à côté du SWF</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/creation_swc_dans_flash_2.png"><img class="alignnone size-thumbnail wp-image-4544" title="creation_swc_dans_flash_2" src="http://www.flashxpress.net/wp-content/uploads/2009/11/creation_swc_dans_flash_2-310x150.png" alt="creation_swc_dans_flash_2" width="310" height="150" /></a></p>
<p>Pour ajouter un SWC à son projet Flex : clic-droit sur le projet</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/ajout_SWC_projet_AS3_Flex.png"><img class="alignnone size-thumbnail wp-image-4539" title="ajout_SWC_projet_AS3_Flex" src="http://www.flashxpress.net/wp-content/uploads/2009/11/ajout_SWC_projet_AS3_Flex-310x150.png" alt="ajout_SWC_projet_AS3_Flex" width="310" height="150" /></a></p>
<p>Puis dans le panneau des propriétés, choisir &laquo;&nbsp;ActionScript build path&nbsp;&raquo;, puis &laquo;&nbsp;Add SWC&nbsp;&raquo;, choisir le SWC a ajouter au projet et valider en cliquant sur &laquo;&nbsp;OK&nbsp;&raquo;</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/ajout_SWC_projet_AS3_Flex_2.png"><img class="alignnone size-thumbnail wp-image-4540" title="ajout_SWC_projet_AS3_Flex_2" src="http://www.flashxpress.net/wp-content/uploads/2009/11/ajout_SWC_projet_AS3_Flex_2-310x150.png" alt="ajout_SWC_projet_AS3_Flex_2" width="310" height="150" /></a></p>
<p>Les classes incluses dans le SWC sont maintenant utilisables dans votre projet Flex !</p>
<h3>Exemple : 09_Utilisation_de_SWC [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/09_Utilisation_de_SWC.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="640" height="480">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/utilisation_de_SWC.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="640" height="480" src="http://www.flashxpress.net/wp-content/uploads/2009/11/utilisation_de_SWC.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4477code10'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p447710"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4477code10"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagealign.html"><span style="color: #004993;">StageAlign</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html"><span style="color: #004993;">StageScaleMode</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #000000;">&#91;</span>SWF <span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;640&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;480&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">frameRate</span>=<span style="color: #990000;">&quot;30&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;0xCCCCCC&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> monPerso<span style="color: #000066; font-weight: bold;">:</span>Personnage_asset<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> const defaultInput<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;votre message&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">align</span> = <a href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagealign.html"><span style="color: #004993;">StageAlign</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TOP_LEFT</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleMode</span> = <a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html"><span style="color: #004993;">StageScaleMode</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">NO_SCALE</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// on instancie la classe Personnage_asset issue du .swc</span>
			monPerso = <span style="color: #0033ff; font-weight: bold;">new</span> Personnage_asset<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">;</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>monPerso<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;AnimationTerminee&quot;</span><span style="color: #000066; font-weight: bold;">,</span> animeTerminee<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> animeTerminee<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			monPerso<span style="color: #000066; font-weight: bold;">.</span>message_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;HiDiHo!&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// on peut utiliser des composants Flash</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span>ok_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> clickOK<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">FOCUS_IN</span><span style="color: #000066; font-weight: bold;">,</span> onInputFocusIn<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">FOCUS_OUT</span><span style="color: #000066; font-weight: bold;">,</span> onInputFocusOut<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> clickOK<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			monPerso<span style="color: #000066; font-weight: bold;">.</span>message_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInputFocusIn<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> == defaultInput<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInputFocusOut<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> == <span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				monPerso<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = defaultInput<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h2>Utilisation de SWC au sein  de Flex Builder : séparation design et code</h2>
<p>Composition vs Héritage</p>
<h3>Méthode 1 : héritage</h3>
<ul>
<li>Faire un symbole      MonSymbole_skin dans flash</li>
<li>Faire une classe      MonSymbole dans Flex Builder qui hérite de MonSymbole_skin</li>
<li>On accède aux occurrences      de manière transparente</li>
<li>Problème :<br />
Contrainte liée à l’héritage : on ne peut pas faire hériter d’une      classe abstraite notre classe</li>
</ul>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/SWC_heritage_small.png"><img class="alignnone size-thumbnail wp-image-4550" title="SWC_heritage_small" src="http://www.flashxpress.net/wp-content/uploads/2009/11/SWC_heritage_small-310x150.png" alt="SWC_heritage_small" width="310" height="150" /></a></p>
<h3>Exemple : 10_SWC_et_separation_design_code_heritage [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/10_SWC_et_separation_design_code_heritage.zip">Télécharger l'exemple</a>]</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4477code11'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p447711"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4477code11"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> classes
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #009900; font-style: italic;">// notre classe contenant la logique, crée dans Flex, hérite de la classe graphique</span>
	<span style="color: #009900; font-style: italic;">// crée par le graphiste dans Flash et stockée dans le assets.swc</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Personnage <span style="color: #0033ff; font-weight: bold;">extends</span> Personnage_asset
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> const defaultInput<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;votre message&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Personnage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;AnimationTerminee&quot;</span><span style="color: #000066; font-weight: bold;">,</span> animeTerminee<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> animeTerminee<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// par héritage, on accède aux occurrences posées sur la scène</span>
			<span style="color: #009900; font-style: italic;">// de Personnage_asset par le designer</span>
			message_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;HiDiHo!&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			ok_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> clickOK<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">FOCUS_IN</span><span style="color: #000066; font-weight: bold;">,</span> onInputFocusIn<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">FOCUS_OUT</span><span style="color: #000066; font-weight: bold;">,</span> onInputFocusOut<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> clickOK<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			message_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInputFocusIn<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> == defaultInput<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInputFocusOut<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> == <span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = defaultInput<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h3>Méthode 2 : composition</h3>
<ul>
<li>On fait une propriété skin      dans la classe logique</li>
<li>On accède aux occurrences      de la scène via la propriété skin</li>
<li>Permet de faire hériter la      classe logique d’une classe abstraite</li>
</ul>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/SWC_composition_small.png"><img class="alignnone size-thumbnail wp-image-4553" title="SWC_composition_small" src="http://www.flashxpress.net/wp-content/uploads/2009/11/SWC_composition_small-310x150.png" alt="SWC_composition_small" width="310" height="150" /></a></p>
<h3>Exemple : 11_SWC_et_separation_design_code_composition [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/11_SWC_et_separation_design_code_composition.zip">Télécharger l'exemple</a>]</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4477code12'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p447712"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4477code12"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> classes
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #009900; font-style: italic;">// comme on fait de la composition pour l'aspect visuel</span>
	<span style="color: #009900; font-style: italic;">// notre classe peut hériter d'une (pseudo) classe Abstraite</span>
	<span style="color: #009900; font-style: italic;">// issue de notre framework et implémentant une logique de base</span>
	<span style="color: #009900; font-style: italic;">// pour les DisplayObject</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Personnage <span style="color: #0033ff; font-weight: bold;">extends</span> AbstractView
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> const defaultInput<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;votre message&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #009900; font-style: italic;">// composition : la skin est une propriété de notre classe logique</span>
		<span style="color: #009900; font-style: italic;">// qui va la contenir</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> skin<span style="color: #000066; font-weight: bold;">:</span>Personnage_asset<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Personnage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900; font-style: italic;">// on instancie la skin</span>
			skin = <span style="color: #0033ff; font-weight: bold;">new</span> Personnage_asset<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// et on l'ajoute à la displayList de notre classe logique</span>
			<span style="color: #009900; font-style: italic;">// (qui doit hériter de DisplayObjectContainer, ici via la classe abstraite AbstractView)</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>skin<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			skin<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>TransitionEvent<span style="color: #000066; font-weight: bold;">.</span>TRANSITION_IN_COMPLETE<span style="color: #000066; font-weight: bold;">,</span> transitionInComplete<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> transitionInComplete<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a>=<span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>transitionInComplete<span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			skin<span style="color: #000066; font-weight: bold;">.</span>message_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;HiDiHo!&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			skin<span style="color: #000066; font-weight: bold;">.</span>ok_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> clickOK<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">FOCUS_IN</span><span style="color: #000066; font-weight: bold;">,</span> onInputFocusIn<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">FOCUS_OUT</span><span style="color: #000066; font-weight: bold;">,</span> onInputFocusOut<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> clickOK<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			skin<span style="color: #000066; font-weight: bold;">.</span>message_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInputFocusIn<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> == defaultInput<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInputFocusOut<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=focusevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:focusevent.html"><span style="color: #004993;">FocusEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> == <span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				skin<span style="color: #000066; font-weight: bold;">.</span>input_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = defaultInput<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Séparation du design et du code dans Flash &#8211; part 2</title>
		<link>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-2/</link>
		<comments>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-2/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 14:51:43 +0000</pubDate>
		<dc:creator>Nicolas Gans</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>
		<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Best practices]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=4466</guid>
		<description><![CDATA[Ces trois tutoriels font suite à un séminaire donné chez Adobe France le 23 novembre 2009, par Nicolas Gans, responsable pédagogique plate-forme Flash au centre de formation Regart.net. Ils reprennent les slides et les exemples montrés lors de cette journée. Le séminaire est divisé en trois parties : - Séparation du design et du code [...]]]></description>
			<content:encoded><![CDATA[<p>Ces trois tutoriels font suite à un séminaire donné chez Adobe France le 23 novembre 2009, par <a href="http://www.twitter.com/nicolasgans" target="_blank">Nicolas Gans</a>, responsable pédagogique plate-forme Flash au centre de formation <a href="http://www.regart.net" target="_blank">Regart.net</a>.</p>
<p>Ils reprennent les slides et les exemples montrés lors de cette journée.</p>
<p>Le séminaire est divisé en trois parties :</p>
<p><a href="http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-1">- Séparation du design et du code dans Flash &#8211; part 1 : séparation .fla et .as</a><br />
<a href="../ressources-flash/separation-du-design-et-du-code-dans-flash-part-2">- Séparation du design et du code dans Flash &#8211; part 2 : compiler des .fla différents</a><br />
<a href="../ressources-flash/separation-du-design-et-du-code-dans-flash-part-3">- Séparation du design et du code dans Flash &#8211; part 3 : coder et compiler avec Flex Builder</a></p>
<h3>Problématiques abordées :</h3>
<p><em>Comment développer un projet en Flash et fluidifier les échanges au sein d’une équipe composée de designer Flash et de développeurs AS3 .<br />
</em></p>
<p><em>Quelles sont les bonnes pratiques (séparation et communication entre éléments du design et code), les techniques (librairies partagées, SWC),  outils (FlashDevelop, Flex Builder) ?</em></p>
<h1>Compiler des .fla différents</h1>
<p>Comment permettre aux différents intervenants de travailler en parallèle sans avoir à compiler le même fichier ?</p>
<h2>Utilisation de SWF en tant que bibliothèque externe : chargement à l’exécution</h2>
<ul>
<li>Chargement avec un Loader</li>
<li>Extraction des assets avec      la classe ApplicationDomain et la méthode getDefinition()</li>
<li>On peut mettre en bibliothèque      tout type d’assets</li>
<li>Il faut connaître le nom      des assets, sinon on peut utiliser des classes qui introspectent la      totalité des classes disponibles dans le SWF<br />
<a href="http://www.bytearray.org/?p=175">http://www.bytearray.org/?p=175</a> (uniquement pour les symboles DisplayObject)<br />
ou<br />
<a href="http://etcs.ru/pre/getDefinitionNamesSource/">http://etcs.ru/pre/getDefinitionNamesSource/</a> (extraction de tous les types d’assets)</li>
<li>Problèmes :<br />
Obligé de typer avec le superType, pas de vérification de type précise, ni      de complétion spécifique dans un éditeur de code.</li>
<li>Solutions :<br />
utilisation d’interfaces</li>
</ul>
<h3>Exemple : 04_chargement_bibliotheque [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/04_chargement_bibliotheque.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="550" height="400">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/04_chargement_bibliotheque.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.flashxpress.net/wp-content/uploads/2009/11/04_chargement_bibliotheque.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4466code18'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p446618"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4466code18"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=loader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loader.html"><span style="color: #004993;">Loader</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=loaderinfo%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loaderinfo.html"><span style="color: #004993;">LoaderInfo</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.system</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=applicationdomain%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:applicationdomain.html"><span style="color: #004993;">ApplicationDomain</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">describeType</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getDefinitionByName</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> chargeur<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=loader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loader.html"><span style="color: #004993;">Loader</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #009900; font-style: italic;">// le nom des classes chargées</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> assetsClassName<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;Perso1&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;Perso2&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> localeLib<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			chargeur = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=loader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loader.html"><span style="color: #004993;">Loader</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			chargeur<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">contentLoaderInfo</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">COMPLETE</span><span style="color: #000066; font-weight: bold;">,</span> onComplete<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			chargeur<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;bibliotheque.swf&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			createPerso1_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> instanciate<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			createPerso2_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> instanciate<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onComplete<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900; font-style: italic;">// récupération d'une instance d'ApplicationDomain</span>
			<span style="color: #009900; font-style: italic;">// sur la propriété applicationDomain du contentLoaderInfo (e.target)</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> appDomain<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=applicationdomain%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:applicationdomain.html"><span style="color: #004993;">ApplicationDomain</span></a> = <a href="http://www.google.com/search?q=loaderinfo%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loaderinfo.html"><span style="color: #004993;">LoaderInfo</span></a><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">applicationDomain</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// on crée dynamiquement une bibliotheque locale</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> className<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #0033ff; font-weight: bold;">in</span> assetsClassName<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>appDomain<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">hasDefinition</span><span style="color: #000000;">&#40;</span>className<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					localeLib<span style="color: #000000;">&#91;</span>className<span style="color: #000000;">&#93;</span> = appDomain<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getDefinition</span><span style="color: #000000;">&#40;</span>className<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// pour infos</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> prop<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #0033ff; font-weight: bold;">in</span> localeLib<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>prop<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;:&quot;</span><span style="color: #000066; font-weight: bold;">,</span> localeLib<span style="color: #000000;">&#91;</span>prop<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> instanciate<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// on crée dynamiquement la classe</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> MaClasse<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a> = <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">currentTarget</span> == createPerso1_btn<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">?</span> localeLib<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;Perso1&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">:</span> localeLib<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;Perso2&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// on pourrait en savoir plus sur la classe avec describeType</span>
			<span style="color: #009900; font-style: italic;">//trace(describeType(MaClasse));</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>getSuperType<span style="color: #000000;">&#40;</span>MaClasse<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// puis on l'instancie</span>
			<span style="color: #009900; font-style: italic;">// on doit typer avec le super-type de la classe</span>
			<span style="color: #009900; font-style: italic;">// on pourrait ici utiliser une interface pour avoir un typage plus fort</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> perso<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> MaClasse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			perso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleX</span> = perso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleY</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000066; font-weight: bold;">.</span>4 <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000066; font-weight: bold;">.</span>3<span style="color: #000066; font-weight: bold;">;</span>
			perso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span> <span style="color: #000066; font-weight: bold;">-</span> perso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			perso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span> <span style="color: #000066; font-weight: bold;">-</span> perso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>perso<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// petite méthode pour connaître dynamiquement le superType d'un asset</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getSuperType<span style="color: #000000;">&#40;</span>pClass<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> superType<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #004993;">describeType</span><span style="color: #000000;">&#40;</span>pClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>factory<span style="color: #000066; font-weight: bold;">.</span>extendsClass<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">type</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> superType<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">split</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;::&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h2>Le MetaTag [Embed] et les SWC</h2>
<h3>Utilisation du MetaTag embed : externalisation des assets</h3>
<ul>
<li>Depuis Flash CS4, le      compilateur permet l’utilisation du MetaTag [Embed]</li>
<li>Permet d&#8217;externaliser la      bibliothèque de Flash en incluant des éléments multimédia externes dans son      SWF : polices, MC, XML, sons…</li>
<li>En aucun cas du chargement      dynamique, les assets sont inclus dans le SWF : ajoute du poids au SWF !!</li>
<li>Ce n&#8217;est pas de l&#8217;AS3, ces      balises sont transformées en AS3 avant la compilation</li>
</ul>
<h3>Embed d’images, sons, swf et typo</h3>
<ul>
<li>Ecriture :</li>
</ul>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4466code19'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p446619"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p4466code19"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Embed <span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=’image<span style="color: #000066; font-weight: bold;">.</span>jpg’<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> ClasseImage<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a></pre></td></tr></table></div>

<ul>
<li>Les instances sont de type      BitmapAsset, SoundAsset, SpriteAsset, MovieClipAsset&#8230;</li>
<li>Types issus du framework      Flex : nécessaire d’inclure les classes de ce framework en utilisant      des .SWC du Flex SDK (<a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3" target="_blank">gratuit et téléchargeable ici</a>)</li>
<li>Il faut intégrer le flex.swc via les paramètres d&#8217;ActionScript 3 dans l&#8217;onglet Flash des paramètres de publication</li>
</ul>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/05_integration_SWC_Flash_CS4.png"><img class="alignnone size-thumbnail wp-image-4506" title="05_integration_SWC_Flash_CS4" src="http://www.flashxpress.net/wp-content/uploads/2009/11/05_integration_SWC_Flash_CS4-310x150.png" alt="05_integration_SWC_Flash_CS4" width="310" height="150" /></a></p>
<h3>Exemple : 05_MetaTag_Embed [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/05_MetaTag_Embed.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="640" height="510">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/05_MetaTag_Embed.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="640" height="510" src="http://www.flashxpress.net/wp-content/uploads/2009/11/05_MetaTag_Embed.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4466code20'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p446620"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4466code20"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.media</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sound%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sound.html"><span style="color: #004993;">Sound</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #009900; font-style: italic;">// classes issues du framework Flex : indispensables pour utiliser l'embed dans Flash CS4</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.*;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// attention : le chemin source se fait depuis le répertoir où se trouve</span>
		<span style="color: #009900; font-style: italic;">// le fichier .as, pas depuis la racine du projet !!</span>
		<span style="color: #000000;">&#91;</span>Embed <span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;assets/LogoRegart.jpg&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> LogoRegart<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Embed <span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;assets/son.mp3&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> SonExterne<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Embed <span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;assets/bibliotheque.swf&quot;</span><span style="color: #000066; font-weight: bold;">,</span> symbol=<span style="color: #990000;">&quot;Personnage&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> Personnage<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/SerifaStd-Light.otf'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #004993;">fontName</span>=<span style="color: #990000;">'maPolice'</span><span style="color: #000066; font-weight: bold;">,</span>
		mimeType = <span style="color: #990000;">'application/x-font'</span><span style="color: #000066; font-weight: bold;">,</span>
		unicodeRange = <span style="color: #990000;">'U+0030-U+0039, U+0041-U+0051, U+0052-U+007A'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #009900; font-style: italic;">// chiffres de 0 à 9, les minuscules de a à z et les majuscules de A à Z</span>
		<span style="color: #009900; font-style: italic;">// Attention : ne pas utiliser ce nom de classe pour choisir sa typo via un TextFormat</span>
		<span style="color: #009900; font-style: italic;">// ou une CSS externe, mais la propriété fontName, dans notre cas 'maPolice'</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">font</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> monSon<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sound%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sound.html"><span style="color: #004993;">Sound</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> conteneurLogo<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> monLogo<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> monPerso<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// LOGO ======================================================</span>
			conteneurLogo = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			conteneurLogo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = conteneurLogo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			monLogo = <span style="color: #0033ff; font-weight: bold;">new</span> LogoRegart<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			conteneurLogo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>monLogo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>conteneurLogo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			conteneurLogo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">buttonMode</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// SON ======================================================</span>
			monSon = <span style="color: #0033ff; font-weight: bold;">new</span> SonExterne<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			conteneurLogo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> onLogoClick<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// MOVIECLIP ======================================================</span>
			monPerso = <span style="color: #0033ff; font-weight: bold;">new</span> Personnage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">//trace(flash.utils.describeType(monPerso));</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">220</span><span style="color: #000066; font-weight: bold;">;</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">140</span><span style="color: #000066; font-weight: bold;">;</span>
			monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleX</span> = monPerso<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleY</span> = <span style="color: #000066; font-weight: bold;">.</span>8<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>monPerso<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// FONT =========================================================</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> champTexte<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">400</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// ne pas oublier de passer embedFonts à true !</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">120</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">wordWrap</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">autoSize</span> = <a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">rotation</span> = <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// on passe en premier argument du constructeur le fontName défini dans l'embed : &quot;maPolice&quot;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;maPolice&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">22</span><span style="color: #000066; font-weight: bold;">,</span> 0xCC0000<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			champTexte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>champTexte<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onLogoClick<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			monSon<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h3>Qu’est-ce qu’un SWC ?</h3>
<ul>
<li>Librairie de classes      compilées (// SWF)</li>
<li>Distribution de classes      sans livrer les sources.</li>
<li>Utilisation d’assets sous      forme de classe.</li>
</ul>
<h3>Utilisation d’Embed pour intégrer des typo</h3>
<ul>
<li>Permet de créer l&#8217;équivalent d&#8217;un symbole police de bibliothèque MAIS on va pouvoir choisir les glyphes embarqués !</li>
<li>Utilisation d’un SWF dans lequel      on crée des champs texte avec intégration des caractères.</li>
<li>Attention : dans les      champs textes posés sur la scène, ne surtout pas choisir la même typo que      celle que l’on va appliquer en tant qu’embedFont (prendre de préférence      une police de périphérique) &gt; sinon l’intégration ne fonctionne      pas !!</li>
</ul>
<h3>Exemple : 06_embed_et_typo_dans_SWF [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/06_embed_et_typo_dans_SWF.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="550" height="400">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/Embed_et_typo_dans_SWF.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.flashxpress.net/wp-content/uploads/2009/11/Embed_et_typo_dans_SWF.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4466code21'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p446621"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4466code21"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html"><span style="color: #004993;">Font</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span style="color: #004993;">TextFieldAutoSize</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'Calibri_font.swf'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #004993;">fontName</span> = <span style="color: #990000;">'Calibri'</span>
		<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> CalibriRegular<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'Calibri_font.swf'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #004993;">fontName</span> = <span style="color: #990000;">'Calibri'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #004993;">fontStyle</span> = <span style="color: #990000;">'italic'</span>
		<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> CalibriItalic<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'Calibri_font.swf'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #004993;">fontName</span> = <span style="color: #990000;">'Calibri'</span><span style="color: #000066; font-weight: bold;">,</span>
		fontWeight = <span style="color: #990000;">'bold'</span>
		<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> CalibriBold<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			regular_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			regular_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Je peux parler en Calibri regular...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">//regular_txt.rotation = 2;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Calibri&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">22</span><span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			regular_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			italic_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			italic_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Mais aussi en Calibri italic...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			tf = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Calibri&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">22</span><span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">italic</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">//italic_txt.rotation = 2;</span>
			italic_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			bold_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			bold_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Ou encore en Calibri bold...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			tf = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Calibri&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">22</span><span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bold</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">//bold_txt.rotation = 2;</span>
			bold_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			french_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			french_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Et je n'embarque que les 140 caractères français.&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			tf = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Calibri&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">13</span><span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">leading</span> = <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">;</span>
			french_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h3>Utilisation de SWC Flex (ou autres) non-graphique : se connecter à un webservice avec le rpc.swc du framework Flex</h3>
<ul>
<li>Classe WebService existait en AS2.</li>
<li>Classe Webservice n’existe      pas en AS3 dans l’API de Flash, mais existe dans le framework Flex.</li>
<li>Utilisation du rpc.swc du      framework Flex pour travailler avec la classe WebService de Flex.</li>
</ul>
<h3>Exemple : 07_webservice_avec_le_rpc_swc [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/07_webservice_avec_le_rpc_swc.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="500" height="800">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/WebService.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="500" height="800" src="http://www.flashxpress.net/wp-content/uploads/2009/11/WebService.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4466code22'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p446622"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4466code22"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>  
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #009900; font-style: italic;">// classes du framework Flex intégrées </span>
	<span style="color: #009900; font-style: italic;">// via le rpc.swc et le framework.swc</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>soap<span style="color: #000066; font-weight: bold;">.*;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.*;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.*;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> monService<span style="color: #000066; font-weight: bold;">:</span>WebService<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> 
		<span style="color: #000000;">&#123;</span>
			monService = <span style="color: #0033ff; font-weight: bold;">new</span> WebService<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// mx.rpc.soap.LoadEvent (hérite de WSDLLoadEvent)</span>
			monService<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadEvent<span style="color: #000066; font-weight: bold;">.</span>LOAD<span style="color: #000066; font-weight: bold;">,</span> onWSDLLoad<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			monService<span style="color: #000066; font-weight: bold;">.</span>loadWSDL<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;http://www.boyzoid.com/comp/randomQuote.cfc?wsdl&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			bouton<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> getQuoteClick<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #339966; font-weight: bold;">function</span> onWSDLLoad<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span>LoadEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// on écoute le résultat </span>
			monService<span style="color: #000066; font-weight: bold;">.</span>getQuote<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ResultEvent<span style="color: #000066; font-weight: bold;">.</span>RESULT<span style="color: #000066; font-weight: bold;">,</span> getQuoteResult<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// on écoute les éventuels échecs de l'appel </span>
			monService<span style="color: #000066; font-weight: bold;">.</span>getQuote<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>FaultEvent<span style="color: #000066; font-weight: bold;">.</span>FAULT<span style="color: #000066; font-weight: bold;">,</span> getQuoteFault<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// appel de la méthode distante getQuote() sur le webservice</span>
			monService<span style="color: #000066; font-weight: bold;">.</span>getQuote<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			texte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">htmlText</span> = <span style="color: #990000;">&quot;Retrieving quote...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #339966; font-weight: bold;">function</span> getQuoteClick<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			monService<span style="color: #000066; font-weight: bold;">.</span>getQuote<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			texte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">htmlText</span> = <span style="color: #990000;">&quot;Retrieving quote...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #339966; font-weight: bold;">function</span> getQuoteResult<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span>ResultEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span>result<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			texte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">htmlText</span> = e<span style="color: #000066; font-weight: bold;">.</span>result <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #339966; font-weight: bold;">function</span> getQuoteFault<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span>FaultEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			texte<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">htmlText</span> = <span style="color: #990000;">&quot;Oups, le webservice n'a pas l'air de fonctionner...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Séparation du design et du code dans Flash &#8211; part 1</title>
		<link>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-1/</link>
		<comments>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-1/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 12:13:48 +0000</pubDate>
		<dc:creator>Nicolas Gans</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>
		<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Best practices]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=4426</guid>
		<description><![CDATA[Ces trois tutoriels font suite à un séminaire donné chez Adobe France le 23 novembre 2009, par Nicolas Gans, responsable pédagogique plate-forme Flash au centre de formation Regart.net. Ils reprennent les slides et les exemples montrés lors de cette journée. Le séminaire est divisé en trois parties : - Séparation du design et du code [...]]]></description>
			<content:encoded><![CDATA[<p>Ces trois tutoriels font suite à un séminaire donné chez Adobe France le 23 novembre 2009, par <a href="http://www.twitter.com/nicolasgans" target="_blank">Nicolas Gans</a>, responsable pédagogique plate-forme Flash au centre de formation <a href="http://www.regart.net" target="_blank">Regart.net</a>.</p>
<p>Ils reprennent les slides et les exemples montrés lors de cette journée.</p>
<p>Le séminaire est divisé en trois parties :</p>
<p><a href="http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-1">- Séparation du design et du code dans Flash &#8211; part 1 : séparation .fla et .as</a><br />
<a href="../ressources-flash/separation-du-design-et-du-code-dans-flash-part-2">- Séparation du design et du code dans Flash &#8211; part 2 : compiler des .fla différents</a><br />
<a href="../ressources-flash/separation-du-design-et-du-code-dans-flash-part-3">- Séparation du design et du code dans Flash &#8211; part 3 : coder et compiler avec Flex Builder</a></p>
<h3>Problématiques abordées :</h3>
<p><em>Comment développer un projet en Flash et fluidifier les échanges au sein d’une équipe composée de designer Flash et de développeurs AS3 .<br />
</em></p>
<p><em>Quelles sont les bonnes pratiques (séparation et communication entre éléments du design et code), les techniques (librairies partagées, SWC),  outils (FlashDevelop, Flex Builder) ?</em></p>
<h1>Première partie : séparation .fla et .as</h1>
<p>Permettre à chacun de travailler avec ses propres outils.</p>
<h2>Historique</h2>
<h4>ActionScript 1</h4>
<ul>
<li>Code sur la timeline ou      sur les objets (MC et BTN)</li>
<li>Code disséminé un peu      partout dans l’appli : difficile à maintenir et à comprendre.</li>
<li>Le codeur et le designer      étaient souvent une seule et même personne.</li>
<li>Avec le temps : spécialisation      des tâches, codeur et designer sont devenues deux personnes différentes.</li>
<li>Mise au point de bonnes      pratiques : centralisation du code sur le scénario principal,      utilisation de la directive #include pour placer le code dans des fichiers      .as externes.</li>
</ul>
<h4>ActionScript 2</h4>
<ul>
<li>Apparition de la      POO : une meilleure structuration du code en classes est alors permise</li>
<li>L’éditeur de code de Flash      montre ses limites pour les codeurs</li>
<li>Utilisation de SEPY,      Flashdevelop par les codeurs</li>
</ul>
<h4>ActionScript 3</h4>
<ul>
<li>Langage clairement POO</li>
<li>Prérequis en programmation      sont importants</li>
<li>Outils des codeurs :      Flashdevelop, Flex Builder, FDT (plugin Eclipse)</li>
</ul>
<h2>Classe du document</h2>
<ul>
<li>Représente le root (la      scène principale) de l’application.</li>
<li>Point d’entrée de      l’application, permet d’externaliser tout le code.</li>
<li>Hérite d’un displayObjectContainer      (MovieClip, Sprite)</li>
</ul>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/stage_root_classe_document.jpg"><img class="alignnone size-thumbnail wp-image-4435" title="stage_root_classe_document" src="http://www.flashxpress.net/wp-content/uploads/2009/11/stage_root_classe_document-310x150.jpg" alt="stage_root_classe_document" width="310" height="150" /></a></p>
<h2>Associer un symbole et une classe</h2>
<ul>
<li>Bonne séparation logique      et vue.</li>
<li>Transparent pour le      designer qui peut créer des occurrences sur la scène avec une logique      implémentée.</li>
<li>Instanciation se fait par      new MaClasse()</li>
<li>Liaison avec Clip,      Boutons, Bitmap, Police, Sons</li>
</ul>
<h2>Communication TimeLine &lt;&gt; fichier .as</h2>
<ul>
<li>Occurrences posées sur la      scène deviennent des propriétés publiques de la classe.</li>
<li>Paramètres AS3 : « déclarer      automatiquement les occurrences de la scène »</li>
<li>Appel  de méthodes de la classe depuis le      scénario.</li>
<li>Ciblage d’occurrences      depuis la classe.</li>
</ul>
<h2>Déclencher des instructions en fonction de la position de la tête de lecture</h2>
<p>3 méthodes :</p>
<ul>
<li>Appel de méthodes de la      classe depuis le scénario</li>
<li>Diffusion d’événement      depuis le scénario</li>
<li>Utilisation      d’addFrameScript (combinée avec étiquettes via la propriété currentLabels)</li>
</ul>
<h3>Exemple :  01_balle_rebond [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/01_balle_rebond.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="640" height="480">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/01_balle_rebond.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="640" height="480" src="http://www.flashxpress.net/wp-content/uploads/2009/11/01_balle_rebond.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code30'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442630"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4426code30"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> 
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=framelabel%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:framelabel.html"><span style="color: #004993;">FrameLabel</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Animation <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Animation<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Animation instanciée&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// méthode 2</span>
			<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">COMPLETE</span><span style="color: #000066; font-weight: bold;">,</span> ecouteurAnimationTerminee<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// méthode 3</span>
			<span style="color: #009900; font-style: italic;">// utilisation de la fonction non-documentée addFrameScript</span>
			<span style="color: #009900; font-style: italic;">// ATTENTION : les numéros d'image commencent à 0</span>
			<span style="color: #009900; font-style: italic;">// donc 89 = 90ème image</span>
			<span style="color: #009900; font-style: italic;">// ATTENTION 2 : tout le code présent sur la frame est écrasé !</span>
			addFrameScript<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">89</span><span style="color: #000066; font-weight: bold;">,</span> frameAnimationTerminee<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// méthode 3bis</span>
			<span style="color: #009900; font-style: italic;">// on peut combiner tout cela avec des étiquettes</span>
			<span style="color: #009900; font-style: italic;">// currentLabels renvoie un tableau d'objets FrameLabel</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> etiquettes<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #004993;">currentLabels</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> label<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=framelabel%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:framelabel.html"><span style="color: #004993;">FrameLabel</span></a> <span style="color: #0033ff; font-weight: bold;">in</span> etiquettes<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">frame</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot; : &quot;</span><span style="color: #000066; font-weight: bold;">,</span> label<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// ATTENTION : le numéro de frame d'un FrameLabel commence à 1 et non à 0 !!</span>
			addFrameScript<span style="color: #000000;">&#40;</span>etiquettes<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">frame</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> frameAnimationMilieu<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// METHODE 1</span>
		<span style="color: #009900; font-style: italic;">// méthode appellée depuis le scénario de l'animation</span>
		<span style="color: #009900; font-style: italic;">// plus performant et moins gourmand en mémoire</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> animationTerminee<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Animation terminée&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// METHODE 2</span>
		<span style="color: #009900; font-style: italic;">// diffusion d'un événement depuis le scénario</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> ecouteurAnimationTerminee<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Evénement COMPLETE diffusé depuis le scénario&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// METHODE 3</span>
		<span style="color: #009900; font-style: italic;">// addFrameScript : une fonction se déclenche automatiquement quand la tête de lecture</span>
		<span style="color: #009900; font-style: italic;">// parvient à telle image</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> frameAnimationTerminee<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Animation terminéee avec addFrameScript&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// METHODE 3bis</span>
		<span style="color: #009900; font-style: italic;">// addFrameScript avec étiquette</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> frameAnimationMilieu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Animation milieu&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h2>Piloter la timeLine depuis la classe</h2>
<p>Il est courant d’utiliser le scénario pour créer des écrans ou des états d’un clip et de déplacer la tête de lecture en fonction des actions de l’utilisateur pour afficher tel ou tel écran/état.</p>
<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/11/timeline_etiquette.png"><img class="alignnone size-full wp-image-4441" title="timeline_etiquette" src="http://www.flashxpress.net/wp-content/uploads/2009/11/timeline_etiquette.png" alt="timeline_etiquette" width="457" height="131" /></a></p>
<h3>Problème  de l&#8217;asynchronie code/tête de lecture</h3>
<p><span style="text-decoration: underline;">Player 9</span> : gros soucis de synchronisation code/tête de lecture. Le code s’exécute avant le déplacement effectif de la tête de lecture, d’où impossibilité de cibler des occurrences placées sur la scène :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code31'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442631"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p4426code31"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #009900; font-style: italic;">// occurrence placée à l’image 10</span>
monClip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<a href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span style="color: #004993;">Error</span></a> #<span style="color: #000000; font-weight:bold;">1009</span><span style="color: #000066; font-weight: bold;">:</span> Il est impossible <span style="color: #004993;">d</span><span style="color: #990000;">'accéder à la propriété ou à la méthode d'</span>une référence <span style="color: #004993;">d</span><span style="color: #990000;">'objet nul.</span></pre></td></tr></table></div>

<h3>Exemple : 02_piloter_timeLine_depuis_classe [<a href="../wp-content/uploads/2009/11/02_piloter_timeLine_depuis_classe.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="250" height="400">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/02_piloter_timeLine_depuis_classe.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="250" height="400" src="http://www.flashxpress.net/wp-content/uploads/2009/11/02_piloter_timeLine_depuis_classe.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code32'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442632"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4426code32"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> 
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.system</span><span style="color: #000066; font-weight: bold;">.*;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a> 
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			etape1_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> etape1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			etape2_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> etape2<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			etape3_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> etape3<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> etape1<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900; font-style: italic;">// Fonctionne avec le Flash Player 10</span>
			<span style="color: #009900; font-style: italic;">// mais pas avec le Flash Player 9</span>
			<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;etape1&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			etape_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Etape 1&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			perso_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> etape2<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;etape2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			etape_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Etape 2&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			tete_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> etape3<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;etape3&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			etape_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Etape 3&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			couronne_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h5>Solution 1 :</h5>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code33'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442633"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p4426code33"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// écouter l’événement RENDER</span>
<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">RENDER</span><span style="color: #000066; font-weight: bold;">,</span> onRender<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #009900; font-style: italic;">// déplacer la tête de lecture</span>
<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #009900; font-style: italic;">// invalidation du Stage</span>
<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">invalidate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// ciblage du clip dans l’écouteur</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onRender<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
monClip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Rend très complexes les allers-retours sur la timeline.</p>
<h5>Solution 2 :</h5>
<p>Utiliser un addFrameScript.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code34'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442634"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p4426code34"><pre class="actionscript3" style="font-family:monospace;">addFrameScript<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">9</span><span style="color: #000066; font-weight: bold;">,</span> imageDix<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> imageDix<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
monClip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Beaucoup plus souple, surtout si on a plein d’étapes avec beaucoup d’allers-retours.</p>
<p><strong><span style="text-decoration: underline;">ATTENTION</span> : pas nécessaire avec le player 10 lorsqu’on travaille dans une Classe, mais le problème persiste si on code sur la TimeLine.</strong></p>
<p><span style="text-decoration: underline;">Player 10</span> : si on code sur la TimeLine, il faut appeler la méthode de déplacement de tête de lecture sur un enfant du scénario dans lequel on code pour que ça fonctionne.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code35'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442635"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p4426code35"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// ne fonctionne pas</span>
<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
monClip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// fonctionne</span>
monConteneur<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
monConteneur<span style="color: #000066; font-weight: bold;">.</span>monClip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<h2>Gestion des états d’un MovieClip : horizontalité vs verticalité</h2>
<ul>
<li>Une alternative au travail      avec la timeline (horizontalité) est de travailler avec la displayList      (verticalité).</li>
<li>Chaque état est un      DisplayObject, on gère alors les changements d’état en les      ajoutant/retirant de la liste d’affichage.</li>
<li>Intérêt : on peut se      passer du gotoAndStop() asynchrone et eviter les bugs liés au player en      mode horizontal. On travaille de manière plus « naturelle » pour      le player.</li>
</ul>
<h3>Exemple : 03_gestion_etats_MC_avec_displayList_Mario [<a href="http://www.flashxpress.net/wp-content/uploads/2009/11/03_gestion_etats_MC_avec_displayList_Mario.zip">Télécharger l'exemple</a>]</h3>
<p>
<object width="633" height="449">
<param name="movie" value="http://www.flashxpress.net/wp-content/uploads/2009/11/04_gestion_etats_MC_horizontal_vs_vertical.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="633" height="449" src="http://www.flashxpress.net/wp-content/uploads/2009/11/04_gestion_etats_MC_horizontal_vs_vertical.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p4426code36'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p442636"><td class="line_numbers"><pre>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
</pre></td><td class="code" id="p4426code36"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> 
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=displayobject%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:displayobject.html"><span style="color: #004993;">DisplayObject</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.ui</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * ...
	 * @author Nicolas Gans
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Mario <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a> 
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> touches<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> sens<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> vitesse<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">8</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> isJumping<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _displayed<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=displayobject%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:displayobject.html"><span style="color: #004993;">DisplayObject</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> static const JUMP_FINISHED<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;jumpFinished&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Mario<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			sens = <span style="color: #004993;">scaleX</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// on nettoie la displayList</span>
			<span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">numChildren</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #004993;">removeChildAt</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// clip affiché par défaut</span>
			displayed = repos_mc<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ADDED_TO_STAGE</span><span style="color: #000066; font-weight: bold;">,</span> activation<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> activation<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">KEY_DOWN</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">keyDown</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">KEY_UP</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">keyUp</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">loop</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// événement diffusé sur la dernière frame du clip saute_mc</span>
			saute_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>JUMP_FINISHED<span style="color: #000066; font-weight: bold;">,</span> onJumpFinished<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// gestion affichage / retrait des états</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> displayed<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=displayobject%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:displayobject.html"><span style="color: #004993;">DisplayObject</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900; font-style: italic;">// on supprime l'état en cours</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_displayed <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #004993;">contains</span><span style="color: #000000;">&#40;</span>_displayed<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span>_displayed<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #009900; font-style: italic;">// on le remplace par le nouvel état</span>
			_displayed = <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// gestion des actions en fonction des touches enfoncées</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">loop</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>touches<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">SPACE</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">!</span>isJumping<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				saute<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>touches<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				deplace<span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>touches<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">RIGHT</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				deplace<span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">RIGHT</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>touches<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">DOWN</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">!</span>isJumping<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				displayed = assis_mc<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">keyDown</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
		<span style="color: #000000;">&#123;</span>
			touches<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">keyCode</span><span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">keyUp</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
		<span style="color: #000000;">&#123;</span>
			touches<span style="color: #000000;">&#91;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">keyCode</span><span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>isJumping<span style="color: #000000;">&#41;</span> displayed = repos_mc<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> saute<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			isJumping = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			saute_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			displayed = saute_mc<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onJumpFinished<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
		<span style="color: #000000;">&#123;</span>
			isJumping = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
			displayed = repos_mc<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> deplace<span style="color: #000000;">&#40;</span>pSens<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_displayed == assis_mc<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>isJumping<span style="color: #000000;">&#41;</span> displayed = marche_mc<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>pSens == <a href="http://www.google.com/search?q=keyboard%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:keyboard.html"><span style="color: #004993;">Keyboard</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LEFT</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">scaleX</span> = <span style="color: #000066; font-weight: bold;">-</span>sens<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">-</span>= vitesse<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">else</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">scaleX</span> = sens<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span>= vitesse<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/separation-du-design-et-du-code-dans-flash-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Génération Flash par Lev Manovich</title>
		<link>http://www.flashxpress.net/ressources-flash/generation-flash-par-lev-manovich/</link>
		<comments>http://www.flashxpress.net/ressources-flash/generation-flash-par-lev-manovich/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 11:08:12 +0000</pubDate>
		<dc:creator>Lev Manovich</dc:creator>
				<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[net art]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=4344</guid>
		<description><![CDATA[Voici la traduction de l&#8217;article &#171;&#160;Génération Flash&#160;&#187; paru en 2002, que l&#8217;auteur Lev Manovich nous a autorisé à traduire et diffuser sur Flashxpress. Suite à des demandes, nous republions aujourd&#8217;hui cet article. Bonne lecture ! Cet article, constitué de plusieurs paragraphes distincts mis bout à bout, porte un regard sur le phénomène graphique Flash sur [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flashxpress.net/wp-content/uploads/2009/10/illus_generation_flash.jpg"><img class="alignnone size-full wp-image-4350" title="illus_generation_flash" src="http://www.flashxpress.net/wp-content/uploads/2009/10/illus_generation_flash.jpg" alt="illus_generation_flash" width="630" height="200" /></a></p>
<p><em>Voici la traduction de l&#8217;article &laquo;&nbsp;Génération Flash&nbsp;&raquo; paru en 2002, que l&#8217;auteur Lev Manovich nous a autorisé à traduire et diffuser sur Flashxpress.<br />
Suite à des demandes, nous republions aujourd&#8217;hui cet article. Bonne lecture !</em></p>
<p>Cet article, constitué de plusieurs paragraphes distincts mis bout à bout, porte un regard sur le phénomène graphique Flash sur le web, qui a attiré un grand élan de créativité ces dernières années. Plus que le simple résultat d’une situation particulière entre software et hardware (des bandes passantes à faibles débits conduisant à l&#8217;usage de graphismes vectoriels), l’esthétique Flash illustre la sensibilité culturelle d’une nouvelle génération(1). Cette génération ne se soucie pas de savoir si son travail est considéré comme de l’art ou du design. Cette génération ne s’intéresse pas à la « critique du média » dont se préoccupaient les artistes de ces deux dernières décennies, et prefère s&#8217;engager dans une critique du logiciel. Cette génération écrit son propre code logiciel, de manière à créer son propre système culturel, mettant ainsi de côté l’utilisation des échantillons de médias commerciaux(2). En résulte un nouveau modernisme de la visualisation des données, filets vectoriels, grilles larges d&#8217;un pixel, flêches: le design Bauhaus au service du design de l&#8217;information. Au lieu d’un assaut Baroque de médias commerciaux, la génération Flash nous offre une esthetique moderne, et la rationalité du logiciel. Le design d’information est utilisé comme outil donnant du sens à la réalité, tandis que la programmation devient un outil de prise de pouvoir(3).</p>
<p>(1) Cet article traite de la &laquo;&nbsp;génération Flash&nbsp;&raquo; et non des sites Internet faits avec le logiciel Flash. Bien des sites qui m&#8217;ont amené à parler d&#8217;esthétique Flash n&#8217;ont pas nécessairement été faits avec Flash. Ils utilisent shockwave, DHTML, QuickTime, et d&#8217;autres formats multimedia du web. Ainsi les qualités que je décrirai plus loin comme spécifique à l&#8217;esthétique Flash ne sont pas exclusifs aux sites Flash.<br />
(2)Par exemple, les travaux de Lisa Jevbratt, John Simon, et Golan Levin.<br />
(3)&nbsp;&raquo;Generation Flash&nbsp;&raquo; incorpore des versions révisées  des textes commandés pour <a href="http://www.whitneybiennial.com/" target="_blank">http://www.whitneybiennial.com</a> et <a href="http://www.electronicorphanage.com/biennale" target="_blank">http://www.electronicorphanage.com/biennale</a>. Ces deux expositions ont été organisées par Miltos Manetas / Electronic Orphanage. “On UTOPIA” a été commandé par Futurefarmers.</p>
<h2>Turntable et Flash Remixing</h2>
<p><a href="http://www.whitneybiennial.com/" target="_blank">[www.whitneybiennial.com]</a></p>
<p>Turntable est un logiciel pour le web qui permet de mixer en temps réel jusqu’à 6 animations flash différentes en plus de permettre la manipulation de palettes de couleurs, de la taille individuelle des animations et d’autres paramètres. Pour le site <a href="http://www.whitneybiennial.com/" target="_blank">www.whiteneybiennial.com</a>, on a demandé aux artistes participants de soumettre de courtes animations, exposées par la suite sur le site à la fois séparément et dans des remixes effectués via Turntable. Certains remix étaient des animations d’un même artiste alors que d’autres utilisaient des animations d’artistes différents.</p>
<p>C&#8217;est desormais un lieu commun que de dire que nous vivons dans une culture du remix. C&#8217;est vrai. Mais est-il possible d’aller au delà de cette affirmation, au delà de ce fait ? Par exemple, peut-on faire des distinctions entre différentes sortes d&#8217;esthétiques du remix ? Quelle relation peut on établir entre nos remix faits avec des outils électroniques ou informatiques et les collages et montages plus anciens? Quelles sont les similitudes et les différentes entre un remix audio et un remix visuel ?</p>
<p>Pensons à la boucle. Bloc de base dans la construction d’un morceau électronique, elle a aussi acquis, de manière surpenante, une position forte dans la culture visuelle contemporaine. Abandonnés à leur propre dispositif, les animations Flash, les films Quick time, les personnages de jeux vidéos bouclent à l’infini, jusqu’à l’intervention humaine par clic.</p>
<p>Comme je l’ai par ailleurs montré, tous les dispositifs visuels pré-cinématographiques du 19ème siècle étaient également basés sur des boucles. Tout au long du 19ème siècle, ces boucles devenaient de plus en plus longues, jusqu&#8217;à devenir narratives. aujourd&#8217;hui, fort est de constater le phénomène inverse (des artistes samplent de courts segments de films ou d’émissions télé, les organisant en boucles, et exposent ces dernières en tant qu’ « installations vidéos ». La boucle est ainsi devenu la nouvelle méthode par défaut pour critiquer la culture média, remplaçant la photographie statique de la critique post moderne des années 80.</p>
<p>En même temps, cette méthode remplace la photographie comme nouvel index du réel : depuis que tout le monde sait que la photo peut être modifiée numériquement, une courte séquence animée arrangée en loop devient une meilleure façon de représenter la réalité, du moins pour l’instant.</p>
<p>Pensons à Internet. Ce que l’époque post moderne désignait comme citation, appropriation ou pastiche n’a plus besoin d’un nom spécifique. C’est désormais la simple logique de la production culturelle : télécharger des images, des codes, des formes, des scripts,… ; les modifier, puis mettre le nouveau travail en ligne, les faire circuler. (note : avec Internet, la boucle omniprésente de la production culturelle va beaucoup plus vite : une nouvelle tendance ou un nouveau style pourrait se répandre comme la peste). Quand je demande à mes étudiants de créer leurs propres visuels à en prenant une photo ou en filmant une vidéo, ils ont une révélation : les images ne proviennent pas forcément d’Internet ! Dois-je également leur révéler que les images ne proviennent pas forcément de dispositifs technologiques qui enregistrent le réel, et que, à la place, elles peuvent être dessinées ou peintes ?</p>
<p>Pensons à l’image. Comparons-la au son. Il paraît possible de lier d’innombrables sons et pistes entre eux, tout en restant lisible. Le résultat se complexifie, devient de plus en plus intéressant. La vision semble fonctionner de façon différente. Bien sûr les images commerciales que nous voyons tous les jours à la télé et au cinéma sont souvent faites à partir de différentes couches (parfois plusieurs milliers), mais ces calques fonctionnent ensemble et créent un espace illusoire (ou super-illusoire). En d’autres termes, ils ne sont pas entendus en tant que sons autonomes. Quand on commence à mixer des images arbitraires entre elles, on détruit vite toute signification. (si vous avez des doutes, essayez donc Digital Landfill (4)).Combien de bouts d’images individuelles peuvent être mixées ensemble avant que le tout ne produisent plus que du &laquo;&nbsp;bruit&nbsp;&raquo; ? Six semble être un bon chiffre (c’est précisément le nombre de bouts d’images que Turntable peut charger.</p>
<p>Pensez &laquo;&nbsp;sample&nbsp;&raquo; en opposition avec la totalité d’un travail. Si nous vivons vraiment dans la culture du remix, est-il réellement intéressant de créer des travaux entiers, puisque ils seront démontés et transformés en samples de toute façon ? En réalité, pourquoi ajuster soigneusement des morceaux séparés de films faits sous Director, ou des compositions d’After Effects pour voir le public les intégrer pour leur usage grâce à un quelconque logiciel gratuit? Bien sûr, la réponse est oui : nous avons encore besoin d’Art.</p>
<p>Nous avons toujours la volonté de parler du monde et des vies que nous y menons ; nous avons toujours besoin de notre propre « miroir debout au milieu d’une route sale », selon a définition de Stendhal au sujet de l’art au 19ème siècle. Cependant nous avons aussi besoin d’accepter le fait que pour les autres, notre travail ne sera qu’un ensemble d’échantillons, ou peut être un seul échantillon. Turntable est le logiciel visuel qui rend cette nouvelle condition esthétique douloureusement évidente. Il nous invite à jouer avec la dialectique du sample et du composite, de notre propre travail et de celui des autres. Bienvenue dans le modèle Flash du remix visuel.<br />
Pensez Turntable.</p>
<p>(4 )voir <a href="http://www.potatoland.org/landfill" target="_blank">http://www.potatoland.org/landfill</a></p>
<h2>Art, média art et Software art.</h2>
<p>Récemment le “software art” a émergé en tant que nouveau secteur dynamique des nouveaux média arts. L&#8217;actionScript de Flash, le Lingo de Director, le PERL, MAX, le javascript, le java, le C++ et d’autres langages de programmation et de script sont des supports de choix d’un nombre en sérieuse augmentation de jeunes artistes. Thematiquement, le &laquo;&nbsp;software art&nbsp;&raquo; traite le plus souvent de la visualisation des données ; d’autres secteurs d’activité créatrice incluent les outils de performance ou la composition collaboratives en ligne (Keystroke), des logiciels de DJ/VJ, et des alternatives/critiques de logiciels commerciaux (Auto-Illustrator), surtout les browsers (des vieuxclassiques comme Netomat, Web Stalker, et beaucoup d’autres depuis). Souvent, les artistes ne créent pas de travaux singuliers, mais des environnements logiciels proposant leur utilisation par d&#8217;autres (comme par exemple Alex Galloway’s Carnivore).</p>
<p>De manière styllistique, beaucoup de travaux font implicitement référence au modernisme visuel (John Simon semble être le seul jusqu&#8217;ici à tisser de manière explicite des références modernistes).</p>
<p>Tout à coup, la programmation devient &laquo;&nbsp;cool&nbsp;&raquo;. Tout à coup, les techniques et l&#8217;imagerie qui ont été associés pendant deux décennies aux geeks du SIGGRAPH, et étaient considérés comme étant de mauvais goût (rendement visuel des fonctions mathématiques, systèmes de particules, palette de couleurs RVB) sont accueillies sur les écrans de plasma des murs de galerie. Ce ne sont plus October et Wallpaper mais les manuels de Flash et Director qui sont les lectures nécessaires pour n’importe quel artiste sérieux.</p>
<p>Bien sûr, des artistes de l’informatique ont écrits leurs propres logiciels depuis le début des années 60. En fait, jusqu&#8217;au milieu des années 80, créer son propre logiciel ou du moins utiliser des langages de programmation conçus par d’autres (comme Zgrass) à des niveaux très élevé était la seule façon de faire de l’art informatique(5). Alors qu’y-a-t-il de nouveau dans ce phénomène qui a émergé depuis peu par rapport aux &laquo;&nbsp;software art&nbsp;&raquo; ? Est-il bien nécessaire ?</p>
<p>Essayons de distinguer trois schémas : un artiste,  un artiste du media et un artiste du logiciel.</p>
<p>Un artiste romantique / moderne (19ème siècle et première moitié du 20ème) est un génie qui créée à partir de rien, imposant les fantômes de son imagination au reste du monde.</p>
<p>Ensuite, nous avons la nouvelle figure du média-artiste (années 60 à 80) qui correspond à la période post-moderne. Les artistes modernes utilisent bien évidemment eux aussi les technologies d’enregistrement des médias comme la photographie et les films mais ils utilisaient ces technologies comme d&#8217;autres outils artistiques, un moyen de créer une vision originale et subjective du monde.</p>
<p>A l’opposé, les média artistes post modernes acceptent l’impossibilité d’un original, une vision non médiatisée de la réalité. Leur sujet de préoccupation n’est pas la réalité elle-même, mais la représentation de la réalité via un média, et le monde des média lui même.<br />
Par conséquent ces médias artistes n’utilisent pas seulement les technologies des médias comme outils, mais ils utilisent aussi le contenu des médias commerciaux.</p>
<p>Une stratégie typique d’un média artiste consiste à re-photographier une photo de journal, ou de re-monter un morceau d’émission télé, ou d’isoler une scène d’un film d’Hollywood ou d’émissions télé et de le transformer en boucle (de Nam June Paik et dara Birnbaum à Douglas Gordon, Paul Pffefer, Jennifer and Kevin McCoy). Bien sûr, un média artiste n’est pas obligé d’utiliser les technologies des médias commerciaux (photo, vidéo, film, nouveau média), il peut se servir d’autres médias, de la peinture à l’huile à l’impression ou encore la sculpture.</p>
<p>Le média artiste est un parasite qui travaille aux dépens du média commercial -le résultat de l&#8217;artisanat collectif de personnes hautement qualifiée. De plus, un artiste qui sample à partir d’un média commercial ne peut jamais rivaliser avec lui ce média. Au lieu d’un film complet, on n&#8217;a qu&#8217;une simple scène ; à la place d’un jeu vidéo complexe, avec sa jouabilité, son récit, intelligence artificielle, etc, nous n&#8217;avons qu&#8217;une critique de son iconographie.</p>
<p>30 ans de &laquo;&nbsp;média art&nbsp;&raquo; et de post-modernisme ont inévitablement mené à une réaction. Nous sommes las de toujours prendre les médias existants comme point de départ. Nous sommes las d’être toujours secondaires, et de toujours réagir à partir de ce qui existe déjà.</p>
<p>Prenons maintenant le software artiste – le nouveau romantique. Au lieu de travailler exclusivement avec des médias commerciaux (et au lieu d’utiliser des logiciels commerciaux) le software artiste pose ses marques dans le monde en concevant le code original. Cet acte de conception de code est très important , indépendamment de ce que ce code produit réellement au bout du compte.<br />
Un software artiste ré-utilise le langage de l’abstraction , le design (les lignes et les formes géométriques modernistes, les courbes générées mathématiquement et les champs de couleurs définis) pour s’éloigner de la figuration en général, et du langage cinématographique du média commercial en particulier.</p>
<p>A la place de photos et de clips issus de films et de télévision, on obtient des lignes et des compositions abstraites. En bref, au lieu d’utiliser QuickTime, on se sert de Flash. Au lieu d’un ordinateur en tant que machine média (une vision nettement diffusée par l&#8217;industries informatiques, et clairement émise par Apple qui promeut un Mac en tant que concentrateur digital pour l&#8217;enregistrement et la lecture de médias), on retourne à un utilisation de l’ordinateur en tant que machine à programmer.</p>
<p>La programmation permet à l’art de ne plus être envisager comme faisant suite au media commercial. Une seconde cause à ceci pourrait être la récente popularité de l’art sonore (&laquo;&nbsp;sound art&nbsp;&raquo;). Tandis que les médias commerciaux emploient désormais tous les styles visuels possibles, les environnements sonores commerciaux ne se sont toujours pas appropriés l’ensemble de l’espace sonore. Alors que le rock, le hip-hop et la techno sont déjà devenus des musiques standards d’ascenseurs (au moins dans les ascenseurs branchés de l’hôtel Hudson à New York), il semble que les secteurs de l’espace sonore où le rythme est absent soient toujours intouchables, du moins pour le moment.</p>
<p>(5) Après que des applications basées sur des interfaces graphiques comme HyperCard, Director, Photoshop ou d&#8217;autres soient devenus communs beaucoup d&#8217;artistes informatiques ont continué à écrire leurs propres programmes : écrire son propre code pour controller une installation interactive, propgrammer en Lingo une oeuvre multimedia interactive, etc&#8230; On n&#8217;y a pas fait reference comme à du &laquo;&nbsp;software art&nbsp;&raquo;, on a considéré que malgré l&#8217;existence d&#8217;applications à interface graphique un engagement artistique serieux dans l&#8217;informatique rendait necessaire de mettre &laquo;&nbsp;les mains dans le cambouis&nbsp;&raquo;.</p>
<h2>Utopia en Shockwave</h2>
<p>[ Utopia est un projet Shockwave des Futurefarmers pour la section  internet 01 de Tirana Biennale ]</p>
<p>[ Futurefarmers : Amy Franceschini et Sasha Merg ]</p>
<p>UTOPIA est amusant et trompeur, en effet, il a l’air plus innocent, plus simple et plus léger qu’il ne l’est en fait. Au premier abord, on pourrait le prendre pour un logiciel fait pour les enfants, ou pour des adultes dont les références ne sont pas Karl Marx, Sigmund Freud Rem Koolhaas et Philip Stark, mais l’envoie d’e-mails, gnutella, les graphismes retro Atari et le surf sur Internet. C’est cette nouvelle génération que l’on a vu apparaître dans les années 90. Contrairement aux artistes qui communiquaient sur les médias dans les années 60 à 80, et dont les cibles principales étaient les médias publicitaires, le cinéma et la télévision, la nouvelle génération ne perd pas son énergie à critiquer les médias. Au lieu de s’en prendre à l’environnement des médias commerciaux, elle se créé le sien : Sites Internet, mixes, des logiciels, des accessoires, cloves, des vidéos digitales, des animations et des contenus interactifs en Flash et en Shockwave.</p>
<p>La nouvelle ‘sensibilité / façon de faire’ si bien illustrée par Utopia est douce, élégante, tout en retenue, et intelligente. C’est la nouvelle intelligentsia du logiciel. Regardez les lignes fines et peu-contrastées d’Utopia, praystation.com et tant de projet en Flash de Tirana Biennale 01. Si les images de la précédente génération de média-artistes, de Nam June Paik à Barbara Krueger, étaient criardes, et essayaient de compléter l’intensité du média commercial, les nouveaux artistes informatiques comme Franceschini / Merg chuchotent à nos oreilles. Au contraire de l’arrogance des médias, ils nous offrent la sagacité. Au contraire du courant médiatique infini et répété d’icônes et de sound bytes, ils nous offrent des systèmes plus réduits et économiques : une nature stylisée, de l’écologie, ou bien des jeux / des générateurs de musique / des parades en style Légo dans Utopia.</p>
<p>FutureFarmers fait parti du petit nombre de maîtres de Flash/Shockwave qui utilisent leurs capacités à des fins sociales plutôt qu&#8217;à de simple buts formels. Leur projet theyrule.net est un excellent exemple de la manière dont ne programmation intelligente et des graphismes intelligents peuvent être utilisés de manière politique. Plutôt que de présenter un message spolitique préformatté, il nous donne les informations et les outils pour l&#8217;analyser. Il sait que nous sommes suffisamment intelligents pour en arriver à la bonne conclusion. C&#8217;est la nouvelle rhetorique de l&#8217;interactivité : nous nous laissopns convaincre non pas en ecoutant ou en regardant un message préparé mais en travaillant l&#8217;information, en la réorganisant, en découvrant les connections, en réalisant les corrélations.</p>
<p>UTOPIA na pas de contenu politique explicite, il présente son message politique à travers une allégorie. Comme SimCity et les Sims similaires, le programme nous présente tout monde miniature qui fonctionne selon ses propres règles(Toutes les animations dans UTOPIA son rendues en temps réél, rien n&#8217;est fait à la main). La cosmogonie de ce monde reflette notre nouvelle compréhension de notre propre planète. L&#8217;après guerre froide, Internet, l&#8217;ecologie, Gaia, et la globalisation. Notez les fines lignes, à peine visibles, qui connectent les acteurs et les blocks.(c&#8217;est le même système que celui utilisé dans theyrule.net). Dans l&#8217;univers d&#8217;UTOPIA, tout est interconnecté, et chaque action individuelleaffecte le systeme comme un tout. Intellecturellement, nous savons que c&#8217;est de cette manière que notre planète fonctionne ecologiquement et economiquement, mais UTOPIA le représente à une échelle à laquelle nous pouvons le percevoir.</p>
<p>Les lignes ont également un autre objectif. Malgré CNN, Greenpeace, le toit de verre de Reistag de Berlin et d&#8217;autres institutions travaillant à rendre transparentes les sociéts modernes envers leurs citoyens, laplupart n&#8217;est pas visible. Ce n&#8217;est pas seulement parceque nous ne connaissons pas les motivations derriere telle politique gouvernementale ou parceque la publicté et les relations publiques travaillent constatemment pour faire apparaitre les choses différentes de ce qu&#8217;elles sont rééllement- le fonctionement des sociétés est invisible au sens littéral. Par exemple, nous ne savons pas quelles sont les cellules qui fonct fonctionner nos téléphones cellulaires, nous ne connaissons pas la disposition du réseau financier privé qui circule dans le monde, nous ne savons pas quelles entreprises sont situées dans un immeuble devant lequel nous passons tous les jours pour aller qau travail, et ainsi de suite. Mais dans UTOPIA nous le savons, parceque les liens sont rendus visibles. UTOPIA est une utopie parceque c&#8217;est une société dans laquelle la connectoin entre la cause et l&#8217;effet sont rendus visibles et compréhensibles. Le programme réécrit le Marxisme comme un graphisme vectoriel, il substitue la figure de la connection à la vieille figure du &laquo;&nbsp;unweilling&nbsp;&raquo;(NDT : il m&#8217;a été impossible de trouver un quelconque sens à ce mot. Les traductions dans les autres langues ayant gardé le terme original, j&#8217;ai décidé d&#8217;en faire de même).</p>
<p>Utopia, c&#8217;est du sérieux, derrière sa façade ludique-mais pas uniquement. En dessinant notre facination pour lales jeux vidéos et les logiciels d&#8217;interactions son/image, UTOPIA est un délice visuel. C&#8217;est Tetris qui rencontre Marx, qui rencontre l&#8217;exploitation de données qui rencontre<br />
une boite de nuit. C&#8217;est un jeu pour la nouvelle génération qui sait que le monde est un réseau, que les medias ne valent pas la peine d&#8217;être pris trop au sérieux, et que le programmation peut être utiliséecomme outil politique.</p>
<h2>L&#8217; insupportable légèreté de FLASH</h2>
<p>La section internet de la biennale 2001 de Tirana a été mise en place par Miltos Manetas/Electronic Orphanage. L&#8217;exposition a regroupé une petite douzaine de projets d&#8217;artistes et webdesigners, parmi lesquels de nombreux utilisateurs des technologies Flash ou Shockwave. Peter Lunenfeld, Norman Klein et moi-même avons été chargés par Manetas d&#8217;en rédiger le compte-rendu. Ce texte est ma propre contribution, la majeure partie des idées ont été développées d&#8217;après les conversations que tous trois avons eu à propos des travaux présentés lors de l&#8217;exposition. Les noms entre parenthèses sont ceux des artistes présents ; pour voir leurs projets, rendez-vous sur le site de l&#8217;exposition.</p>
<p>Biologie :</p>
<p>Les artistes Flash abondent en références biologiques : végétaux abstraits, créatures minimalistes ou simples nuages de pixels composent ce que l&#8217;oeil humain interprète comme étant représentatif de la vie (Geoff Stearns: deconcept.com, Vitaly Leokumovich: unclickable.com, Danny Hobart: dannyhobart.com; uncontrol.com). Nous voyons souvent des systèmes qui se régénèrent d&#8217;eux-même. Mais il ne s&#8217;agit pas là de la vie telle que nous la connaissons sur terre ; cela ressemble plutôt à ce ce que nous pourrions voir dans un laboratoire de biotechnologie où la biologie est utilisée à des fins industrielles. Nous assistons à une régénération et à une évolution extrêmement accélérées. Nous voyons émerger sous nos yeux des systèmes complexes : des millions d&#8217;années d&#8217;évolution condensées en quelques secondes.</p>
<p>Il y a une autre spécificité qui distingue la vie &laquo;&nbsp;à la Flash&nbsp;&raquo; de la vie réelle : l&#8217;absence de la mort. Les organismes biologiques et les systèmes naissent, se développent et, finalement, meurent. En résumé, ils représentent la téléologie. Mais, dans les projets Flash, la vie fonctionne différemment : puisqu&#8217;elles tournent en boucle, la mort disparaît. La vie suit éternellement son cours &#8211; plus précisément, tant que votre ordinateur reste connecté à internet.</p>
<h2><span>Amplification : l&#8217;esthétique Flash et les Jeux    Vidéo</span></h2>
<p>Les écosystèmes abstraits au sein de projets Flash ont une autre caractéristique qui rend le jeu si agréable (Joel Fox). Ils utilisent brillamment la puissance de l&#8217;ordinateur afin d&#8217;amplifier les actions de l&#8217;utilisateur.<br />
Cette puissance place l&#8217;ordinateur dans le groupe des &laquo;&nbsp;appareils magiques&nbsp;&raquo;, ce n&#8217;est pas par hasard que l&#8217;on remarque ce fait dans les jeux vidéos, encore que l&#8217;on peut voir ce fait dans toutes nos interactions avec le PC. Par exemple, lorsque vous dites à Mario de faire un pas vers la gauche en bougeant votre joystick, cette action entraîne une ravissante petite histoire : Mario se met à traverser une colline, puis il se met à grimper dessus, la colline étant trop raide Mario retombe alors sur le sol, tout secoué. Aucune de ces actions ne nécessitent quelque chose de notre part, tout ce que nous avons eu à faire fut de bouger une seule fois le joystick. Le jeu amplifie notre action, et l&#8217;étend au sein d’une séquence narrative.</p>
<p>Historiquement, les jeux vidéo ont toujours été en avance au niveau des interfaces. Dans les années 60 et 70 les utilisateurs communiquaient avec les ordinateurs à l’aide d’interfaces non graphique, en perforant des cartes, en tapant des lignes de code par exemple. En revanche depuis leur apparition à la fin des années 50, les jeux vidéo ont adoptés des interfaces graphiques interactives, une évolution qui du attendre les années 80 avant d’apparaître sur les ordinateurs individuels (PC).</p>
<p>De manière similaire, les jeux d&#8217;aujourd’hui utilise déjà ce que beaucoup d&#8217;ingénieurs informatique pense être le prochain paradigme (manière de penser dans une société) dans l&#8217;interaction homme-machine : l&#8217;amplification active des actions de l&#8217;utilisateur. Dans le futur, nous disent-ils, des programmes surveilleront et analyseront nos interactions avec l&#8217;ordinateur, trouveront les schémas et les motifs, et automatiseront les taches que l&#8217;ont fait régulièrement, comme sauvegarder nos travaux a intervalles réguliers ou filtrer et répondre aux emails. L&#8217;ordinateur pourra aussi analyser notre comportement et notre niveau d&#8217;attention, et régler son propre comportement en fonction de cela : aller plus vite, ralentir, etc&#8230; Dans une certaine mesure, ce nouveau paradigme est déjà en cours dans certaines applications, par exemple, un explorateur Internet propose des listes de sites correspondant a ce que nous recherchons, Microsoft Office Assistant essaye de deviner lorsque l’on à besoin d&#8217;aide. Cependant, un problème crucial se pose si l&#8217;on évolue vers une telle amplification de l’interaction entre l’homme et l’ordinateur. Plus nous déléguons du pouvoir à l’ordinateur, plus nous perdons le contrôle de ce qu’il fait. Comment savoir si un programme identifie correctement la manière dont nous utilisons nos email? Comment savoir si un programme censé negocier le produit le moins cher avec d&#8217;autres n&#8217;a pas été corrompu par eux ? En résumé comment savoir si l&#8217;ordinateur amplifie correctement nos actions.</p>
<p>Les jeux vidéo sont des jeux, et le pire qui puisse arriver  est que nous perdions.<br />
Par conséquent, l’amplification active est présente dans pratiquement tous les jeux : Mario s’embarquant dans des histoires par un simple mouvement de joystick, des troupes conduisant des manœuvres militaires complexes pendant que vous contrôlez seulement leur leader dans le jeu &laquo;&nbsp;Rainbow Six&nbsp;&raquo;, tandis que Lara Croft exécute toutes les acrobaties possible et imaginables par la simple pression d’une touche du clavier (à noter que dans les jeux &laquo;&nbsp;normaux&nbsp;&raquo; cette amplification n’existe pas, ainsi lorsque vous déplacez un pion sur un échiquier, voilà tout ce qu’il se passe, votre mouvement n’entraîne pas une série d’actions).</p>
<p>Les projets Flash, utilisent fortement l’amplification, ce qui donne à beaucoup de ces projets une sensation magique. Souvent nous sommes confrontés à un écran vide, mais un simple &laquo;&nbsp;clic&nbsp;&raquo; donne vie à tout un univers : un système de particules, des formes vivantes, ou encore tout un groupe de créatures diverses. L’utilisateur, qui tel un Dieu contrôle tout un monde est une situation que l’on rencontre souvent dans les jeux vidéos, Flash nous permet tout cela, mais en plus nous donne ce plaisir de pouvoir créer ce monde à partir de rien.</p>
<p>L’amplification active n’est pas la seule chose que les projets Flash et jeux ont en commun. Plus généralement, d’après Peter Lunefeld, les jeux sont à Flash ce que les films étaient à Wharhol. Le cinéma et la télévision ont colonisé l’inconscient des générations précédentes d’artistes des médias qui continuent d’utiliser la galerie comme thérapie. Les artistes Flash sont moins obsédés par les médias fondés sur le temps. Leur iconographie, leur rythme et esthétique de l&#8217;interaction viennent plutôt des jeux (Mike Clavert <a href="http://www.mikeclavert.com/" target="_blank">mikeclavert.com</a>).</p>
<p>Parfois la participation de l’utilisateur est requise pour que le jeu en Flash puisse fonctionner, parfois le jeu se joue tout seul. (UTOPIA par <a href="http://www.futurefarmers.com/" target="_blank">futurefarmers.com</a> ; <a href="http://www.dextro.org/" target="_blank">dextro.org</a>).</p>
<h2>Flash contre Net Art</h2>
<p>L&#8217;exposition Internet Tirana Biennale 01 : ce titre est profondément ironique. Cette esposition n&#8217;a en effet inclus aucun projet provenant d&#8217; Albanie ou d&#8217;un autre pays de l&#8217; Europe de l&#8217;Est post-communiste. Cela diffère beaucoup des premières exhibitions de net art du milieu des années 90 dont les stars venaient de l&#8217;Est : Vuc Cosic, Alexei Shulgin, Olga Lialina. Le net art des années 90 était le premier mouvement artistique international depuis les années 60 impliquant l&#8217;Europe de l&#8217;Est dans une large part. Prague, Lubiana, Riga et Moscou avaient autant d&#8217; importance qu&#8217;Amsterdam, Berlin et New York. Incluant de manière égale des artistes de l&#8217;ouest et de l&#8217;est, le net art correspondait parfaitement à l&#8217;utopie économique et sociale du monde de l&#8217;après-guerre froide des années 90.</p>
<p>Cette utopie a desormais disparue. La structure de la puissance de l&#8217;Empire mondial est aujourd&#8217;hui claire et la représentativité démographique de la section Internet du &laquo;&nbsp;Biennale 01&#8243; de Tirana la reflète parfaitement. Beaucoup d&#8217; artistes participant à l&#8217;exhibtition Internet &laquo;&nbsp;Tirana Biennale 01&#8243; travaillent dans les régions mondiales clés des NTIC : San Francisco (Silicon Valley), New York (Silicon Alley) et Europe du Nord.</p>
<p>Que s&#8217;est il passé ? Au milieu des années 90, le net art reposait sur le simple HTML qui marche aussi avec les connexions haut-débit que bas-débit &#8211; ceci permettait une participation active des artistes de l&#8217;Est. Mais la colonisation du web par les formats multimédias qui a suivie &#8211; Flash, Shockwave, QuickTime et autres – a rétablie la traditionnelle opposition Est/Ouest. Le Web Art réclame maintenant des connexions haut-débit aussi bien pour l&#8217;artiste que pour son public. Avec ses connexions à faible débit, l&#8217;Europe de l&#8217;Est est hors-jeu. L&#8217;utopie est finie, bienvenue dans l&#8217;Empire.<br />
(au Tirana Biennale 01 participait un artiste chinois qui a contribué à une magnifique animation de pratiquants d&#8217;arts martiaux. Mais nous n&#8217;avons jamais su qui il était. Tout ce que nous savons de lui c&#8217;est son adresse mail : <a href="javascript:DeCryptX('{iv`{irAtpiv/dpn')">zhu_&#122;hq&#64;s&#111;h&#117;.c&#111;&#109;</a>. Peut-être ne vit-il même pas en Chine).</p>
<h2>Generation FLASH: FAQ</h2>
<p>Après avoir envoyé les précédents paragraphes sur des mailing listes populaires traitant de l&#8217;art des nouveaux médias et la cyberculture (<a href="http://www.rhizome.org/" target="_blank">rhizome.org</a> et <a href="http://www.nettime.org/" target="_blank">nettime.org</a>), j&#8217;ai reçu beaucoup de réponses. Vous trouverez ici mes réponses aux deux questions les fréquentes apparant dans bon nombre de courriers.</p>
<p>Question :</p>
<p>Le &laquo;&nbsp;modernisme modéré&nbsp;&raquo; que vous décrivez n&#8217;est-il pas simplement la conséquence des limitations techniques inhérentes au multimédia sur le Net ? Vous semblez vous méprendre sur les fonctionnalités particulières à Flash, conçu pour jouer des animations à travers une faible bande passante pour une plus large audience.</p>
<p>&lt;NDT : &#8216;zeitgest&#8217; a été traduit par audience, car ce mot anglais signifiant &#8216;the general intellectual, moral, and culture climate of an era&#8217;, j&#8217;aurais du utiliser &#8216;tendance&#8217; ou &#8216;air du temps&#8217;, ce qui ne collait pas avec le contexte.&gt;</p>
<p>Réponse :</p>
<p>Maintenant que la nouvelle version de Flash (Flash MX) autorise l&#8217;import et le streaming vidéo, il est possible que les poncifs visuels “generation Flash” / “modernisme modéré” quittent les sites Flash. C&#8217;est un bonne chose. Mon sujet dans cet essai n&#8217;est pas le logiciel Flash est ses limitations ou possibilités elles-mêmes, mais la sensibilité nouvelle qui s&#8217;est manifestée dans beaucoup de projets Flash durant les deux dernières années. En d&#8217;autres mots, je me suis intéressé à la “generation Flash” ce qui est plutôt différent du logiciel/format Flash.</p>
<p>Par conséquent, toutes les personnes qui m&#8217;ont ainsi accusé de confondre un standard technique avec une mode visuelle après avoir lu m&#8217;ont essai on donc mal compris mes arguments. L&#8217;apparence vectorielle prononcée du &laquo;&nbsp;modernisme modéré&nbsp;&raquo; n&#8217;est pas simplement la résultante d&#8217;une faible bande passante et d&#8217;une nostalgie pour le design des années 60 – elle apparait toujours quand les gens commencent à générer des graphiques grâce à la programmation et découvrent qu&#8217;ils peuvent utiliser des équations simples, etc&#8230; C&#8217;est aussi pourquoi le &laquo;&nbsp;modernisme modéré&nbsp;&raquo; des projets Flash et des artistes utilisant d&#8217;autres logiciels recréent, et quelquefois de manière surprenante au détail près, l&#8217;esthétisme des précurseurs de l&#8217;art informatique (années 50 – années 70) quand on pouvait créer des graphismes et animations uniquement par la programmation.</p>
<p>Question:</p>
<p>Il n’y a aucune raison que l’art du logiciel ne puisse pas utiliser « des images représentatives » ou toute autre forme. Pourquoi associez vous l’art du logiciel avec les graphismes abstrait vectoriels non représentatifs ?</p>
<p>Réponse:</p>
<p>Il est certain que les artistes du logiciel peuvent utiliser &laquo;&nbsp;les images représentatives&nbsp;&raquo; ou tout autre forme ou media conventionnel. Il n’est pas innocent que juste après son arrivée au Xerox PARC dans les années 70, Alan Kay et ses associés créèrent un logiciel de dessin et un logiciel d’animation intégrant un système de fenêtre, des icônes, Smalltalk et d’autres principes de l’interface graphique moderne. La possibilité de manipuler et de générer des médias ne sont pas directement la conséquence de l’informatique moderne mais sont la partie centrale de son identité comme &laquo;&nbsp;médium dynamique personnel &nbsp;&raquo; (Alan Kay). En d’autres termes : l’ordinateur est un simulateur, comme s’il pouvait être utilisé pour simuler d’autres medias.</p>
<p>Je n’ai donc rien contre les artistes du logiciel qui utilisent ou créent des médias , cependant j’espère que la &laquo;&nbsp;génération Flash&nbsp;&raquo; va étendre son travail de programmation vers les médias représentatifs ! En d’autres termes, dans le début des années 70 le logiciel de dessin et le logiciel d’animation fut une révolution dans la vision que les gens on de l’ordinateur en l’éloignant du coté &laquo;&nbsp;programmation&nbsp;&raquo; et en l’associant a un média (créatif). Après 20 ans de logiciels &laquo;&nbsp;à menus&nbsp;&raquo; de manipulation de médias et d’utilisation de l’ordinateur comme d’un outil de production de media (largement accélérée par Internet), un peu de programmation devient révolutionnaire ! Bref, nous nous somme maintenant tellement habitués a considérer l’ordinateur comme un &laquo;&nbsp;médium dynamique personnel&nbsp;&raquo; qu’il faudrait désormais que nous rappelions et que nous rappelions aux autres que c’est aussi une machine programmable.</p>
<p>Maintenant il faut voir comment la programmation a été utilisée pour créer et utiliser des images, animation films et vidéo. Historiquement trois tendances peuvent être tracées. Une première tendance va des premiers travaux de computer art – les films Withney fait avec un ordinateur analogique au milieu des années 50 (faits par les étudiants de Oscar Fishinger et que l&#8217;on peut lier au le modernisme du début du 20ème siècle) – au &laquo;&nbsp;modernisme modéré&nbsp;&raquo; des projets Flash et les travaux de visualisation de donnée. En d’autres termes l’utilisation de la programmation pour générer et contrôler des images abstraites.</p>
<p>La seconde tendance débute dans les années 80 quand Hollywood et les designers TV commencèrent a utiliser images générées par ordinateur. Désormais la programmation est incorporée au service du réalisme cinématographique traditionnel. Les systèmes de particules, les grammaires formelles, l’intelligence artificielle et d’autres techniques logicielles deviennent les moyens de générer des vols de chauves souris, des terrains accidentés, les vagues de l’océan, des explosions, des créatures extra-terrestres et d’autres éléments figuratifs intégrés dans l’univers photo &#8211; réaliste d’un film narratif.</p>
<p>Que peut on dire de l’utilisation d’algorithmes pas seulement dans la génération d’éléments figuratifs d’une narration mais dans le contrôle de l’ensemble d’un univers fictif ? C’est la troisième tendance: La programmation dans les jeux vidéo (1960-). Dans ce contexte les algorithmes peuvent contrôler les événements de la narration, le comportement des personnages, les mouvements de caméra, et d’autres caractéristiques du monde de jeu – tout ceci en temps réel. Malheureusement, nous savons tous, esthétiquement révolutionnaire les jeux contrôlés par l’ordinateur et le joueur présentent des contenus pré-formatés qui font qu’en comparaison un mauvais film Hollywoodien peut paraître original et inspiré. (GTA 3 ne fait pas exception ici malgré sa percée dans la simulation d’un univers ouvert).</p>
<p>Je pense que ce bref tour d&#8217;horizon montre qu’il reste un espace inexploré et complètement ouvert pour l’expérimentation et la recherche créative – en utilisant le programmation pour générer et/ou contrôler des médias figuratifs ou fictifs. Par exemple dans le cas d’un film, la programmation peut être utilisée pour générer des personnages à la volée, pour composer en temps réel des personnages (filmées devant sur fond bleu) avec des paysages, pour contrôler le séquencement des scènes, pour appliquer des filtres a n’importe quelle scène en temps réel, pour combiner une scène préenregistrée avec une de l’imagerie générée a la volée, pour avoir des personnages interagissant avec le spectateur, etc. etc. En résumé, la programmation peut être utilisée n’importe quel aspect d’un travail de media de fiction.</p>
<p>Bien sûr de temps en temps, on rencontre des projets qui vont dans ce sens dans des endroits comme SIGGRAPH ou l&#8217;ISEA, mais ce sont souvent des démos de recherche créées dans des Universtités qui ne parviennent au grand public. On peut bien sur objecter le fait que crééer un algorithme qui controllant un univers foctionnel complexe neccesite un invesstissement concernant la programmation qui n&#8217;est accessible qu&#8217;aux sociétés de créations de jeux vidéos et aux Universités. Après tout ce n&#8217;est pas la même chose que d&#8217;écrire un script dessinant quelques lignes et repondant aux saisie de l&#8217;utilisateur &#8230; en effet, mais pourquoi nos travaux de fiction/figuratifs devraient ils répondre aux lois des médias commerciaux ? Si on accepte qu&#8217;un personnage n&#8217;ai pas a être réaliste, qu&#8217;un univers fictif n&#8217;a pas besoin d&#8217;être en 3 dimensions, que la chance et l&#8217;aléatoire peuvent coexister avec la logique narrative, ou que des personnages 2D peuvent coexister avec des personnages 3D et de la video etc. la programmation de fiction / figuration devient bien redoutable. En bref,bien que je salue la programmation sous Flash, je pense qu&#8217;il est plus stimulant de programmer sous QuickTime.</p>
<h2>Sur la légèreté de Flash</h2>
<p>Quand j&#8217;ai visité pour la première fois le plus  connu des sites Flash – <a href="http://www.praystation.net/" target="_blank">praystation.net</a> – j&#8217;ai éte frappé par la légèreté de ses graphismes. Comme un soupir, plus élégant que Door ou Channel, plus minimal que les sculptures minimalistes de Judd dans les sixties, plus effacé qu&#8217;un paysage hivernal plongé dans un épais brouillard, le site pousse l&#8217;échelle des contrastes aux limites de la lisibilité. Les même légèreté et dépouillement se retrouvent dans beaucoup de projets du Festival Biennale 01. Une fois de plus, le contraste avec les graphismes criards des médias commerciaux et la génération précédente d&#8217; &laquo;&nbsp;Art Media&nbsp;&raquo; est évidente.</p>
<p>La légèreté de Flash peut-être appréhendée comme un équivalent visuel à la musique d&#8217;ambiance électronique. Chaque ligne, chaque pixel compte. Flash fait appel à notre intelligence visuelle, à notre intelligence cognitive. Après le siècle des couleurs RGB qui a commencé avec Matisse et qui s&#8217;est terminé avec les trainées agressives de Wired, il nous faut maintenant prendre un nouveau départ, repartir de zéro. La génération Flash nous invite à subir un nettoyage visuel – c&#8217;est pourquoi nous voyons des palettes monochromes, blanc et gris clair. Elle utilise le neo-minimalisme comme une pilule pour nous guérir du post-modernisme. Dans Flash , la rationnalité du modernisme est combinée avec la rationnalité de la programmation et l&#8217;impact des jeux vidéos pour créer une nouvelle esthétique de la légèreté, curiosité et intelligence. Vérifiez que votre navigateur est bien équipé du plug-in correct : bienvenue dans génération Flash.</p>
<p>Je ne me fais pas l&#8217;avocat d&#8217;une renaissance du modernisme. Bien sur, nous ne voulons pas copier Mondrian et Klee sur les écrans d&#8217;ordinateurs. La tache de la nouvelle génération est d&#8217;intégrer les deux paradigmes esthétiques clés du 20° siècle :<br />
(1) croyance dans la science et la rationnalité, emphase mise sur l&#8217;efficacité et des formes simples, idéalisme et esprit heroique du modernisme<br />
(2) scepticisme, intérêt pour la marginalité et la complexité, stratégies deconstructrices, opacité baroque et excès du post-modernisme (années 60).<br />
Aujourd&#8217;hui, tous les composants du second paradigme sont des clichés épuisés. Ainsi, un retour partiel au modernisme est un premier pas qui n&#8217;est pas forcément mauvais, tant qu&#8217;il reste une étape vers le développement de nouveaux conceptsde riches mélanges culturels.<br />
Evidemment cette esthétique doit aussi s’engager totalement dans la difficile question de la globalisation. La culture du remix dans laquelle nous vivons actuellement n’est pas seulement engagée dans le mélange de toutes les formes culturelles et de tous les textes précédents mais également dans le mélange de dispositifs variés qui résultent de ce que l’on avait l’habitude d’appeller les cultures nationales ainsi que du mélange existant entre les populations immigrantes et leurs cultures “hôtes”.</p>
<p>La solution offerte par les conglomérats multinationaux – un mélange qui prend certains traits de quelques cultures nationales – par exemple, l’idée française de l’élégance, l’iconographie japonaise du manga, les références au flegme britannique, etc. – et qui intègre le tout dans un texte fade et monolithique qui est alors diffusé dans le monde entier – n’est évidemment pas une solution satisfaisante. (Cela me rappelle l’économie centralisée du modèle soviétique quand toute la production des fermes collectives était envoyée au centre pour décider comment elle serait répartie nationalement.)</p>
<p>Heureusement, de nombreux mélanges, qui suivent des logiques différentes, sont en train d’être explorés dans le monde par des musiciens, des compagnies de théâtre, des danseurs, des designers, des architectes et ainsi de suite. Personne ne sait ce qu’il va émerger de ce laboratoire culturel mondial – et c’est ce qui rend notre époque si intéressante.<br />
Bien que la plupart de mes arguments dans ce livre traitent de la culture de l’esthétique visuelle, il est approprié d’évoquer, à ce point, une pratique différente. Historiquement, la musique est le champ artistique qui a toujours été en tête dans l’utilisation des ordinateurs pour permettre de nouveaux paradigmes esthétiques.</p>
<p>L’entière pratique de la musique électronique populaire dans les trois dernières décennies est un testament à la façon dont les nouvelles technologies autorisent la soudure entre les nouveaux mélanges, complexes et riches, et les différents styles, cultures et sensibilités. Sans l’électronique et l’informatique – depuis un tourne-disque et un lecteur de cassette jusqu’au réseau de partage de fichiers peer-to-peer et les logiciels de synthèse de musique fonctionnant sur un ordinateur portable – la majeur partie de cette culture n’aurait jamais vue le jour. Le champ de la musique électronique (qui signifie aujourd&#8217;hui la plupart des sons) avec ses multiples voix et da logique émergente, est une puissante alternative aux composés culturels vendus par les conglomérats globaux des médias dans le monde. Espérons que d’autres artistes et designers dans d’autres branches suivront l’exemple de la musique dans l’utilisation d’un ordinateur pour permettre, de la même façon, de riches mélanges culturels.</p>
<p><a href="http://www.manovich.net/DOCS/generation_flash.doc" target="_blank">Génération  Flash, version anglaise et originale</a> (format .doc)</p>
<p>Crédit : Merci à  Lev Manovich pour son soutien ainsi qu&#8217;aux personnes ayant participé  à cette traduction : <a href="http://glorb.ultimteam.com/" target="_blank"> Glorb</a>, Lil, Lythium,  Rattlesnake, Jean-Phi69, DickRivers, <a href="http://www.nosource.com/" target="_blank">Satya</a>, <a href="http://epsilondesign.free.fr/" target="_blank">Epsilon</a>, <a href="javascript:DeCryptX('mpjd/vsjfoAjgsbodf/dpn')" target="_blank">Loic Urien</a> &#8211; relecture  de fond par David Deraedt.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/generation-flash-par-lev-manovich/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Contexte d&#8217;exécution et sécurité des swf</title>
		<link>http://www.flashxpress.net/ressources-flash/contexte-dexecution-et-securite-des-swf/</link>
		<comments>http://www.flashxpress.net/ressources-flash/contexte-dexecution-et-securite-des-swf/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 14:55:23 +0000</pubDate>
		<dc:creator>Vincent Maitray</dc:creator>
				<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[WebTV]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[sécurité]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/?p=1055</guid>
		<description><![CDATA[jwplayer("contexte_swf").setup({ flashplayer: "http://www.flashxpress.net/wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf", file: "http://ks358667.kimsufi.com/~video/webtv/contexte_swf.flv", image: "http://ks358667.kimsufi.com/~video/webtv/posters/contexte_swf.flv.jpg", width: 630, height: 473 }); &#160; Mini tutoriel video sur les options de sécurité à l&#8217;exécution d&#8217;un swf, en fonction de son contexte, par Vincent Maitray.]]></description>
			<content:encoded><![CDATA[<p><div id="contexte_swf">
<video controls="controls" width="630" height="473">
<source src="http://ks358667.kimsufi.com/~video/webtv/iPhone/contexte_swf.mp4" type="video/mp4" />
</video>
</div>
<script type="text/javascript">
jwplayer("contexte_swf").setup({
flashplayer: "http://www.flashxpress.net/wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf",
file: "http://ks358667.kimsufi.com/~video/webtv/contexte_swf.flv",
image: "http://ks358667.kimsufi.com/~video/webtv/posters/contexte_swf.flv.jpg",
width: 630,
height: 473
});
</script>
<p>&nbsp;</p>
</p>
<p>Mini tutoriel video sur les options de sécurité à l&#8217;exécution d&#8217;un swf, en fonction de son contexte, par Vincent Maitray.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/contexte-dexecution-et-securite-des-swf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Swf transparent</title>
		<link>http://www.flashxpress.net/ressources-flash/publication-animation-transparente/</link>
		<comments>http://www.flashxpress.net/ressources-flash/publication-animation-transparente/#comments</comments>
		<pubDate>Sat, 13 Aug 2005 11:11:29 +0000</pubDate>
		<dc:creator>Guylaine</dc:creator>
				<category><![CDATA[Flash général]]></category>
		<category><![CDATA[Tutoriels Flash]]></category>
		<category><![CDATA[intégration]]></category>
		<category><![CDATA[swf]]></category>

		<guid isPermaLink="false">http://www.flashxpress.net/2005/08/13/publication-animation-transparente/</guid>
		<description><![CDATA[Mise en oeuvre Cette option de transparence permet de rendre transparente la couleur de la scène afin de voir par exemple, une image placée derrière le Swf, dans la page Html. Le paramètre de transparence pour un SWF s&#8217;établit dans les options de publication de Flash &#8211; le code se renseignera tout seul dans la [...]]]></description>
			<content:encoded><![CDATA[<h3>Mise en oeuvre</h3>
<p>Cette option de transparence permet de rendre transparente la couleur de la scène afin de voir par exemple, une image placée derrière le Swf, dans la page Html.</p>
<p>Le paramètre de transparence pour un SWF s&#8217;établit dans les options de publication de Flash &#8211; le code se renseignera tout seul dans la page HTML ainsi publiée !</p>
<p><em>Fichiers &gt; Paramètres de publication (CTRL+MAJ+F12) &gt; onglet    HTML &gt; option Mode fenêtre.</em></p>
<p>Avec Flash MX, un bouton dans l&#8217;inspecteur de Propriétés permet d&#8217;accéder plus rapidement aux paramètres de publication (bouton Flashplayer 6).<br />
Et puisque l&#8217;on parle de cette dernière version, une nouveauté est de manipuler ces options de publication par programmation.</p>
<p>Si vous utilisez Dreamweaver, sélectionnez le swf et    dans la fenêtre de <span class="italique">Propriétés </span>, cliquez sur <span class="italique">Paramètres </span> :</p>
<blockquote class="source"><p>paramètre &#8211;&gt; wmode<br />
value &#8211;&gt; tranparent</p></blockquote>
<p>Ce paramètre apparaît automatiquement dans votre code HTML :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p601code38'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p60138"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p601code38"><pre class="html" style="font-family:monospace;">&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; width=&quot;88&quot; height=&quot;31&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;
&lt;embed type=&quot;application/x-shockwave-flash&quot; width=&quot;88&quot; height=&quot;31&quot;&gt;
&lt;/embed&gt;
&lt;/object&gt;
&nbsp;
&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; width=&quot;88&quot; height=&quot;31&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;
&lt;param name=&quot;src&quot; value=&quot;images/ho.swf&quot; /&gt;
&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;
&lt;embed type=&quot;application/x-shockwave-flash&quot; width=&quot;88&quot; height=&quot;31&quot; src=&quot;images/ho.swf&quot; wmode=&quot;transparent&quot;&gt;
&lt;/embed&gt;
&lt;/object&gt;</pre></td></tr></table></div>

<h3>Particularité</h3>
<p><em>Précision importante</em> : ce paramètre de transparence ne fait que SIMULER un Swf en arrière-plan    sur une page HTML .<br />
Comme tout contenu dynamique (applets Java, formulaires,&#8230;), un swf s&#8217;affiche TOUJOURS au dessus de tous les autres éléments statiques d&#8217;une page.</p>
<p>C&#8217;est par conséquent inutile d&#8217;essayer d&#8217;afficher un swf dans un calque par exemple, de donner à ce calque une valeur z-index négative pour le faire apparaitre sous les autres éléments. Autrement dit la transparence d&#8217;un swf est une illusion.</p>
<p>Attention également, la transparence diminue la vitesse    dans Flash !</p>
<p><em>Compatibilité</em> : <span class="grasRouge">ne fonctionne que pour    Internet Explorer PC uniquement </span>!! Netscape et IE Mac pour l&#8217;instant,    ne supportent pas ce paramètre.<br />
Donc à utiliser avec prudence&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashxpress.net/ressources-flash/publication-animation-transparente/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

