Loading XML kills stop() scripts in Symbol

Mark A.'s Avatar

Mark A.

05 Jan, 2011 05:34 PM

Ok this is gonna be hard to explain.
In simple steps:
- I start my context - I map my events - I instantiate my model and make it ready for injection - I add an event listener for a custom event to the model - I let the model load a xml file - in the listener function I dispatch an event that triggers a command that add the first view to the stage

Xml loading works, all commands get triggered in the right sequence.

What happens is when I wait for the xml file to be loaded and dispatch the event to bring the first view to the stage ALL stop(); calls in that view (in the first frame) are skipped.

If I dispatch the event that brings the view to the stage right after the model.loadXML(); function (in words: I do not wait for the xml file to be loaded)... the stop(); scripts WORK.

Why can loading a xml file influence the way a movieclip works? I'm really stuck here.

  1. 1 Posted by Mark A. on 05 Jan, 2011 06:20 PM

    Mark A.'s Avatar

    Ok, here are some additional informations:
    In my model, in the onXMLloaded() function if I do this:
    dispatchEvent(new ModelEvent(ModelEvent.MODEL_READY));

    the file does not work

    but if I do:
    TweenMax.delayedCall(0, dispatchEvent, [new ModelEvent(ModelEvent.MODEL_READY)]);

    everything works great. Why is a zero time(have a look at the '0') delay better than dispatching directly? Is the short time TweenMax needs to setup the objects for a no-time call enough to make a difference? Jezz I have no clue what is going on.

  2. 2 Posted by Weyert on 07 Jan, 2011 01:51 AM

    Weyert's Avatar

    I think delayedCall waits one frame. But I am not really sure.

  3. 3 Posted by Mark A. on 07 Jan, 2011 08:47 AM

    Mark A.'s Avatar

    Fair enough - but isnt it also true that loading xml might also need 1 frame - at least?

  4. 4 Posted by Weyert on 07 Jan, 2011 10:31 AM

    Weyert's Avatar

    Good question, I always assumed it's a blocking method the parsing of XML. I wouldn;t now.

  5. 5 Posted by Mark A. on 07 Jan, 2011 10:36 AM

    Mark A.'s Avatar

    Parsing yes - but loading is asynchronous by nature, isn't it? I tried it locally and on a server environment. If I trigger it after loading & parsing xml it's no more working. I will stick with my work around... feels wrong

  6. 6 Posted by Weyert on 07 Jan, 2011 12:35 PM

    Weyert's Avatar

    Yes, better. Always some silly workaround in Flash projects!

  7. Stray closed this discussion on 11 Feb, 2011 11:13 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac