35 Replies Latest reply on Oct 24, 2010 8:03 AM by Jonas Philippon

    XML shows in Flash, but doesn't show on server?

    Jonas Philippon

      Hello.

       

      I have a Flash website with 5 sections (Featured Work, News, About Me, Services, Contact). All the sections works fine, both in Flash and on the server, if the content isn't loaded from XML. But in the News section i use XML for loading the news.

       

      If i test my movie in flash, the whole site works fine, and the XML News works perfect. But if i test the movie in a virtual server (like MAMP) or if i test it on my own server, the news section doesn't show.

       

      I can't seem to find the problem?

       

      Jonas Philippon

        • 1. Re: XML shows in Flash, but doesn't show on server?
          kglad Adobe Community Professional & MVP

          usually that's caused by a case mis-match (like trying to load yourxml.XML instead of yourxml.xml) or a cross-domain security issue.

           

          if you upload your files to a public server, you can get more help if the above isn't enough.

          • 2. Re: XML shows in Flash, but doesn't show on server?
            Jonas Philippon Level 1

            hmm, i'm not sure i know what you mean. I can't seem to find any path problems in my movie or in my XML or XMLLoader.

            • 3. Re: XML shows in Flash, but doesn't show on server?
              kglad Adobe Community Professional & MVP

              upload to a public server for further help.

              • 4. Re: XML shows in Flash, but doesn't show on server?
                Jonas Philippon Level 1

                Uploaded to www.philippondesign.com

                • 5. Re: XML shows in Flash, but doesn't show on server?
                  kglad Adobe Community Professional & MVP

                  is there some reason you're tracing 0 repeatedly?

                   

                  and what code is used for news?

                  • 6. Re: XML shows in Flash, but doesn't show on server?
                    Jonas Philippon Level 1

                    What do you mean? i am tracing the buttonclick?

                     

                     

                    News:

                     

                    import com.greensock.TweenLite;

                     

                    // NEWS CONTAINER

                    var NewsContainer:Sprite = new Sprite;

                    NewsContainer.y = -NewsContainer.height-stage.stageHeight/2;

                    addChild(NewsContainer);

                     

                    // NEWS ARRAY

                    var NewsArray:Array = new Array( );

                     

                    // XML

                    var MT2:MovieClip = MovieClip(this.parent);

                    var NewsHeight:Number = 0;

                     

                    // DYNAMIC XML LOOP

                    for(var k:Number=0;k<MT2.newsNum;k++) {

                     

                    var newsItem:NewsItem = new NewsItem;

                     

                    // XML INPUT

                    newsItem.NewsTitle.text = MT2.newsTitle[MT2.newsNum-1-k];

                    newsItem.NewsInfo.text = MT2.newsInfo[MT2.newsNum-1-k];

                    newsItem.NewsContent.text = MT2.newsContent[MT2.newsNum-1-k];

                     

                    trace(newsItem.NewsContent.textHeight);

                     

                    // POSITIONING

                    if(k>0) {

                    newsItem.y = NewsHeight;

                    }

                     

                    NewsArray.push(newsItem);

                     

                    NewsContainer.addChild(newsItem);

                     

                    NewsHeight += newsItem.NewsContent.textHeight+120;

                    trace(k + " " + NewsHeight);

                    }

                     

                    // VERTICLE SCROLLING

                     

                    stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollNews);

                     

                    function scrollNews(evt:MouseEvent):void {

                     

                    TweenLite.to(NewsContainer, 0.5, { y:-(stage.mouseY/stage.stageHeight)*NewsContainer.height + NewsHeight/2});

                    trace(-(stage.mouseY/stage.stageHeight)*NewsContainer.height);

                    }

                     

                    // MAIN NEWS CONTAINER

                    var MainNewsContainer:Sprite = new Sprite;

                    addChild(MainNewsContainer);

                    MainNewsContainer.addChild(NewsContainer);

                     

                    // ADDING LISTENERS

                    stage.addEventListener(Event.RESIZE, NewsonStageResize);

                    addEventListener(Event.ENTER_FRAME, NewsonFrame);

                     

                    // STAGE RESIZE FUNCTION //

                    // ===================== //

                    function NewsonStageResize(evt:Event):void {

                     

                    //POSITION CONTENT

                    var NewsstagePoint:Point = new Point(stage.stageWidth/2-MainNewsContainer.width/2, (stage.stageHeight-60)/2-MainNewsContainer.height/2);

                    var NewstargetPoint:Point = this.globalToLocal(NewsstagePoint);

                    MainNewsContainer.x = NewstargetPoint.x;

                    MainNewsContainer.y = NewstargetPoint.y;

                    }

                     

                    // ENTER FRAME EVENT FUNCTION //

                    // ========================== //

                    function NewsonFrame(evt:Event):void {

                     

                    //POSITION CONTENT

                    var NewsstagePoint:Point = new Point(stage.stageWidth/2-MainNewsContainer.width/2, (stage.stageHeight-60)/2-MainNewsContainer.height/2);

                    var NewstargetPoint:Point = this.globalToLocal(NewsstagePoint);

                    MainNewsContainer.x = NewstargetPoint.x;

                    MainNewsContainer.y = NewstargetPoint.y;

                    }

                     

                    stop();

                    • 7. Re: XML shows in Flash, but doesn't show on server?
                      kglad Adobe Community Professional & MVP

                      that code is attached to a frame, correct?  and you have a listener attached to your news button that directs your timeline to that frame, correct?

                       

                      if yes and yes, make sure nothing is causing that frame to repeatedly play and change your code to the following and upload:

                       


                       

                       

                      import com.greensock.TweenLite;

                       

                      trace("frame",this.currentFrame);

                       

                      // NEWS CONTAINER

                      var NewsContainer:Sprite = new Sprite();

                      NewsContainer.y = -NewsContainer.height-stage.stageHeight/2;

                      addChild(NewsContainer);

                       

                      // NEWS ARRAY

                      var NewsArray:Array = new Array( );

                       

                      // XML

                      var MT2:MovieClip = MovieClip(this.parent);

                      var NewsHeight:Number = 0;

                       

                      // DYNAMIC XML LOOP

                      trace("A",MT2.newsNum)

                       

                      for(var k:Number=0;k<MT2.newsNum;k++) {

                       

                      var newsItem:NewsItem = new NewsItem();

                       

                      // XML INPUT

                      newsItem.NewsTitle.text = MT2.newsTitle[MT2.newsNum-1-k];

                      newsItem.NewsInfo.text = MT2.newsInfo[MT2.newsNum-1-k];

                      newsItem.NewsContent.text = MT2.newsContent[MT2.newsNum-1-k];

                       

                       

                      // POSITIONING

                      if(k>0) {

                      newsItem.y = NewsHeight;

                      }

                       

                      NewsArray.push(newsItem);

                       

                      NewsContainer.addChild(newsItem);

                       

                      NewsHeight += newsItem.NewsContent.textHeight+120;

                      //trace(k + " " + NewsHeight);

                      }

                       

                      // VERTICLE SCROLLING

                       

                      stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollNews);

                       

                      function scrollNews(evt:MouseEvent):void {

                       

                      TweenLite.to(NewsContainer, 0.5, { y:-(stage.mouseY/stage.stageHeight)*NewsContainer.height + NewsHeight/2});

                      trace(-(stage.mouseY/stage.stageHeight)*NewsContainer.height);

                      }

                       

                      // MAIN NEWS CONTAINER

                      var MainNewsContainer:Sprite = new Sprite;

                      addChild(MainNewsContainer);

                      MainNewsContainer.addChild(NewsContainer);

                       

                      // ADDING LISTENERS

                      stage.addEventListener(Event.RESIZE, NewsonStageResize);

                      addEventListener(Event.ENTER_FRAME, NewsonFrame);

                       

                      // STAGE RESIZE FUNCTION //

                      // ===================== //

                      function NewsonStageResize(evt:Event):void {

                       

                      //POSITION CONTENT

                      var NewsstagePoint:Point = new Point(stage.stageWidth/2-MainNewsContainer.width/2, (stage.stageHeight-60)/2-MainNewsContainer.height/2);

                      var NewstargetPoint:Point = this.globalToLocal(NewsstagePoint);

                      MainNewsContainer.x = NewstargetPoint.x;

                      MainNewsContainer.y = NewstargetPoint.y;

                      }

                       

                      // ENTER FRAME EVENT FUNCTION //

                      // ========================== //

                      function NewsonFrame(evt:Event):void {

                       

                      //POSITION CONTENT

                      var NewsstagePoint:Point = new Point(stage.stageWidth/2-MainNewsContainer.width/2, (stage.stageHeight-60)/2-MainNewsContainer.height/2);

                      var NewstargetPoint:Point = this.globalToLocal(NewsstagePoint);

                      MainNewsContainer.x = NewstargetPoint.x;

                      MainNewsContainer.y = NewstargetPoint.y;

                      }

                       

                      stop();

                      • 8. Re: XML shows in Flash, but doesn't show on server?
                        Jonas Philippon Level 1

                        Yes. i have i navigation layer with SWFAddress that changes between 6 frames (sections) in a movieclip.

                         

                        And it is uploaded now.

                        • 9. Re: XML shows in Flash, but doesn't show on server?
                          kglad Adobe Community Professional & MVP

                          MT2.newsNum is not defined correctly.  to debug, you can start with:

                           

                           

                          trace(MT2.newsNum,Number(MT2.newsNum))

                          • 10. Re: XML shows in Flash, but doesn't show on server?
                            Jonas Philippon Level 1

                            woow thank you..

                             

                            But i don't get a specific error? Is the error in my movie or in my XMLLoader.as?

                             

                            It traces to 5 5, which is right, i have 5 news?

                            • 11. Re: XML shows in Flash, but doesn't show on server?
                              kglad Adobe Community Professional & MVP

                              then you put that last trace()

                               

                              1. out of scope or of where it's used (in your for-loop) or

                               

                              2. out of sync of when it's needed in that for-loop.

                               

                              if you don't understand how to fix the error with that info, show the code where you put your trace() and explain how that code is related to your for-loop that fails.

                              • 12. Re: XML shows in Flash, but doesn't show on server?
                                Jonas Philippon Level 1

                                I'm sorry to sound so stupid, but this is new to me.

                                 

                                I tried pasting the trace(MT2.newsNum,Number(MT2.newsNum)) in both out and in the for loop, and i still get the same trace "5 5"

                                 

                                I'm not really sure what to do, so i'll just try explaining my whole site to you:

                                 

                                I have my "main.fla" with three layers with actionsscript:

                                 

                                - Navigation Actions

                                     - Has a for loop that creates 6 textfields with clickevents and SWFAddress that changes between 6 frames in a MovieClip (SubNavBar).
                                - Positioning Actions
                                     - Positions the textfield buttons, the navigation bar, and the sub navigation bar in the SubNavBar movieclip, and places my dynamic background.
                                - XML
                                     - I can't explain the XML layer, so i have attached it.
                                The SubNavBar MovieClip has 6 frames. The 1 is empty, so the site is clear at first. In frame 2, 4 and 6 there is a for loop like in the navigation layer, so these layers have a sub navigation bar, that once again changes between some frames in a movieclip.
                                In frame 3 their is the news code i pasted earlier, and in frame 5 there isn't anything yes, but it should just be graphics.
                                XML LAYER:
                                ----------------------------------
                                // XML LISTS //
                                // ========= //
                                var newsTitle:XMLList;
                                var newsInfo:XMLList;
                                var newsContent:XMLList;
                                var newsTitleArray:Array;
                                var newsInfoArray:Array;
                                var newsContentArray:Array;
                                // NUMBER OF ITEMS
                                var newsNum:Number;
                                // LOAD XML //
                                // ======== //
                                var xml:XMLLoader = new XMLLoader(this,"data.xml");
                                // function called when XML is loaded
                                function getXML(xmlData:XML):void {
                                // STORING RELEVANT DATA INTO LISTS FOR LATER ACCESS //
                                newsTitle = xmlData.news.article.title;
                                newsInfo = xmlData.news.article.info;
                                newsContent = xmlData.news.article.content;
                                newsNum = newsTitle.length();
                                    newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ;
                                newsTitleArray.reverse();
                                newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ;
                                newsInfoArray.reverse();
                                newsContentArray = xmlData.news.article.content.text().toXMLString().split("\n") ;
                                newsContentArray.reverse();
                                }
                                ----------------------------------
                                In the folder i have uploaded to my server, i have following:
                                - AC_RunActiveContent.js

                                 

                                - Background.png (main background)

                                 

                                - com (folder) (GreenSock)

                                 

                                - data.xml

                                 

                                - index.html

                                 

                                - js (folder) (SWFAddress)

                                 

                                - mailer.php (Contact Form)

                                 

                                - main.fla

                                 

                                - main.swf

                                 

                                - media (folder) (Pictures For Background)

                                 

                                - Mosaic.swf (Mosaic Overlay For Background)

                                 

                                - P-Logo.png

                                 

                                - preview.swf (Background)

                                 

                                - SWFAddress.as

                                 

                                - SWFAddressEvent.as

                                 

                                - textLayout_1.0.0.595.swz

                                 

                                - xml (folder) (xml config for background) (SEPERATE FLA FILE (NOT A PROBLEM)

                                 

                                - XMLLoader.as
                                ----------------------------------
                                The XMLLoader.as is the file that loads my data.xml. The data.xml has the text to my news section.
                                XMLLoader.as:
                                ----------------------------------
                                package {
                                import flash.events.IOErrorEvent;
                                import flash.net.URLLoader;
                                import flash.net.URLRequest;
                                import flash.events.Event;
                                import flash.display.Sprite;
                                import flash.display.MovieClip;
                                public class XMLLoader extends Sprite {
                                private var loader:URLLoader = new URLLoader();
                                public var loadedXML:XML;
                                // accept parent path to xml
                                public function XMLLoader(mT:MovieClip, path:String):void {
                                // LOADING XML //
                                // =========== //
                                loader.load(new URLRequest(path));
                                loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
                                loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
                                function onComplete(evt:Event):void {
                                loadedXML = new XML(evt.target.data);
                                loader.removeEventListener(Event.COMPLETE, onComplete);
                                loader.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
                                // Run getXML function from where this clas was instantiated
                                mT.getXML(loadedXML);
                                }
                                function onIOError(evt:IOErrorEvent):void {
                                trace("Error: " + evt.text);
                                }
                                }
                                }
                                }
                                I hope this helps you? I hope you now can give me more specific help?
                                • 13. Re: XML shows in Flash, but doesn't show on server?
                                  kglad Adobe Community Professional & MVP

                                  what are you doing to ensure your xml has completed loading MT2.newsNum is defined BEFORE that for-loop starts executing????

                                  • 14. Re: XML shows in Flash, but doesn't show on server?
                                    Jonas Philippon Level 1

                                    Well, actually nothing. It isn't called before it is used here?

                                    • 15. Re: XML shows in Flash, but doesn't show on server?
                                      kglad Adobe Community Professional & MVP

                                      probably not.

                                       

                                      when you test locally, your xml is loading fast enough it's probably defined when your for-loop executes and everything works.  online, it's not loading fast enough.

                                       

                                      you need to do something to ensure that for-loop does not execute until your xml completes loading and is parsed.

                                      • 16. Re: XML shows in Flash, but doesn't show on server?
                                        Jonas Philippon Level 1

                                        Hmm, how and where should i do that?

                                        • 17. Re: XML shows in Flash, but doesn't show on server?
                                          kglad Adobe Community Professional & MVP

                                          it's not possible to say with the info you've supplied.

                                           

                                          where's the xml loading/parsing code and where's the for-loop code?  in particular, what's the relationship between the two locations (if it's not obvious)?

                                          • 18. Re: XML shows in Flash, but doesn't show on server?
                                            Jonas Philippon Level 1

                                            The for loop is in the news frame: main.fla --> SubNavBar --> frame 3.

                                             

                                            The XMLLoader.as is in the main folder, and the functions to call the XMLLoader is in a layer in the main.fla main stage? The code to all three things are posted earlier.

                                             

                                            I'm not sure this if this is the information your are looking for?

                                             

                                            I don't know if the XML is loaded up early, when the XML layer, is in the mainstage?

                                            • 19. Re: XML shows in Flash, but doesn't show on server?
                                              kglad Adobe Community Professional & MVP

                                              the code to load and parse your xml needs to execute before your timeline reaches frame 3.  i don't know how your timeline gets to frame 3 but if it does by playing frames 1 and 2 and then 3, you need your xml parsing code to be called on frame 1 or 2 and then your timeline needs to stop until parsing is complete.  only then can you proceed to frame 3.

                                              • 20. Re: XML shows in Flash, but doesn't show on server?
                                                Jonas Philippon Level 1

                                                Well the XML layer is on the main stage, and frame 3 is in a movieclip called from navigation layer also from the main stage, so the XML should already have loaded?

                                                • 21. Re: XML shows in Flash, but doesn't show on server?
                                                  kglad Adobe Community Professional & MVP

                                                  the xml loading code may have executed but that doesn't mean the file has completed loading and is parsed.  loading is asynchronous.  ie, your timeline won't stop advancing to wait for a file to complete loading.  loading can and does continue in the background while your swf continues.

                                                   

                                                  put a stop() in your xml layer and in your xml parseing function that executes AFTER loading is complete, direct your timeline to frame 3.

                                                  • 22. Re: XML shows in Flash, but doesn't show on server?
                                                    Jonas Philippon Level 1

                                                    hmm, didn't work s: are you sure this is the problem?

                                                     

                                                    maybe I i'm not doing it right?

                                                    • 23. Re: XML shows in Flash, but doesn't show on server?
                                                      kglad Adobe Community Professional & MVP

                                                      you have this and the traces are correct?  if yes, upload it.

                                                       

                                                       

                                                      import com.greensock.TweenLite

                                                       

                                                      trace("frame",this.currentFrame);

                                                       

                                                      // NEWS CONTAINER

                                                      var NewsContainer:Sprite = new Sprite();

                                                      NewsContainer.y = -NewsContainer.height-stage.stageHeight/2;

                                                      addChild(NewsContainer);

                                                       

                                                      // NEWS ARRAY

                                                      var NewsArray:Array = new Array( );

                                                       

                                                      // XML

                                                      var MT2:MovieClip = MovieClip(this.parent);

                                                      var NewsHeight:Number = 0;

                                                       

                                                      // DYNAMIC XML LOOP

                                                      trace(MT2.newsNum,Number(MT2.newsNum))

                                                       

                                                      for(var k:Number=0;k<MT2.newsNum;k++) {

                                                      var newsItem:NewsItem = new NewsItem();

                                                      // XML INPUT

                                                      newsItem.NewsTitle.text = MT2.newsTitle[MT2.newsNum-1-k];

                                                      newsItem.NewsInfo.text = MT2.newsInfo[MT2.newsNum-1-k];

                                                      newsItem.NewsContent.text = MT2.newsContent[MT2.newsNum-1-k];

                                                       

                                                      // POSITIONING

                                                      if(k>0) {

                                                      newsItem.y = NewsHeight;

                                                      }

                                                       

                                                      NewsArray.push(newsItem);

                                                      NewsContainer.addChild(newsItem);

                                                      NewsHeight += newsItem.NewsContent.textHeight+120;

                                                      //trace(k + " " + NewsHeight);

                                                      }

                                                       

                                                      // VERTICLE SCROLLING

                                                      stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollNews);

                                                       

                                                      function scrollNews(evt:MouseEvent):void {

                                                      TweenLite.to(NewsContainer, 0.5, { y:-(stage.mouseY/stage.stageHeight)*NewsContainer.height + NewsHeight/2});

                                                      trace(-(stage.mouseY/stage.stageHeight)*NewsContainer.height);

                                                      }

                                                      // MAIN NEWS CONTAINER

                                                      var MainNewsContainer:Sprite = new Sprite;

                                                      addChild(MainNewsContainer);

                                                      MainNewsContainer.addChild(NewsContainer);

                                                       

                                                      // ADDING LISTENERS

                                                      stage.addEventListener(Event.RESIZE, NewsonStageResize);

                                                      addEventListener(Event.ENTER_FRAME, NewsonFrame);

                                                       

                                                      // STAGE RESIZE FUNCTION //

                                                      // ===================== //

                                                       

                                                      function NewsonStageResize(evt:Event):void {

                                                      //POSITION CONTENT

                                                      var NewsstagePoint:Point = new Point(stage.stageWidth/2-MainNewsContainer.width/2, (stage.stageHeight-60)/2-MainNewsContainer.height/2);

                                                      var NewstargetPoint:Point = this.globalToLocal(NewsstagePoint);

                                                      MainNewsContainer.x = NewstargetPoint.x;

                                                      MainNewsContainer.y = NewstargetPoint.y;

                                                      }

                                                       

                                                      // ENTER FRAME EVENT FUNCTION //

                                                      // ========================== //

                                                       

                                                      function NewsonFrame(evt:Event):void {

                                                      //POSITION CONTENT

                                                      var NewsstagePoint:Point = new Point(stage.stageWidth/2-MainNewsContainer.width/2, (stage.stageHeight-60)/2-MainNewsContainer.height/2);

                                                      var NewstargetPoint:Point = this.globalToLocal(NewsstagePoint);

                                                      MainNewsContainer.x = NewstargetPoint.x;

                                                      MainNewsContainer.y = NewstargetPoint.y;

                                                      }

                                                      stop();

                                                      • 24. Re: XML shows in Flash, but doesn't show on server?
                                                        Level 1

                                                        hmmm, this post is useful for me.

                                                        • 25. Re: XML shows in Flash, but doesn't show on server?
                                                          Jonas Philippon Level 1

                                                          Yes, i do. It's uploaded now.

                                                          • 26. Re: XML shows in Flash, but doesn't show on server?
                                                            kglad Adobe Community Professional & MVP

                                                            both of those are still undefined.

                                                             

                                                            IF your xml code is in frame 1 of the main timeline and the code with the for-loop executes when the main timeline reaches frame 3, change your xml code to the following.  if something in the previous sentence is incorrect, explain when the xml code executes and when the for-loop code executes.

                                                             

                                                             

                                                             

                                                            // XML LISTS //
                                                            // ========= //
                                                            var newsTitle:XMLList;
                                                            var newsInfo:XMLList;
                                                            var newsContent:XMLList;
                                                            var newsTitleArray:Array;
                                                            var newsInfoArray:Array;
                                                            var newsContentArray:Array;
                                                            // NUMBER OF ITEMS
                                                            var newsNum:Number;
                                                            // LOAD XML //
                                                            // ======== //
                                                            var tl:MovieClip = this;
                                                            var xml:XMLLoader=new XMLLoader(this,"data.xml");
                                                            // function called when XML is loaded
                                                            function getXML(xmlData:XML):void {
                                                                // STORING RELEVANT DATA INTO LISTS FOR LATER ACCESS //
                                                                newsTitle=xmlData.news.article.title;
                                                                newsInfo=xmlData.news.article.info;
                                                                newsContent=xmlData.news.article.content;
                                                                newsNum=newsTitle.length();
                                                                newsTitleArray=xmlData.news.article.title.text().toXMLString().split("\n");
                                                                newsTitleArray.reverse();
                                                                newsInfoArray=xmlData.news.article.info.text().toXMLString().split("\n");
                                                                newsInfoArray.reverse();
                                                                newsContentArray=xmlData.news.article.content.text().toXMLString().split("\n");
                                                                newsContentArray.reverse();
                                                               tl.play();
                                                            }

                                                             

                                                            stop();

                                                            • 27. Re: XML shows in Flash, but doesn't show on server?
                                                              Jonas Philippon Level 1

                                                              My XML is loaded from a layer in the mainstage, but the loop where the XML is used, is in a movieclip on frame 3? The movieclip is called from another layer on the mainstage.

                                                              • 28. Re: XML shows in Flash, but doesn't show on server?
                                                                kglad Adobe Community Professional & MVP

                                                                if the for-loop is in a movieclip and that movieclip is on frame 3 of your main timeline, use the xml code i suggested.


                                                                • 29. Re: XML shows in Flash, but doesn't show on server?
                                                                  Jonas Philippon Level 1

                                                                  Well, My mainstage/maintimeline is only in frame one, but in different layers. So i guess it's in frame one the XMLloader is? So the xml is loaded from frame 1 on the mainstage, and the loop is in frame 3 of the movieclip?

                                                                  • 30. Re: XML shows in Flash, but doesn't show on server?
                                                                    kglad Adobe Community Professional & MVP

                                                                    i don't know where things are located in your fla.  you have to tell me.

                                                                     

                                                                    so, your xml code is on the main timeline frame 1?

                                                                     

                                                                    and your for-loop is on frame 3 of some movieclip (what's its instance name) and that movieclip is on frame 1 of your main timeline?

                                                                     

                                                                    (and, layers are irrelevant.  they don't even exist outside the authoring environment.)

                                                                    1 person found this helpful
                                                                    • 31. Re: XML shows in Flash, but doesn't show on server?
                                                                      Jonas Philippon Level 1

                                                                      this code is in the main timeline frame 1:

                                                                       

                                                                      // XML LISTS //

                                                                      // ========= //

                                                                      var newsTitle:XMLList;

                                                                      var newsInfo:XMLList;

                                                                      var newsContent:XMLList;

                                                                       

                                                                      var newsTitleArray:Array;

                                                                      var newsInfoArray:Array;

                                                                      var newsContentArray:Array;

                                                                       

                                                                      // NUMBER OF ITEMS

                                                                      var newsNum:Number;

                                                                       

                                                                      // LOAD XML //

                                                                      // ======== //

                                                                       

                                                                      var xml:XMLLoader = new XMLLoader(this,"data.xml");

                                                                       

                                                                      // function called when XML is loaded

                                                                      function getXML(xmlData:XML):void {

                                                                       

                                                                      // STORING RELEVANT DATA INTO LISTS FOR LATER ACCESS //

                                                                      newsTitle = xmlData.news.article.title;

                                                                      newsInfo = xmlData.news.article.info;

                                                                      newsContent = xmlData.news.article.content;

                                                                       

                                                                       

                                                                      newsNum = newsTitle.length();

                                                                       

                                                                          newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ;

                                                                      newsTitleArray.reverse();

                                                                       

                                                                      newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ;

                                                                      newsInfoArray.reverse();

                                                                       

                                                                      newsContentArray = xmlData.news.article.content.text().toXMLString().split("\n") ;

                                                                      newsContentArray.reverse();

                                                                      }

                                                                       

                                                                      The for loop, is in the movieclip "SubNavBar" on frame 3. Which is called by the SWFAddress, also on frame 1 in the main timeline.

                                                                      • 32. Re: XML shows in Flash, but doesn't show on server?
                                                                        kglad Adobe Community Professional & MVP

                                                                        what's SWFAddress and what do you mean by, SubNavBar is called by SWFAddress?

                                                                        • 33. Re: XML shows in Flash, but doesn't show on server?
                                                                          Jonas Philippon Level 1

                                                                          The SWFAddress code, is in frame 1 in the main timeline. I am using the SWFAddress to navigate through frame 1-6 in the MovieClip SubNavBar.

                                                                           

                                                                          The for loop is placed in frame 3 in the movieclip "SubNavBar".

                                                                          • 34. Re: XML shows in Flash, but doesn't show on server?
                                                                            kglad Adobe Community Professional & MVP

                                                                            SWFAddress doesn't call anything.  you may be routing events through swfaddress but its those events that trigger changes in your swf's state.

                                                                             

                                                                            anyway, SubNavBar shouldn't be play until your xml loads.  you can use:

                                                                             

                                                                            SubNavBar.stop();  // and nothing should make it play except below code:

                                                                             

                                                                             

                                                                            // XML LISTS //

                                                                            // ========= //

                                                                            var newsTitle:XMLList;

                                                                            var newsInfo:XMLList;

                                                                            var newsContent:XMLList;

                                                                             

                                                                            var newsTitleArray:Array;

                                                                            var newsInfoArray:Array;

                                                                            var newsContentArray:Array;

                                                                             

                                                                            // NUMBER OF ITEMS

                                                                            var newsNum:Number;

                                                                             

                                                                            // LOAD XML //

                                                                            // ======== //

                                                                             

                                                                            var xml:XMLLoader = new XMLLoader(this,"data.xml");

                                                                             

                                                                            // function called when XML is loaded

                                                                            function getXML(xmlData:XML):void {

                                                                             

                                                                            // STORING RELEVANT DATA INTO LISTS FOR LATER ACCESS //

                                                                            newsTitle = xmlData.news.article.title;

                                                                            newsInfo = xmlData.news.article.info;

                                                                            newsContent = xmlData.news.article.content;

                                                                             

                                                                             

                                                                            newsNum = newsTitle.length();

                                                                             

                                                                                newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ;

                                                                            newsTitleArray.reverse();

                                                                             

                                                                            newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ;

                                                                            newsInfoArray.reverse();

                                                                             

                                                                            newsContentArray = xmlData.news.article.content.text().toXMLString().split("\n") ;

                                                                            newsContentArray.reverse();

                                                                            SubNavBar.play();

                                                                            }

                                                                             

                                                                            1 person found this helpful
                                                                            • 35. Re: XML shows in Flash, but doesn't show on server?
                                                                              Jonas Philippon Level 1

                                                                              Sorry, my mistake.

                                                                               

                                                                              But i get your code, but it doesn't seem to work. When i'm testing it on my server, nothing is changed. And When i test it Flash, my SubNavBar plays when you enter the site, and is starting on frame 2? It's wierd, since it should stop at frame 1, so the site is empty from the beginning.