A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [CS3]Call Function Bug

  1. #1
    wierd
    Join Date
    Sep 2008
    Posts
    46

    [CS3]Call Function Bug

    Hi all,

    I've got a problem in my Actionscript-Code(2.0).

    I've got 2 layers. One contains a movieclip, which contains a function.

    The other one contains a AS-Code which calls this function.

    If I use this code the function is called correctly.
    Code:
    function loadXML(loaded){
    	if (loaded){
    		_root.test_mc.test_function("hello");
    	}
    	else{
    		trace("file not loaded!");
    	}
    }
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("test.xml");
    but if I delete the XML-part the function wouldn't be called.

    Code:
    _root.test_mc.test_function("hello");
    Does anyone have an answer?

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    This may be nothing, but try moving your function from your mc to adding it just below all your xmlData info. It's a good rule of thumb to keep all the code together, and it's a good habit to get into especially if you're planning on moving to AS3.
    Last edited by Robb@exo; 11-21-2008 at 09:07 AM.
    Wile E. Coyote - "Clear as mud?"

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