A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Checking for frame loaded?

  1. #1
    gotta bounce solomatrix's Avatar
    Join Date
    Mar 2002
    Location
    Naptown
    Posts
    225

    Checking for frame loaded?

    The first frame of my swf contains a lot of xml stuff that it gets out of a db. When it's done with that I need it to goto frame 10.

    Right now at the bottom of the as in frame 1 I have gotoAndPlay(10). The problem is that 10 loads text before 1 is done with xml stuff so the text gets whited out with a function thats in 1.

    Is there a way with "_framesloaded" that I can make sure it's loaded before going to 10?

    Thanks
    Solo

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You can create an empty movie with an empty movieclip first where you load your main movie in. Once your main movie is loaded into the movieclip you can have a loadMovieNum function to replace the whole empty movie with your main movie. I made a preloader component which can do that.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Feb 2003
    Posts
    825
    My understanding is that the SWF will not start playing until frame 1 is loaded...so since you are calling the XML dynamically, Flash thinks that frame 1 is fully loaded, even though the XML is still being read...my suggestion would be to put a stop action on frame 1. then have the viewer begin the movie on button press...

  4. #4
    gotta bounce solomatrix's Avatar
    Join Date
    Mar 2002
    Location
    Naptown
    Posts
    225
    Cancer - I dont really see how that would help my frame (and I couldn't do it anyways with how I have it set up thus far). Looking for an AS way out of this.

    Iguana - that's how I have it set up now, but my boss wants it to default to frame 10 and I have to load frame 1 first.

    Appreciate the help.

    I just inserted a time delay of 2 seconds before it goes to frame 10 and that works for now. I'm just afraid if the db gets bogged down that 2 seconds might not be long enough.

    Any other suggestions welcome.
    Solo

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    try something like-
    frame1 -

    stop();
    myxml = new XML();
    myxml.load(url);
    myxml.onLoad = function(){
    gotoAndPlay(10);
    }

    hth

  6. #6
    gotta bounce solomatrix's Avatar
    Join Date
    Mar 2002
    Location
    Naptown
    Posts
    225
    That would work except for I use "urlxml = new xml();" more than once so it wont work if i just stick
    Code:
    stop();
    
    urlxml.onLoad = function(){
    	gotoAndPlay(8);
    }
    at the end.

    Here's what I'm workin with:
    code:
    function changecolor(btn_name, thecolor, thealpha) {
    myColor = new Color(eval("_root."+btn_name));
    myColor.setRGB(thecolor);
    eval(btn_name)._alpha=thealpha;
    }

    //XML DATA GATHERING BEGIN
    urlXML = new XML();
    //when the xml data has loaded, we want the XML Object to run the convertXML function
    urlXML.onLoad = convertXML;
    //strip out formatting - otherwise, it will count formatting as an element.
    urlXML.ignoreWhite = true;
    urlXML.load("http://helpdesk/shared/beta/xmlloc.asp?siteid="+strSiteID);

    function convertXML() {
    var Root = this.childNodes[0];
    var arrRooms = Root.childNodes;
    for (i=0; i<=arrRooms.length-1; i++) {
    var templid = arrRooms[i].childNodes[0].nodeValue;
    var thebutton = "btn_"+templid;
    var thetext = "txt_"+templid;
    var thecolor = "0xffffff";
    eval(thetext).text = "";
    _root.changecolor(thebutton,thecolor,10);
    }
    }
    function whiteout() {
    urlXML = new XML();
    urlXML.onLoad = doWhiteOutXML;
    urlXML.ignoreWhite = true;
    urlXML.load("http://helpdesk/shared/beta/xmlloc.asp?siteid="+strSiteID);

    function doWhiteOutXML() {
    var Root = this.childNodes[0];
    var arrRooms = Root.childNodes;
    for (i=0; i<=arrRooms.length-1; i++) {
    var templid = arrRooms[i].childNodes[0].nodeValue;
    var thebutton = "btn_"+templid;
    var thetext = "txt_"+templid;
    var thecolor = "0xffffff";
    eval(thetext).text = "";
    _root.changecolor(thebutton,thecolor,10);
    }
    }
    }
    //Defaults to room #'s

    //Creates delay before displaying rm #
    //Without delay text from frame 10 gets whited out
    //function delay(){
    // gotoAndPlay(8);
    // clearInterval(timer);
    //}

    //Sets delay at 2 seconds
    //timer = setInterval(delay, 2000);

    stop();

    urlxml.onLoad = function(){
    gotoAndPlay(8);
    }

    Solo

  7. #7
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    as you have already created an onLoad function -
    urlXML.onLoad = convertXML;
    why not, -

    function convertXML() {
    // other code
    gotoAndPlay(8);
    }

    does this 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