dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic Buttons from XML

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    218
    I'm duplicating movieclips with buttons inside them. I want the buttons to be assigned a dynamic getURL based on a value from XML. Does anyone know of or have a solution for this before I reinvent the wheel?

    Here's what I've come up with so far:

    Code:
    // Do duplication of movieclip with button on its timeline
    yourMovie.duplicateMovieClip("movie"+cClipCount, aNumber);
    for (i=0; i<=anArray.length; i++) {
    	// Assign an action dynamically to the button inside the movieclip with a handler??
    	this["movie"+cClipCount].onRelease = function() {
    		loadMovie("images/" + fileName[i] + ".jpg", _root.JPGtarget);
    	}
    }

  2. #2
    Junior Member
    Join Date
    Aug 2002
    Posts
    1
    Originally posted by mbritton
    I'm duplicating movieclips with buttons inside them. I want the buttons to be assigned a dynamic getURL based on a value from XML. Does anyone know of or have a solution for this before I reinvent the wheel?

    Here's what I've come up with so far:

    Code:
    // Do duplication of movieclip with button on its timeline
    yourMovie.duplicateMovieClip("movie"+cClipCount, aNumber);
    for (i=0; i<=anArray.length; i++) {
    	// Assign an action dynamically to the button inside the movieclip with a handler??
    	this["movie"+cClipCount].onRelease = function() {
    		loadMovie("images/" + fileName[i] + ".jpg", _root.JPGtarget);
    	}
    }
    Do a simple thing...
    Create an array with handlers, another one with the pages you wish to jump (or in your case the movie U wish to load).
    create a button with your script which will be duplicated
    Add an ID to all your buttons.

    //_level0
    id=-1;

    //button action
    onClipEvent(load){
    _root.id++;
    btn_id=_root.id;
    handler=eval(handlerArray[id]);
    }


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