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

    importa immagini che si adatti allo schermo

    Salve a tutti
    Sono riuscito a trovare un codice che mi adatta la foto in base alla grandezza della finestra e funziona perfettamente. Il problema è che la foto è inserita in libreria e l'swf pesa già troppo.
    Come posso fare in modo che quella foto venga caricata dall'esterno?

    #include "lmc_tween.as"
    Stage.align = "TL";
    Stage.scaleMode="noscale";
    _quality="BEST";

    _global.setStage = function() {
    slis = new Object();
    slis.onResize = function() {

    //imposto le dimensioni del clipo sfondo al fine di adattarlo alla pagina
    sfondo._width = Stage.width;
    sfondo._height = Stage.height;
    };
    Stage.addListener(slis);
    slis.onResize();
    };
    setStage();

    //Adatto l'immagine
    var rapp = foto._width/foto._height;
    var ecout = new Object();
    ecout.onResize = function() {
    bouge();
    };
    Stage.addListener(ecout);
    bouge = function () {
    foto._x = 0;
    foto._y = 0;
    foto._width = Stage.width;
    foto._height = Stage.width/rapp;
    if (foto._height<Stage.height) {
    foto._height = Stage.height;
    foto._width = Stage.height*rapp;
    }
    // end if
    };
    bouge();
    stop();

  2. #2
    Questo codice importa la foto dall'esterno
    ma non riesco ad integrarli....Sono alle prime armi con AS3

    //immagine importata dall'esterno
    import flash.display.*;
    import flash.net.URLRequest;
    import flash.events.Event;

    var loader:Loader = new Loader();
    var url:String = "foto/company.jpg";
    var urlReq:URLRequest = new URLRequest(url);
    loader.load(urlReq);
    addChild(loader);
    loader.x=-0;
    loader.y=0;
    setChildIndex(loader,1);

    // Caricamento in corso
    function onProgress(event:ProgressEvent):void {
    trace(" Percentuale caricamento: " + int((event.bytesLoaded/event.bytesTotal)*100));
    }

    // Caricamento Completato
    function onComplete(event:Event):void {
    trace(" ::: CARICAMENTO COMPLETATO :::");
    }

    loader.contentLoaderInfo.addEventListener(Progress Event.PROGRESS, onProgress);
    loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, onComplete);

    stop();

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.