Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    as3 arrayBitmap scompare la thumb

    ragazzi ho un array di bitmap che metto dentro un mc per visualizzare le thumb in questo modo
    Codice PHP:
    private function onImageComplete(evt:Event):void
            
    {
                
    evt.target.removeEventListener(Event.COMPLETE,onImageComplete);
                
                var 
    i:int=int(evt.target.loader.name);
                var 
    bitmap:Bitmap=evt.target.loader.content as Bitmap;
                
                
    arrayLoghiGrandi.push(bitmap);
                
    heightL=bitmap.height;
                
    //a questo punto io già ho la bitmap e le sue dimensioni quindi faccio il controllo per le giuste posizioni
                
    if(counter==0){
                
    posizionaContenitoreLoghi();
                }
                
                var 
    bitmap_mc:MovieClip=new MovieClip();
                
    bitmap_mc.mouseEnabled=true;
                
    bitmap_mc.buttonMode=true;
                
    bitmap_mc.name="bitmap_mc"+counter;
                
    bitmap_mc.id=counter;
                
    bitmap_mc.addEventListener(MouseEvent.CLICK,clickItem);
                
    bitmap.smoothing=true;
                
    bitmap_mc.x=bitmap_mc.y=0;
                
    bitmap_mc.addChild(bitmap);
                
    //inserisco gli mc con dimensioni originali per tenerne traccia
                
                
    bitmap_mc.width=bitmap_mc.width*fattore_di_scala;
                
    bitmap_mc.height=bitmap_mc.height*fattore_di_scala;
                
                
    bitmap_mc.x=setX;
                
    setX=setX+bitmap_mc.width+2;
                
    maschera_mc=new MovieClip();
                
    //disegno la maschera solo per ora
                
    maschera_mc.graphics.beginFill(0xCCCCCC,0.5);
                
    maschera_mc.graphics.drawRect(0,0,5,bitmap_mc.height);
                
    maschera_mc.x=bitmap_mc.x;
                
    maschera_mc.y=bitmap_mc.y;
                
    //------------------------------------------------------
                
    bitmap_mc.mask =maschera_mc;
                
    Tweener.addTween(maschera_mc,{width:bitmap_mc.width,time:2,transition:"easeOutCubic"});
                
                
    contenitoreLoghi.addChild(bitmap_mc);
                
    contenitoreLoghi.addChild(maschera_mc);
                
                
                if(
    counter<arrayPercorsi.length-1)
                {
                    
    counter++;
                    
    caricaLoghi();
                }
                else{
                    
    trace('all images has been loaded');
                    
    eliminaPreload();
                    

                    
    ratio=-contenitoreLoghi.width/stage.stageWidth;
                    
    addEventListener(Event.ENTER_FRAME,moveHolder);
                    
                    }
            } 
    dopo di che quando clicco su una thumb si chiude la maschera e si apre la bitmap grande contenuta nell array in questo modo
    Codice PHP:
    private function clickItem(evento:MouseEvent):void
            
    {
                
    //elimino l'ascoltatore
                
    evento.target.removeEventListener(MouseEvent.CLICK,clickItem);
                
    trace(evento.target.id);
                
                
    //creo l'animazione di chiusura delle maschere
                
                //disegno la maschera solo per ora
                
    maschera_mc.graphics.beginFill(0xCCCCCC,0.5);
                
    maschera_mc.graphics.drawRect(0,0,stage.stageWidth,heightL);
                
    maschera_mc.x=0;
                
    maschera_mc.y=contenitoreLoghi.y;
                
    contenitoreLoghi.mask=maschera_mc;
                
    addChild(contenitoreLoghi);
                
    addChild(maschera_mc);
                
    Tweener.addTween(maschera_mc,{width:0,time:2,transition:"easeOutCubic",onComplete:apriLogoGrande});
                function 
    apriLogoGrande(){
                var 
    m:MovieClip=new MovieClip();
                
    m.addChild(arrayLoghiGrandi[evento.target.id]);
                
    m.x=stage.stageWidth/2-arrayLoghiGrandi[evento.target.id].width/2;
                
    m.y=stage.stageHeight/2-arrayLoghiGrandi[evento.target.id].height/2;
                
    m.alpha=0;
                
    addChild(m);
                
    Tweener.addTween(m,{alpha:1,time:3,transition:"easeOutCubic"});
                
    m.mouseEnabled=true;
                
    m.buttonMode=true;
                
    m.addEventListener(MouseEvent.CLICK,function(){
                
    Tweener.addTween(m,{alpha:1,time:3,transition:"easeOutCubic",onComplete:apriMask});
                function 
    apriMask():void{
                
    Tweener.addTween(maschera_mc,{width:stage.stageWidth,time:2,transition:"easeOutCubic"});
                
    removeChild(m);
                }
                })
                }
                
            } 
    tutto funziona solo che scompare la thumb corrispondente
    ecco a voi per farvi capire
    http://www.graphicsolution.it/nuovo3/loghi/
    perchè succede non capisco?

  2. #2
    grazie ragazzi ho risolto da solo...

    per chi possa avere lo stesso problema suggerisco di non usare mai un array di bitmap ma sempre di bitmapdata e recuperare la bitmap da cio
    ciao grazie cmq

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.