Welcome, Guest. Please login or register.
Did you miss your activation email?
02/08/12, 08:33
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash 8 (Moderators: Jorge Solis, ..:: Mazhar Hasan ::.., Andresss)
| | |-+  Tree Menu Help
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Tree Menu Help  (Read 1229 times)
mastagolf
Server what's that
*
Posts: 7


View Profile
« on: 11/18/09, 15:33 »

I am really new to coding flash and xml...I have a question about the tree menu found here @

http://www.flash-db.com/Tutorials/treemenu/index.php?

I am struggling to configure the links and would like to ask for some help...

I downloaded the tutorial files and was able to change the text on the menu in the XML file. My problem I think is how to link the buttons  to certain frames in my swf movie. I do not understand the verbiage found below the tutorial:

"To set menu callbacks, you set a link property in the node passing an arbitrary string as the info, then you add a callback on the timeline to take the appropriate action. Here's an example:

 
var listener = new Object();
listener.onClickSection = function(evt:Object) {
    //evt.valu is the content of the link node property
    trace(evt.value)
};
this.menu.addEventListener("onClickSection",listener); "


That is the code I have put in my flash movie, but when exporting it out and viewing in html the buttons display properly but no links work....Please help! What do I need to change the XML code to link the buttons to a certain frame in the SWF and is there any AS changes needed in the swf

My XML code is below.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<menu>
   <item title="Home" font_color="0xFFFFFF">
   </item>   
   <item title="Photos" font_color="0xFFFFFF">
         <item title="2010" link="2010">
         </item>         
         <item title="2009" link="2009">
         </item>         
   </item>
   <item title="Videos" font_color="0xFFFFFF">   
         <item title="Kaylee" link="services">
         </item>         
         <item title="Joshua" link="contact">
         </item>
   </item>
   <item title="Books" font_color="0xFFFFFF">   
         <item title="Kaylee Birthlog">
         </item>         
         <item title="Joshua Birthlog">
         </item>         
         <item title="Blog">
         </item>
   </item>      
</menu>


Any help would be much appreciated.

Thanks in advance
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #1 on: 11/18/09, 21:47 »

if your debug window shows the link, you just have to handle it.

If it is a label name inside of a movieClip, you could gotoAndPlay(evt.value);
Or handle it in a switch (evt.value) { -block
Logged

happy flashing
Cool
Ronald
mastagolf
Server what's that
*
Posts: 7


View Profile
« Reply #2 on: 11/19/09, 09:21 »

I am sorry but I am still lost? I should add that to the FLA? When trying this I get a CLICKHandler in the output window when previewing in flash..Is that what your saying about debug?

The (evt.value) is supposed to be the frame number in the XML link?


My FLA AS is:

var listener = new Object();
listener.onClickSection = function(evt:Object) {
    //evt.valu is the content of the link node property
    gotoAndPlay(evt.value)
};
this.menu.addEventListener("onClickSection",listener);

My XML file is:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<menu>
   <item title="Home" font_color="0xFFFFFF" link="section Home">
   </item>   
   <item title="Photos" font_color="0xFFFFFF">
         <item title="2010" link="2010">
         </item>         
         <item title="2009" link="2009">
         </item>         
         <item title="2008" link="2008">
         </item>         
         <item title="2007" link="2007">
         </item>         
         <item title="2006" link="2006">
         </item>         
         <item title="2005" link="2005">
         </item>         
         <item title="2004" link="2004">
         </item>         
         <item title="2003" link="2003">
         </item>
   </item>   
   <item title="Videos" font_color="0xFFFFFF">   
         <item title="Kaylee" link="k_videos">
         </item>         
         <item title="Joshua" link="j_video">
         </item>   </item>
   <item title="Books" font_color="0xFFFFFF">   
         <item title="Kaylee Birthlog" link="k_birthlog">
         </item>         
         <item title="Joshua Birthlog" link="j_birthlog">
         </item>         
         <item title="Blog" link="blog">
         </item>
   </item>      
</menu>

Logged
mastagolf
Server what's that
*
Posts: 7


View Profile
« Reply #3 on: 11/19/09, 14:01 »

Should I mention I am trying to do this in Flash 8?

I do have CS3 at home, I have not tried yet to see if it works there.
Logged
mastagolf
Server what's that
*
Posts: 7


View Profile
« Reply #4 on: 11/19/09, 14:39 »

I figured this out....

my FLA code is:

var listener = new Object();
listener.onClickSection = function(evt:Object) {
        trace("label from XML->"+evt.value)
_root.gotoAndStop(evt.value)
};
this.menu.addEventListener("onClickSection",listener);

this allowed me to put the frame label in the XML and then when button is clicked it goes to that frame in the movie.

Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #5 on: 11/19/09, 17:54 »

Thats the point.
What do you want it to do?
Logged

happy flashing
Cool
Ronald
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything