Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. marcipp
    3. Post
    M

    marcipp

    @marcipp

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 1
    • Post 2
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Età 43
    0
    Reputazione
    3
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da marcipp

    • RE: Resize image e Smoothed

      Hai ragione ma mi sono appena iscritto e non ci avevo capito molto!
      Grazie

      postato in Coding
      M
      marcipp
    • Resize image e Smoothed

      Ciao ragazzi è la prima vota che scrivo sul vostro forum com la sperazna che qualcuno mi aiuti a risolvere il seguente problema!

      Sto impostando un page flip, che in realta ho scaricato come utilità libera, solo che carico immagini tramite un file xml che però ridimensiono, tramite uno script che ho trovato in internet, perchè ho la necessità di importarle di dimensioni più grandi per poi essere zoomate!
      Lo script è il seguente, sono consapevole che è un gran casino perchè non essendo un esperto mi procuro script qua e la e poi cerco di sistemarli secondo le mie esigenze, quindi dovrei far funzionare sia il resize che loadBitmapSmoothed

      pages._visible = 0;
      debug._visible = 0;
      mano._visible = false;
      #include "import_xml.as"
      stop();
      
      //variable declarations to hold the values
      var thisWidth:Number;
      var thisHeight:Number;
      var maximumHeight:Number;//height to which movieclip to be resized
      var maximumWidth:Number;//width to which movieclip to be resized
      var oldx:Number;
      var oldy:Number;
      var ratio:Number;
      var mclis:Object = new Object();//An object that listens for a callback notification from the MovieClipLoader event handlers.
      
      mclis.onLoadInit = function(target_mc:MovieClip) {//Invoked when the actions on the first frame of the loaded clip have been executed
      _root.thisHeight = target_mc._height;//loaded movieclip height
      _root.maximumHeight = 1520;
      _root.thisWidth = target_mc._width;//loaded movieclip width
      _root.maximumWidth = 1057;
      ratio = thisHeight/thisWidth;//calculation ratio to which resize takes place
      if (thisWidth>maximumWidth) {
      thisWidth = maximumWidth;
      thisHeight = Math.round(thisWidth*ratio);
      }
      if (thisHeight>maximumHeight) {
      thisHeight = maximumHeight;
      thisWidth = Math.round(thisHeight/ratio);
      }
      target_mc._width = 278;//applying new width
      target_mc._height = 400;//applying new height
      target_mc._x = 0;//applying new height
      target_mc._y = 0;//applying new height
      };
      var mcl:MovieClipLoader = new MovieClipLoader();//MovieClipLoader class lets you implement listener callbacks that provide status information while SWF, JPEG, GIF, and PNG files are being loaded into movie clips.
      mcl.addListener(mclis);//add the object as listener for event handlers
      _root.target_mc("target_mc", _root.getNextHighestDepth());//holder movieclip
      _root.mcl.loadClip("page07.jpg", _root.pages.p1.page.pf.ph.pic);
      _root.mcl.loadClip("page07.jpg", _root.pages.p4.page.pf.ph.pic);
      _root.mcl.loadClip("page07.jpg", _root.pages.flip.p2.page.pf.ph.pic);
      _root.mcl.loadClip("page07.jpg", _root.pages.flip.p3.page.pf.ph.pic);
      _root.mcl.loadClip("page07.jpg", _root.pages.p0.page.pf.ph.pic);
      _root.mcl.loadClip("page07.jpg", _root.pages.p5.page.pf.ph.pic);
      
      import flash.display.BitmapData;
      import flash.geom.Matrix;
      function myCopy(pic) {
          var mc = this.createEmptyMovieClip('mc', this.getNextHighestDepth());
          var bmp = new flash.display.BitmapData(loadListener.myWidth, loadListener.myHeight, true, 0xFFFFFF);
          bmp.draw(pic);
          _root.pages.p4.page.pf.ph.pic.attachBitmap(bmp,0,null,true);
          _root.pages.p4.page.pf.ph._rotation = 0;
      }
      // create the movieclips
      // first the temporary mc where you load the initial image
      this.createEmptyMovieClip('temploader', this.getNextHighestDepth());
      // then a movieclip where you'll create your canvas
      //this.createEmptyMovieClip('picparent', this.getNextHighestDepth());
      // finally the actual movieclip where your image will get drawn
      //picparent.createEmptyMovieClip('container', this.getNextHighestDepth());
       
      var loadListener:Object = new Object();
      var mcLoader:MovieClipLoader = new MovieClipLoader();
      mcLoader.addListener(loadListener);
      loadListener.onLoadStart = function(target_mc:MovieClip):Void {
           // make the temporay mc invisible
           target_mc._alpha=0;
      }
      loadListener.onLoadInit = function(target_mc:MovieClip):Void  {
          // get the image dimensions
          this.myWidth = 278;
          this.myHeight = 400;
          
          // when the image is fully loaded copy it with smoothing to the final container
          myCopy(temploader);
          
      };
      function preload(myClip) {
          //loding fumction
          mcLoader.loadClip(myClip,temploader);
      }
      //Start loading your image
      preload("page07.jpg");
       
      ```Confido in voi!!
      postato in Coding
      M
      marcipp