×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Loading jpg, know when finish.

    PHP Code:
    var mc:MovieClip this.createEmptyMovieClip("mc"this.getNextHighestDepth());
    var 
    image:MovieClip mc.createEmptyMovieClip("image"mc.getNextHighestDepth());


    var 
    bolsaXML:XML = new XML();
    bolsaXML.ignoreWhite true;
    bolsaXML.onLoad = function(sucesso:Boolean):Void  {
        if (
    sucesso) {
            for (
    i=8i<9i++) {
                
    trace(bolsaXML.firstChild.firstChild.childNodes[i].nodeName);
                
    trace("   "+bolsaXML.firstChild.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue);
                
    image.loadMovie(bolsaXML.firstChild.firstChild.childNodes[i].childNodes[7].attributes.url);
            }
            
    setTimeout(pausa,150);
        } else {
            
    trace("-----ERRO-----");
        }
    };
    bolsaXML.load("http://services.sapo.pt/RSS/Feed/noticias/ambiente");

    function 
    pausa() {
        
    trace("Agoraaaaa...");
        
    image._width = (image._width*50)/image._height;
        
    image._height 50;

    With that code i load a XML and after using loadMovie i load an image. I want resize the image after it loaded.
    The solution that i found is just to use a timeout but i know that is not a good soltuion. How i know when the image was loaded? Sorry for my english

  2. #2
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: Loading jpg, know when finish.

    PHP Code:
    var mc:MovieClip this.createEmptyMovieClip("mc"this.getNextHighestDepth());
    var 
    image:MovieClip mc.createEmptyMovieClip("image"mc.getNextHighestDepth());


    var 
    bolsaXML:XML = new XML();
    bolsaXML.ignoreWhite true;
    bolsaXML.onLoad = function(sucesso:Boolean):Void  {
        if (
    sucesso) {
            for (
    i=8i<9i++) {
                
    teste_txt.text+=(bolsaXML.firstChild.firstChild.childNodes[i].nodeName+"\n");
                
    teste_txt.text+=("   "+bolsaXML.firstChild.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue);
                
    image.loadMovie(bolsaXML.firstChild.firstChild.childNodes[i].childNodes[7].attributes.url);
            }
        } else {
            
    trace("-----ERRO-----");
        }
    };
    bolsaXML.load("http://services.sapo.pt/RSS/Feed/noticias/ambiente");

    onEnterFrame = function () {
        if (
    _root.mc.image.getBytesLoaded() == _root.mc.image.getBytesTotal() && _root.mc.image.getBytesTotal()>0) {
            
    image._width = (image._width*50)/image._height;
            
    image._height 50;
            
    delete onEnterFrame;
        }
    }; 
    I just to use the getBytesTotal and getBytesLoaded... Now i think that is a good solution and what you think?

  3. #3
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: Loading jpg, know when finish.

    Hi there,

    Well that works, but you might like to use MovieClipLoader class. Here's how to use it.

    PHP Code:
    this.createEmptyMovieClip("image_mc"this.getNextHighestDepth());
    var 
    mclListener:Object = new Object();

    mclListener.onLoadComplete = function(target_mc:MovieClip) {
        
    // resize the image
        
    target_mc._width = (target_mc._width*50)/target_mc._height;
        
    target_mc._height 50;
    };

    var 
    image_mcl:MovieClipLoader = new MovieClipLoader();
    image_mcl.addListener(mclListener);
    image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg"image_mc); 
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  4. #4
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: Loading jpg, know when finish.

    thanks, after i had posted here i found an adobe Livedoc page with good information about MovieClipLoader class http://livedocs.adobe.com/flash/8/ma...=00002538.html

    Thanks,

Similar Threads

  1. Compilation series 60 3rd edition
    By asmobease in forum Symbian Tools & SDKs
    Replies: 32
    Last Post: 2006-09-13, 09:46
  2. Compilation series 60 3rd edition
    By asmobease in forum Symbian
    Replies: 3
    Last Post: 2006-09-10, 14:08
  3. loading jpg into emulator
    By nibss in forum Symbian
    Replies: 1
    Last Post: 2006-05-24, 05:56
  4. Syncronously jpg loading
    By kyomarja in forum Symbian
    Replies: 0
    Last Post: 2004-12-17, 10:48

Posting Permissions

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