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
|
//DétailProduits.mxml :
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:VP="VP.*"
xmlns:Effets="boo.nina.flex.Effets.*"
horizontalScrollPolicy="off" verticalScrollPolicy="off" height="478" width="470" initialize="initDet()">
<mx:Script>
<![CDATA[
import mx.events.*;
import mx.effects.effectClasses.*;
//pour créer un lien:
import flash.net.*;
import mesClasses.Catalogue.Produit;
import mesClasses.Catalogue.ProduitEvent;
private var _product:Product;
[Bindable]
public function get produit():Produit
{
return _produit;
}
public function set produit(p:Produit):void
{
_produit = p;
tn.selectedIndex = 0;
}
public var pdt:Produit;
//////////////PERSO
public function initDet():void{
//Création d'un tableau
var tableauImgPdt:Array = new Array (pdt.img);
//si il y a une image 2:
if(pdt.img2!=null)
{
tableauImgPdt.push(pdt.img2);
}
//si il y a une image 3:
if(pdt.img3!=null)
{
tableauImgPdt.push(pdt.img3);
}
//si il y a une image 4:
if(pdt.img4!=null)
{
tableauImgPdt.push(pdt.img4);
}
//si il y a une image 5:
if(pdt.img5!=null)
{
tableauImgPdt.push(pdt.img5);
}
var i:int;
//boucle for qui permet de lire le tableau et de créer une vue pour chaque image
for (i=0; i<tableauImgPdt.length; i++)
{
var ma3Dbox:_3DBox = new _3DBox;
ma3Dbox.id = 'boite'+i;
visuels.addChild(ma3Dbox);
var monImage:Image = new Image;
monImage.source = tableauImgPdt[i];
ma3Dbox.addChild(monImage);
}
}
]]>
</mx:Script> |
Partager