pb chargement image en ligne
Bonjour,
je rencontre un curieux problème pour moi.
J'ai une galerie d'image que je charge dans ma classe.
les chemins des images sont du type : http://sousdomaine.mondomaine.com/img/nomimage.jpg
mon fichier flash est sur mondomaine.com
Quand je teste mon swf sur mon ordi, tout fonctionne bien, les images sont uploadées et affichées mais quand je teste mon swf en ligne, là plus rien aucune image n'est affichée????
si je mets mes images dans un dossier à coté du swf en ligne et change le chemin en img/monimage.jpg, là ça marche
je me suis dis que c'etait peut etre un pb de security de la sandbox mais a priori non. Je me suis fais un autre swf super simple (pas de classe mais le code directement sur la timeline) qui ne charge qu'une image avec le chemin http://sousdomaine.mondomaine.com/img/nomimage.jpg
et là ca marche????
y'a t'il des choses particulieres à faire en as3 quand on utilise des chemins complets ?
Merci de votre aide
voici mon code, on ne peut plus simple pourtant.... comprend pas
Code:
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
|
private function loadVignette():void
{
image = new URLRequest(this.urlVignette);
// Evénement progress
conloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onVignetteProgress);
// Evénement complete
conloader.contentLoaderInfo.addEventListener(Event.COMPLETE, onVignetteComplete);
// chargement de l'image dans le conteneur
conloader.load(image);
conloader.x = this.posx;
conloader.y = this.posy;
}
/**** declenche quand vignette loader ***/
private function onVignetteComplete(event:Event):void
{
//--- suppression de l'écouteur
//--- affichage de la bitmap;
this.vignetteBitmap = this.createVignette();
mc.x = this.posx + ( vignetteBitmap.width/2);
mc.y = this.posy - ( vignetteBitmap.height/2);
vignetteBitmap.x =( vignetteBitmap.width/2);
vignetteBitmap.y = ( vignetteBitmap.height/2);
vignetteBitmap.rotationY = -180;
mc.visible = false;
mc.addChild(this.vignetteBitmap);
addChild(mc)
//swapChildrenAt(0,1)
var myTweenSquare:TweenMax = TweenMax.to(this.square, 0.5, {
rotationY:180
});
myTweenSquare.addEventListener(TweenEvent.UPDATE, isMoveSquare );
mc.rotationY =90;
//--- ajout des ecouteurs
this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}
private function createVignette():Bitmap
{
var originalBitmap:Bitmap = Bitmap(this.conloader.content);
originalBitmap.smoothing =true;
var bitmapData:BitmapData = new BitmapData(this.vignetteWidth, this.vignetteHeight,true,0xffffff);
//--- redimentionnement si necessaire
if (originalBitmap.width != this.vignetteWidth || originalBitmap.height != this.vignetteHeight) {
//--- On calcul le ratio de redimensionnement
var ratio:Number = Math.max(this.vignetteWidth / originalBitmap.width, this.vignetteHeight / originalBitmap.height);
var scaleMatrix:Matrix = new Matrix();
scaleMatrix.scale(ratio, ratio);
bitmapData.draw(originalBitmap, scaleMatrix, null, null, null, true);
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.smoothing =true;
return bitmap;
}
return originalBitmap;
} |