A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: AS3 Submenu Buttons Not Working

  1. #1
    Junior Member
    Join Date
    Sep 2009

    AS3 Submenu Buttons Not Working

    I am migrating from AS2 to AS3 and realize the button functionality is totally different. I have a website with buttons that have submenus. I have the first layer of buttons working. They have eventListeners attached that take them to a labeled frame on the timeline. When you get to that labeled frame there is a submenu of buttons there. I tried putting the code for those buttons in the same script on frame 1 but it messes up the movie.

    I think it has something to do with the buttons not actually being there on frame 1 when the script is read. I cannot figure out where to put the script for the submenu buttons to make them work. I think I have to put a parent type script in there. Sorry I dont even know what to look up.

    If anyone could please shed some light on this I would really appreciate. I am hoping this is not a difficult thing to do.

    Here is the link to the site:

    Here is the code on frame 1:

    function goCollections(e:MouseEvent):void {
    collections_btn.addEventListener(MouseEvent.CLICK, goCollections);
    function goRaison(e:MouseEvent):void {
    raison_btn.addEventListener(MouseEvent.CLICK, goRaison);
    function goStores(e:MouseEvent):void {
    stores_btn.addEventListener(MouseEvent.CLICK, goStores);
    function goNews(e:MouseEvent):void {
    	var link:URLRequest = new URLRequest("http://coclico.blogspot.com/");
    news_btn.addEventListener(MouseEvent.CLICK, goNews);
    function goShop(e:MouseEvent):void {
    	var link:URLRequest = new URLRequest("http://www.shopcoclico.com");
    shop_btn.addEventListener(MouseEvent.CLICK, goShop);
    function goContact(e:MouseEvent):void {
    contact_btn.addEventListener(MouseEvent.CLICK, goContact);
    function goSpring(e:MouseEvent):void {
    spring_btn.addEventListener(MouseEvent.CLICK, goSpring);
    function goEco(e:MouseEvent):void {
    eco_btn.addEventListener(MouseEvent.CLICK, goEco);
    Again thank you to anyone who can shed some light on this... I don't want to rebuild in AS2

    thx sandra

  2. #2
    Junior Member
    Join Date
    Jul 2007
    yes you are right, it won't let you call something that isn't on the stage yet. why not just put the submenu code on the same frame for the submenu?

  3. #3
    Junior Member
    Join Date
    Sep 2009
    I tried putting all of the button codes in the same script but since the buttons are not there the file doesn't run correctly. I need to know how to code in the submenu buttons in the beginning but not have them show up until frame number "xx" I don't know how to write that... do you know o f any examples I could look at? Or could you help me with the syntax for one of them and I could duplicate the rest??

    thanks! Sorry if this is asking for a lot... I am not sure if this is something easy or really difficult...ugh... al I know is it is difficult for me

    thanks! sandra

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center