Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

using MenuBar


Level 1
Hi, i am trying to load the data of the MenuBar element
dynamically using HttpService, for now its enough for me to load
the xml from a .xml file in the same directory of the .swf file.

the xml file contents are as follows:

<?xml version="1.0" encoding="utf-8"?>


<menuitem label="MenuItem A">

<menuitem label="SubMenuItem A-1" enabled="false"/>

<menuitem label="SubMenuItem A-2"/>


<menuitem label="MenuItem B"/>

<menuitem label="MenuItem C"/>

<menuitem label="MenuItem D">

<menuitem label="SubMenuItem D-1"

type="radio" groupName="one"/>

<menuitem label="SubMenuItem D-2"

type="radio" groupName="one"


<menuitem label="SubMenuItem D-3"

type="radio" groupName="one"/>



the application i wrote to load the xml file contains the

<?xml version="1.0" encoding="utf-8"?>

<mx:Application width="450" height="400" xmlns:mx="
layout="vertical" creationComplete="init();">



import mx.controls.*;

import mx.rpc.events.*;

import mx.collections.*;


private var menuData:XML;

private function
faultHandler(evt:Event):void{Alert.show("error loading data");}

private function init():void{menuDataProvider.send();}

private function loadData(evt:ResultEvent):void{menuData =
evt.result as XML;}



<mx:HTTPService id="menuDataProvider" url="menu.xml"
fault="faultHandler(event);" result="loadData(event)"/>

<mx:MenuBar left="10" top="10" right="10"
dataProvider="{menuData}" showRoot="false"/>


i have tried to replace the XML variable with an XMLList
variable but its not working. i also changed the resultFormat of
the HttpService tag to (e4x) and used the evt.result..menuitem, at
this time it loades the xml text in the menubar without parsing it.
... any help please ??
0 Replies