A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Empty MC loading images via XML

  1. #1
    Animator
    Join Date
    Jan 2001
    Location
    Dubai
    Posts
    200

    Empty MC loading images via XML

    Hi everyone

    I have a main file which calls the external SWF file on mouse over actions.

    Within those External SWFs the images are coming through the XML file one by one. Each time the movie clip which was empty initially, loads the image from the local folder according to the path coming from the XML, but how can i show the loading bar before each image loads so in this way even if some one is using low bandwidth internet speed he can see atleast some loading bar instead of blank area.

    I have attached the files in a zip folder so that any one can understand the whole thing. Any help would be really appreciated.

    Thanks
    F.
    Attached Files Attached Files
    fahad.bhatti@gmail.com
    I won't change directions and i won't change my mind, How much difference does it made?

  2. #2
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    I didn't had a look into your zip file,
    but i guess you will most likely want to use the MovieClipLoader class..
    Here a simple example how to track loaded bytes from Flash Help:
    Code:
    var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var listener:Object = new Object();
    listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
        trace(target + ".onLoadProgress with " + bytesLoaded + " bytes of " + bytesTotal);
    }
    listener.onLoadInit = function(target:MovieClip):Void {
        trace(target + ".onLoadInit");
    }
    mcLoader.addListener(listener);
    mcLoader.loadClip("http://www.w3.org/Icons/w3c_main.png", container);
    My letters on the F1 key have faded, how are yours today?

  3. #3
    Animator
    Join Date
    Jan 2001
    Location
    Dubai
    Posts
    200

    I attempt..but couldnt get it done :(

    Hi McUsher

    I have applied your code on a blank frame of a blank Flash file and gave the URL of a high res image online, even after that upload when i check online i couldnt see anything for a minute then i recieve the image at once.

    I am attaching the code on which i am loading the "galeria.XML" file which sends the path for images in an MC instance named "imagem", Please check if you could apply the loading bar in that "imagem" so that it shows some loading progress while the image is loading. Your help will be really appreciated.

    Here is the code:

    Code:
    System.useCodepage = true;
    if (i < 0) { 
    i = 0
    }
    var meuXML:XML = new XML();
    meuXML.load("galeria.xml");
    meuXML.ignoreWhite = true;
    meuXML.onLoad = function(){
      img = this.childNodes[i].childNodes[0].childNodes 
      texto1.text = this.childNodes[i].childNodes[1].childNodes 
      fidi.text = this.childNodes[i].childNodes[2].childNodes
      cont = this.childNodes.length; 
      loadMovie(img, "imagem"); 
    } 
    if ( i == cont){
    i = i-1
    }
    and here is the code in galeria.XML file:

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    
    <FOTO>
    <imagem>music/foto01.jpg</imagem>
    <texto>FOTO 01</texto>
    <texto2>KIMI GONZALEZ1</texto2>
    </FOTO>
    
    <FOTO>
    <imagem>music/foto02.jpg</imagem>
    <texto>FOTO 02</texto>
    <texto2>U2 Baby</texto2>
    </FOTO>
    
    <FOTO>
    <imagem>music/foto03.jpg</imagem>
    <texto>FOTO 03</texto>
    <texto2>KIMI GONZALEZ3</texto2>
    </FOTO>
    fahad.bhatti@gmail.com
    I won't change directions and i won't change my mind, How much difference does it made?

  4. #4
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Please hand me your project (fla+ images+ xml) and i'll code it for
    you this evening..

    Btw. your XML is not valid... on root level there is only one node allowed in xml
    you have 3 root nodes..
    My letters on the F1 key have faded, how are yours today?

  5. #5
    Animator
    Join Date
    Jan 2001
    Location
    Dubai
    Posts
    200

    Project file.

    Hi Mc
    I have uploaded the project.zip file at : http://www.pepsuae.com/fahad/project.zip

    I really appreciate your help and support.

    You will see a button in flash file "MUSIC.FLA". That button showuld have the urls on its GETURL action coming from the XML file along with each record, can you do that as well please. In this way everything will be solved and my project will be finished technically.

    Salute & Best Regards
    F.
    fahad.bhatti@gmail.com
    I won't change directions and i won't change my mind, How much difference does it made?

  6. #6
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Here is a simple implementation of the above code,
    i hope you can read it

    (i removed the camera.png for smaller upload )
    Attached Files Attached Files
    My letters on the F1 key have faded, how are yours today?

  7. #7
    Animator
    Join Date
    Jan 2001
    Location
    Dubai
    Posts
    200
    Thanks mate, i have checked the file you sent but it is not showing any loading for the images, or maybe i have messed up with the fla file again, if i couldnt manage with the images loader thing then iw ill keep them wihtout it as before coz they will be very small in size anyways.

    But teh other thing which i am stuck out now is the URL of the button in flash to be changed according to the XML file, Can you do any help in that as well please?

    Regards
    F.
    fahad.bhatti@gmail.com
    I won't change directions and i won't change my mind, How much difference does it made?

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