This content has been marked as final. Show 8 replies
Code the xml in the file first, make sure it works, then move it out to the file.
i hv done that and it works fine if i use
<menuitem label="Open" Icon="@Embed(source='images/menu/create.jpg')"/>
in mxml file.
Wht i wanna use external XML file as dataProvider to MenuBar
hopes its clear.
waiting 4 reply!
load() is not synchronous. You have to wait for the "complete" event before setting it as the dataProvider. If you trace out loader.data it should be empty.
BTW, the @Embed will not work inside XML
can anyone elaborate it more.??
The call to load() fires off a network request for data, and the next lines of code execute, often before the data comes back. An event fires when the data comes back so the pattern is to call load() and then wait for the event by calling addEventListener("complete",...).
@Embed is a compile-time thing so it won't be seen by the compiler if it is in external XML
If you want to have an icon next to one of your menuBar items, then you would embed the icon in Actionscript like this:
public var createIcon:Class;
Then, in your XML, you would have the menuItem like this:
<menuitem label="Open" Icon="createIcon" />
yeah tried this also
but not works !
is there any other trick 2 do the same using external XML file