A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Calling Frame Label in Main Movie?

  1. #1
    Member
    Join Date
    Apr 2008
    Location
    Indianapolis, IN
    Posts
    75

    Calling Frame Label in Main Movie?

    I have a main movie and a sidebar movie within it. In the sidebar movie, there is a tab that will insert text from an XML document based on the location of the playhead in the main timeline. I was thinking there must be some way to do an 'if else' statement to have the sidebar movieclip look for the playhead location in the main movie and get the appropriate child node based on that. However, I am not experienced enough in AS3, and I don't think I'm writing the function correctly. Here is the code, but there is also a link to the file I'm working with in case this code doesn't make sense:
    PHP Code:
    function LoadXML(e:Event):void {
        
    xmlData = new XML(e.target.data);
        var 
    Intro01txt:String xmlData.scriptText[0].narration.text();
        var 
    Intro02txt:String xmlData.scriptText[1].narration.text();
        
        
    script_txt.text Intro01txt;
        
        
    //once I add this code in I get the TypeError 1010
        
    if ((root as MovieClip).currentLabel == "Intro 02") {
            
    //do I need to unload the Intro01txt first somehow?
            
    script_txt.text Intro02txt;
        }
        
        
    //Tried to do a switch case here, but I don't think this was the right way to do it.  Plus, nothing happens when I use this code.
        /*    
                  var frameLabel:String = (root as MovieClip).currentLabel();

                  switch(frameLabel){
            case "Intro 01":
                script_txt.text = xmlData.scriptText[0].narration.text();
                break;
            case "Intro 02":
                script_txt.text = xmlData.scriptText[1].narration.text();
                break;
        }*/

    Here is the file I am working with . Any ideas to point me in the right direction? Any help or guidance would be greatly appreciated.

    Thanks!

  2. #2
    Member
    Join Date
    Apr 2008
    Location
    Indianapolis, IN
    Posts
    75
    I'm still working with this and I still keep getting the:

    TypeError: Error #1010: A term is undefined and has no properties.
    at mcSidebar/LoadXML()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    I tried moving the else if statements to the button instead of the loadXML event, but I still get the same errors. I'm trying to have the code inside the Sidebar movieclip to check the location of the playhead in the main movieclip and call up the appropriate XML info based on that. This seems like it should be possible to do, but I can't figure it out. Does anyone have any ideas or tips? Thanks.

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