Knowledge Base |
Important! All new questions are usually answered within the next business day.
Drop Down (Tree) Menu V3
(views: 5915)
Drop Down Menu V3 and Drop Down Tree Menu V3 are xml flash accordion menus featuring customized states, customized transitions and tweens. Here are all known issues for Drop Down Menu V3 and Drop Down Tree Menu V3, they should be similar, since basically it is the same component. If you have any questions that you think we should discuss here please let us know.
Load movies on item select
(2008-09-11 - views: 309)
Q: How can I use the drop-down tree menu to load movies into a content box for a flash website?
A: Each menu item is created using the <item> node from the setup xml file. That node can contain different attributes with different values. You can use listeners to get the selected menu item (either ITEM_PRESS or ITEM_RELEASE) and then read the item's properties.
For example, you could add an extra attribute to each menu item to store the path and file name of the content you want to load:
...
<main>
<item title="File">
<item title="Load First Flash Movie" path="First.swf"/>
<item title="Load Second Flash Movie" path="Second.swf"/>
</item>
...
When a menu item has been pressed, you can detect that event and find out the value of the path attribute:
import com.jumpeye.Events.DropDownMenuEvents;
// Create the loader object and add it inside the container_mc
// movie clip. This is not necessary, it could be placed directly
// on the root.
var contentLoader:Loader = new Loader();
addChild(contentLoader);
// Listen for the "onRelease" event, to know when a menu item
// has been selected.
myMenu.addEventListener(DropDownMenuEvents.ITEM_RELEASE, releaseHandler);
function releaseHandler(evtObj:DropDownMenuEvents):void {
// evt.item represents the selected menu item Each menu item
// has extra properties that are the actual xml node attributes.
if (evtObj.item.path != undefined) {
var request:URLRequest = new URLRequest(evtObj.item.path);
// If the menu item has an extra property called "path",
// then load the content found at that location.
contentLoader.load(request);
}
}
For the example to work, place a DropDownTreeMenuAS3 instance on the stage, name it "myMenu" and set the xmlPath property to a .xml file. Then, select the frame on which the menu is placed, bring up the Actions panel and paste the above code into it.
For example, you could add an extra attribute to each menu item to store the path and file name of the content you want to load:
...
<main>
<item title="File">
<item title="Load First Flash Movie" path="First.swf"/>
<item title="Load Second Flash Movie" path="Second.swf"/>
</item>
...
When a menu item has been pressed, you can detect that event and find out the value of the path attribute:
import com.jumpeye.Events.DropDownMenuEvents;
// Create the loader object and add it inside the container_mc
// movie clip. This is not necessary, it could be placed directly
// on the root.
var contentLoader:Loader = new Loader();
addChild(contentLoader);
// Listen for the "onRelease" event, to know when a menu item
// has been selected.
myMenu.addEventListener(DropDownMenuEvents.ITEM_RELEASE, releaseHandler);
function releaseHandler(evtObj:DropDownMenuEvents):void {
// evt.item represents the selected menu item Each menu item
// has extra properties that are the actual xml node attributes.
if (evtObj.item.path != undefined) {
var request:URLRequest = new URLRequest(evtObj.item.path);
// If the menu item has an extra property called "path",
// then load the content found at that location.
contentLoader.load(request);
}
}
For the example to work, place a DropDownTreeMenuAS3 instance on the stage, name it "myMenu" and set the xmlPath property to a .xml file. Then, select the frame on which the menu is placed, bring up the Actions panel and paste the above code into it.
Login to post your comment
Other questions in this item:
Drop over HTML content Call JavaScript from XML Open menu item pages into target - "_self" Item description from XML Initiate Drop Down Tree Menu V3 through ActionScript Disable-Enable Drop Down (Tree) Menu Displaying the submenu horizontally instead of vertical Navigate through scenes Adding a checkbox to a menu Hand cursor Referencing item's textfield in Drop Down (Tree) Menu V3 Centering the titles on the Drop Down (Tree) Menu V3 Load movies on item select Go to different frames by pressing a menu item Changing Design Different text formats and anti alias setXML() generates error message Adding a separating gap between menu items Autoexpand on start Open menu items upwards Correct width of the main menu Initiate DropDownTreeMenuV3AS3 by ActionScript codeMenu |
|
|
