# Load first content without clicking the button

**URL:** <https://forum.kirupa.com/t/load-first-content-without-clicking-the-button/287583>\
**Category:** flash\
**Created:** [May 4, 2009, 1:20am UTC](https://forum.kirupa.com/t/load-first-content-without-clicking-the-button/287583 "2009-05-04T01:20:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [May 4, 2009, 1:20am UTC](https://forum.kirupa.com/t/load-first-content-without-clicking-the-button/287583/1 "2009-05-04T01:20:11Z")

</div>

Hi,

I successfully create XML menu and adding MouseEvent in each item and associate it with its content. My problem is that, how to load the first content in the stage without having to click the button?

```auto

		public function xmlLoaded(e:Event):void {

			if ((e.target as URLLoader) != null ) {
				//Insert the loaded data to our XML variable
				_btnLabels = new XML(e.target.data);
				_btnLabels.ignoreWhitespace = true;
				init();
				
				
			}

		}

private function init():void {	
			var i:int = 0;
			
			for each (var section_name:XML in _btnLabels.sections.section){
				var b:MovieClip = new butt();
				//trace(i);
				b.id = i;
				b.content =_btnLabels.sections.section.section_content*;
				addChild(b);
				_allButt.push();
				
				b.buttonMode = true;
				b.mouseChildren = false;
				b.addEventListener(MouseEvent.MOUSE_OVER, RollOver);
				b.addEventListener(MouseEvent.MOUSE_OUT,RollOut);
				b.addEventListener(MouseEvent.CLICK,onClick);
				i++;
				
				}
			}

private function onClick (e:MouseEvent):void {
			//enable disable button
			var btn = e.currentTarget;
			btn.mouseEnabled = false;
			btn.buttonMode = false;
			btn.alpha = 0.70;
			
			lastClicked.mouseEnabled = true;
			lastClicked.buttonMode = true;
			lastClicked.alpha = 1;
			lastClicked = btn;
			dispatchEvent(e);
			}

public function set content(loadedContent:String):void {
			for (var btn in _btns) {
				_btns[btn].content = loadedContent;
			}
		}

```
