A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Can Someone Help Me To Understand This Code?

  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    73

    resolved [RESOLVED] Can Someone Help Me To Understand This Code?

    Hi,

    I have a tutorial for applying smoothing to bitmap data so my images will scale smoothly. Can someone help me to understand how I can apply it to my existing code?

    Code:
    _global.smoothImageLoad = function(imgURL, targetMovie) {
         var i=0
         do { i++ } while (eval("_root.smoothImageLoadTemp"+i) != undefined)
              tmc = _root.createEmptyMovieClip("smoothImageLoadTemp"+i, _root.getNextHighestDepth())
              tmc.createEmptyMovieClip("ti", tmc.getNextHighestDepth())
              tmc.tm = targetMovie
              with(tmc) {
                   tmcl = new MovieClipLoader()
                   tmcl.onLoadComplete = function() {
                        ti.onEnterFrame = function() {
                             pixelData = new flash.display.BitmapData(ti._width, ti._height);
                             pixelData.draw(ti);
                             tm.attachBitmap(pixelData, 1, true, true);
                             tm.smoothImageLoadComplete()
                             removeMovieClip(ti._parent)
                        }
                   }
              tmcl.loadClip(imgURL, tmc.ti)
         }
    }
    Code:
    smoothImageLoad("image.jpg", mytargetmc)
    Firstly, I have the mainMenu .swf then I have gallery sub .swfs loaded into the main. Should the actionscript go into the mainMenu or the Gallery?

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    That's one way to do it (usin BitmapData). another easier way to smooth loaded images is to set the forceSmoothing property to true available since player9.

    If you use the MovieClipLoader, you can set it in the onLoadInit.

    gapris

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    73
    Excellent. That's much easier . Thanks Gparis

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center