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
| <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="514">
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.modules.*;
import mx.collections.ArrayCollection;
public var listeBouton:ArrayCollection = new ArrayCollection();
public var delachaux:Array = ["delachaux", "delachaux_01", "delachaux_02", "delachaux_03", "delachaux_04"];
public var bugnon:Array = ["bugnon", "bugnon_01"];
public function createModule(s:Array, i:int):void {
m.unloadModule();
m.url = s[i] + ".swf";
m.loadModule();
creerListeClip(s);
//montrerClipActif(i);
}
public function creerListeClip(s:Array):void {
listeBouton.removeAll();
//listeClip.removeAllChildren();
for (var y:Number = 0; y < s.length; y++) {
var bouton:boutonClip = new boutonClip();
var vignette:Image;
//vignette.source = "/assets/" + s[y] + "_vignette.jpg";
vignette.source = "@Embed('/assets/" + s[y] + "_vignette.jpg')"
bouton.setStyle("icon", vignette);
bouton.label = s[0] + " " + y;
bouton.setVisible(true);
bouton.visible = true;
bouton.width = 50;
bouton.height = 50;
//bouton.x = 10;
//bouton.y = 10;
//click="createModule(delachaux, 1)"
listeBouton.addItem(bouton);
//listeClip.addChild(bouton);
}
listeClip.unloadModule();
listeClip.url = "listeClip.swf";
//listeBouton.refresh();
listeClip.loadModule();
}
public function montrerClipActif(j:int):void {
if (j == 1) {
//b01.label = "schtroumpf";
}
}
]]>
</mx:Script>
<mx:Panel title="Module Example"
height="472"
width="90%"
paddingTop="10"
paddingLeft="10"
paddingRight="10"
paddingBottom="10">
<mx:HBox width="348">
<mx:Button label="Delachaux"
click="createModule(delachaux, 1)"/>
<mx:Button label="Bugnon"
click="createModule(bugnon, 1)"/>
</mx:HBox>
<mx:Panel width="446" height="239">
<mx:ModuleLoader id="m" width="100%" />
</mx:Panel>
<mx:Panel width="446" height="92">
<mx:ModuleLoader id="listeClip" width="100%" height="100%"/>
</mx:Panel>
</mx:Panel>
</mx:Application> |
Partager