Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    110

    dividere un'immagine in blocchi, un aiuto?

    Salve a tutti,
    dentro alla mia libreria ho
    ho un'immagine e un movie clip.
    Dentro al movie clip ho una piccola box.

    Riesco a creare 20 box a partire da quella piccola, tramite il codice
    for (var py:int = 0; py<rows; py++) {
    for (var px:int = 0; px<cols; px++) {

    var box:Box = new Box();
    box.x = 50 + box.width * px;
    box.y = 50 + box.height * py;
    addChild(box);

    box.alpha = .5;
    }
    }
    in questo modo mi crea 20 box dello stesso colore del box dentro alla libreria, grigio.

    Vorrei poter copiare l'immagine che si trova dentro alla libraria, divisa in base al numero dei blocchi.
    E' possibile copiare l'immagine dentro ad una variabile temp e dividere questa immagine?

    Non ho idea.
    Posto l'intero codice di poche righe.
    Grazie in anticipo.
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.geom.Rectangle;
    import flash.geom.Point;

    var boxNum:int = 20;
    // we need to know how many columns our
    // grid is going to have
    var cols:int = 6;
    // calculate how many rows we need based on
    // boxNum
    var rows:int = Math.ceil(boxNum / cols);
    // the number of boxes attached to the stage
    var boxCount:int = 0;

    ///////////

    var xBilledet:Number = 0;
    var yBilledet:Number = 0;
    var placeringX:Number = 100;
    var placeringY:Number = 50;
    //var imageLoader:Loader = new Loader();
    //var imageRequest:URLRequest = new URLRequest("myPic2.jpg");
    var bitmap:BitmapData = new BitmapData(424, 600, true, 0);

    ///////////

    for (var py:int = 0; py<rows; py++) {
    for (var px:int = 0; px<cols; px++) {

    var box:Box = new Box();
    box.x = 50 + box.width * px;
    box.y = 50 + box.height * py;

    /////
    //what's wrong?
    var copy:BitmapData = new BitmapData(box.x,box.y,true,0);
    var rect:Rectangle = new Rectangle(0,0,box.x,box.y);
    var pt:Point = new Point(0,0);
    box:Bitmap = new Bitmap(copy);
    ///end what's wrong

    addChild(box);


    // only add listeners if box should be active
    if (boxCount < boxNum) {
    box.buttonMode = true;

    box.addEventListener(MouseEvent.ROLL_OVER, onOver, false, 0, true);
    box.addEventListener(MouseEvent.ROLL_OUT, onOut, false, 0, true);
    box.alpha = 0.5;
    }else{
    // box is inactive
    box.alpha = .5;
    }

    boxCount++;
    }
    }

    function onOver(evt:Event):void {
    var box:MovieClip = MovieClip(evt.target);
    addChild(box)
    box.scaleX = box.scaleY = 1.3;
    }

    function onOut(evt:Event):void {
    evt.target.scaleX = evt.target.scaleY = 1;
    }

  2. #2
    Utente bannato
    Registrato dal
    Jul 2007
    Messaggi
    368
    Non ho capito, vuoi suddividere l' immagine in tante aree cliccabili diverse? Se è così potresti creare 20 pulsanti completamente trasparenti da mettere sopra all' immagine.

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    110
    piu' che altro l'immagine l'ho divisa in piccole sotto-immagini...ora devo creare un effetto di flip o meglio conosciuto come revolver, per ogni singola immagine.
    Se sai come si faccia, per cortesia fa sapere.
    tks

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.