dcsimg
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: XML _level layering help

  1. #1
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315

    XML _level layering help

    Hello Everyone. I'm in the process of creating an online tutorial for a client. I'm trying to build and SWF that calls other SWFs using XML. So far I've been rather successful - however, when my XML calls a SWF file, the current SWF stops playing.

    Here's the code i need to layer:

    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    
    
    // Fade functions
    function fadeIn(){
    var the_tween:Object;
    the_tween = new Tween(container, "_alpha", Regular.easeOut, 0, 100, 1, true);
    }
    function fadeOut(){
    var the_tween:Object;
    the_tween = new Tween(container, "_alpha", Regular.easeOut, 100, 0, 1, true);
    }
    
    // Load XML
    function loadXML(loaded) {
    	if (loaded) {
    		xmlNode = this.firstChild;
    		swiff = [];
    		total = xmlNode.childNodes.length;
    		for (i=0; i<total; i++) {
    			swiff[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    		}
    		firstswiff();
    		} 
    	else {
    		content = "ERROR: Not loaded!";
    	}
    }
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("http://brian/rss/xml/call_for_barrel_winner.xml");
    // End of xml
    
    my_loader = new MovieClipLoader();
    my_loader.addListener(this);
    function onLoadInit(mc:MovieClip) {
    	preloader._visible = false;
    }
    function onLoadProgress(container, bL, bT){
    	perc = Math.round((bL/bT)*100);
    	container_txt.text = perc+" %";
    	preloader._visible = true;
    }
    var k:Number = 0;
    
    function firstswiff(){
    	my_loader.loadClip(swiff[k], container);
    	fadeIn();
    }

    Any help is appreciated. I'm a total newbie when it comes to XML

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    impossible to test

    output in Flash =

    Error opening URL "http://brian/rss/xml/call_for_barrel_winner.xml"
    Variable _level0.content = "ERROR: Not loaded!"


    output in browser (calling the xml file) =

    Internet Explorer cannot display the webpage

  3. #3
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Ok - I've uploaded the files to an outsite site:

    http://www.intromotion.com/rss/videos/test.html
    http://www.intromotion.com/rss/videos/test.fla (to view the file)

    Videos pulling content:
    http://www.intromotion.com/rss/video...l_winner1.html
    http://www.intromotion.com/rss/video...el_winner1.fla (to view file)

    http://www.intromotion.com/rss/videos/news_ticker9.html
    http://www.intromotion.com/rss/videos/news_ticker9.fla (to view file)

    ----------------------------------------

    You can see where on the [test.html] - the "ticker" is disappearing when I go to call the "barrel" winner....

    Am I missing a level value???

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    hmmm .. first off, drag Layer named - "container"
    to the bottom-most Layer of your fla file

    (as it is the top-most Layer it will always cover
    the Layers below it [and their content] )

  5. #5
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    http://www.intromotion.com/rss/videos/test2.html

    That just pushed everything back.... the first xml still disapears when the second one loads...

    I've been looking around for a solution for days on this. There must be a way?

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    in test.fla, xmlData loads as - http://brian/rss/videos/news_ticker9.swf
    which feeds the array as -

    _level0.swiff = [object #25, class 'Array'] [
    0:"http://brian/rss/videos/news_ticker9.swf"

    as i previously stated, it is not a valid url from here.

    i simply loaded it to a level in the player session -
    PHP Code:
    // You cand resize this to any dimension but be sure the container movieclip is placed at x=o/y=0
    // Your swf files shoul be the same dimension as the main swf(this one)
    // Make sure you call the nextswf function at the end of each external swf. Use this code _root.nextswf();
    // Need help? Contact me at bogdan@codelines.ro
    // Enjoy using this file! Be creative! :)



    import mx.transitions.Tween;
    import mx.transitions.easing.*;


    // Fade functions
    function fadeIn(){
    var 
    the_tween:Object;
    the_tween = new Tween(container"_alpha"Regular.easeOut01001true);
    }
    function 
    fadeOut(){
    var 
    the_tween:Object;
    the_tween = new Tween(container"_alpha"Regular.easeOut10001true);
    }

    // Load XML
    function loadXML(loaded) {
        if (
    loaded) {
            
    xmlNode this.firstChild;
            
    swiff = [];
            
    total xmlNode.childNodes.length;
            for (
    i=0i<totali++) {
                
    swiff[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            }
            
    firstswiff();
            } 
        else {
            
    content "ERROR: Not loaded!";
        }
    }
    xmlData = new XML();
    xmlData.ignoreWhite true;
    xmlData.onLoad loadXML;
    xmlData.load("http://www.intromotion.com/rss/xml/call_for_ticker.xml");
    // End of xml

    my_loader = new MovieClipLoader();
    var 
    mclListener:Object = new Object();
    my_loader.addListener(mclListener);

    function 
    onLoadInit(mc:MovieClip) {
        
    preloader._visible false;
    }
    function 
    onLoadProgress(containerbLbT){
        
    perc Math.round((bL/bT)*100);
        
    container_txt.text perc+" %";
        
    preloader._visible true;
    }
    var 
    k:Number 0;

    p1 "http://www.intromotion.com/rss/videos/barrel_winner1.swf";

    function 
    firstswiff(){
        
    //my_loader.loadClip(swiff[k], container);
        
    my_loader.loadClip(p1container);
        
    fadeIn();
    };

    p2 "http://www.intromotion.com/rss/videos/news_ticker9.swf";
    loadMovieNum(p2,10); 

  7. #7
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Ok - that works, however the SWF's need to be controlled by the XML. So for example if I change the barrel XML to point to no SWF the swf won't play the barrel. So I guess I'm trying to layer the XML. Would changing the SWF to XML work?

  8. #8
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Maybe adding an additional container?? OR Layering the container??? Would that work??

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    can only suggest you try the loadMovieNum method
    that i used in your file - loadMovieNum(p2,10);

    this loads the movie (referenced as p2) into _level10

    the master movie always sits on _level0.

    make all movies the same stage dimension, and load
    to different levels (much like the skins on an onion)

    to remove p2, use unloadMovieNum(10)

  10. #10
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Modified Dog. Thank you for your suggestings, but I think my problem lies in creating and leveling multiple containers.

    So far i have got the second contianer to work. Any suggestions there?

  11. #11
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Modified Dog. I resoved the issue by layering additional containers.
    http://www.intromotion.com/rss/video...22808_1_21.htm

    Thank you for your help!!

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