Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Creating a menu and manage the different sections with Flash CS3

This is a discussion on Creating a menu and manage the different sections with Flash CS3 within the Tutorials forums, part of the Flash English category; Hi, I'm playing about with this in an attempt to learn flash and get used to actionscript. I've ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #41 (permalink)  
Old 25-08-08, 13:17
jlr jlr is offline
Junior Member
 
Join Date: Aug 2008
Posts: 5
Rep Power: 0
jlr is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Hi, I'm playing about with this in an attempt to learn flash and get used to actionscript. I've tried to add an extra button, but when compiling I get this error:

1120: Access of undefined property section6_mc.

Code:
package
{
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    
    public class Main extends MovieClip
    {
        private var menu_array:Array;
        private var section_array:Array;
        
        private var currentSection:int=0;
        private var nextSection:int;
        
        public function Main()
        {
            init();
        }
        
        private function init():void
        {
            menu_array=new Array(menu_mc.menu1_mc,menu_mc.menu2_mc,menu_mc.menu3_mc,menu_mc.menu4_mc,menu_mc.menu5_mc,menu_mc.menu6_mc);
            section_array=new Array(section1_mc,section2_mc,section3_mc,section4_mc,section5_mc,section6_mc);
            
            stage.frameRate=31;
            
            stopAll();
            
            addMenuEvents();
            
            hideCurrentSection();
        }
        
        private function stopAll():void
        {
            for(var i:int=0;i < menu_array.length;i++)
            {
                menu_array[i].stop();
                section_array[i].stop();
            }
        }
        
        private function addMenuEvents():void
        {
            for(var i:int=0;i < menu_array.length;i++)
            {
                menu_array[i].mouseChildren=false;
                menu_array[i].buttonMode=true;
                
                menu_array[i].id=i;
                menu_array[i].isPressed=false;
                
                menu_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
                menu_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
                menu_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
                menu_array[i].addEventListener(MouseEvent.MOUSE_UP,setUp);
            }
        }
        
        private function setOver(evt:MouseEvent):void
        {
            if(evt.target.isPressed==false)
                evt.target.gotoAndStop(2);
        }
        
        private function setOut(evt:MouseEvent):void
        {
            if(evt.target.isPressed==false)
                evt.target.gotoAndStop(1);
        }
        
        private function setDown(evt:MouseEvent):void
        {
            nextSection=evt.target.id;
            checkState(evt.target.id);
            
            evt.target.gotoAndStop(3);
            hideCurrentSection();
            
            currentSection=evt.target.id;
        }
        private function setUp(evt:MouseEvent):void
        {
            if(evt.target.isPressed==false)
                evt.target.gotoAndStop(1);
        }
        
        private function checkState(n:int):void
        {
            for(var i:int=0;i < menu_array.length;i++)
            {
                if(i==n)
                    menu_array[i].isPressed=true;
                else
                {
                    menu_array[i].isPressed=false;
                    menu_array[i].gotoAndStop(1);
                }
            }
        }
        
        private function hideCurrentSection():void
        {
            section_array[currentSection].gotoAndPlay(31);
            showSection();
        }
        
        private function showSection():void
        {
            section_array[nextSection].gotoAndPlay(2);
        }
    }
}
That's the full code. As you can see all I've added is the extra button. I'm guessing I'm making a really foolish mistake, but being new I've no idea what it is.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #42 (permalink)  
Old 25-08-08, 14:21
jlr jlr is offline
Junior Member
 
Join Date: Aug 2008
Posts: 5
Rep Power: 0
jlr is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Looking at my actions window it seems to be because my mc_section6 does not have a symbol definition. How do I give it one?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #43 (permalink)  
Old 25-08-08, 15:15
jlr jlr is offline
Junior Member
 
Join Date: Aug 2008
Posts: 5
Rep Power: 0
jlr is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Also, in your instructions, what does this mean?

Quote:
- I drag from the library the 5 MovieClip, each one in their respective level, and I assign to them the correspondent instance name: section1_mc, section2_mc, section3_mc, section4_mc, section5_mc.
Drag to where? At what point are my symbol definitions meant to be created here? My whole problem I'm guessing is around this area and for 2 hours now I haven't been able to solve it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #44 (permalink)  
Old 25-08-08, 15:20
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,060
Rep Power: 3
Onsitus is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Quote:
Originally Posted by jlr View Post
Also, in your instructions, what does this mean?



Drag to where? At what point are my symbol definitions meant to be created here? My whole problem I'm guessing is around this area and for 2 hours now I haven't been able to solve it.
Drag the mc on stage (working area) each their own layer, assigning to each mc an instance name from their property panel....basic of the use of flash.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #45 (permalink)  
Old 25-08-08, 15:25
jlr jlr is offline
Junior Member
 
Join Date: Aug 2008
Posts: 5
Rep Power: 0
jlr is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Ok, done that. I've got all my 6 layers showing in the actions menu. All with the required stops on lines 30 and 60. I have mc_menu6, mc_section6, and symbol 6. Yet still I get the undefined error.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #46 (permalink)  
Old 25-08-08, 15:56
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,060
Rep Power: 3
Onsitus is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Quote:
Originally Posted by jlr View Post
Ok, done that. I've got all my 6 layers showing in the actions menu. All with the required stops on lines 30 and 60. I have mc_menu6, mc_section6, and symbol 6. Yet still I get the undefined error.
Did you give the right instance name (not to be confonded with the name of the mc in library)?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #47 (permalink)  
Old 25-08-08, 16:06
jlr jlr is offline
Junior Member
 
Join Date: Aug 2008
Posts: 5
Rep Power: 0
jlr is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Quote:
Originally Posted by Onsitus View Post
Did you give the right instance name (not to be confonded with the name of the mc in library)?
Exactly my problem. Sorry and thankyou.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #48 (permalink)  
Old 07-12-08, 23:27
Junior Member
 
Join Date: Dec 2008
Posts: 1
Rep Power: 0
madhatter2k4 is on a distinguished road
Unhappy Re: Creating a menu and manage the different sections with Flash CS3

Hopefully I'm looking in the right thing. I'm making an events calender. I have the top 12 button (representing a different month) at the top. When i try to add it to a movie clip i name menu, it doesn't show anything.

Point is: I'm trying to make it so when you click each month, a different flash movie will load underneath the buttons for each month. EG - When you click May, a flash movie with May's events load under it.

Please help. I don't think this is too far off.

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #49 (permalink)  
Old 12-12-08, 20:27
Junior Member
 
Join Date: Nov 2008
Posts: 1
Rep Power: 0
habyby is on a distinguished road
Re: Creating a menu and manage the different sections with Flash CS3

Hello.
I am new to AS and to this forum. I would like to ask a question (i hope it`s not too stupid).
I have created a menu. I have created a link to each button. Each link brings a sliding page onto the screen. I have created also the sliding out effect.
My problem is that each time I bring out one of the pages, the old one doesn`t disapear.
I made them dissapear, but only when I press the buttons one after another.
I will add the action script I have written, and yes, I know it is wrong, but I don`t know what to do next.
Can someone help me ?

Code:
function b1Over(event:MouseEvent):void{
    b1mc.gotoAndPlay(76);
}
function b1Out(event:MouseEvent):void{
    b1mc.gotoAndPlay(91);
}
function b1click(event:MouseEvent):void{
    MovieClip(root).page_mc.pag1.gotoAndPlay(2);
    MovieClip(root).page_mc.pag4.gotoAndPlay(71);
}
b1mc.addEventListener(MouseEvent.ROLL_OVER,b1Over);
b1mc.addEventListener(MouseEvent.ROLL_OUT,b1Out);
b1mc.addEventListener(MouseEvent.CLICK,b1click);

function b2Over(event:MouseEvent):void{
    b2mc.gotoAndPlay(86);
}
function b2Out(event:MouseEvent):void{
    b2mc.gotoAndPlay(101);
}
function b2click(event:MouseEvent):void{
    MovieClip(root).page_mc.pag2.gotoAndPlay(2);
    MovieClip(root).page_mc.pag1.gotoAndPlay(71);
}
b2mc.addEventListener(MouseEvent.ROLL_OVER,b2Over);
b2mc.addEventListener(MouseEvent.ROLL_OUT,b2Out);
b2mc.addEventListener(MouseEvent.CLICK,b2click);

function b3Over(event:MouseEvent):void{
    b3mc.gotoAndPlay(96);
}
function b3Out(event:MouseEvent):void{
    b3mc.gotoAndPlay(111);
}
function b3click(event:MouseEvent):void{
    MovieClip(root).page_mc.pag3.gotoAndPlay(2);
    MovieClip(root).page_mc.pag2.gotoAndPlay(71);
}
b3mc.addEventListener(MouseEvent.ROLL_OVER,b3Over);
b3mc.addEventListener(MouseEvent.ROLL_OUT,b3Out);
b3mc.addEventListener(MouseEvent.CLICK,b3click);

function b4Over(event:MouseEvent):void{
    b4mc.gotoAndPlay(106);
}
function b4Out(event:MouseEvent):void{
    b4mc.gotoAndPlay(121);
}
function b4click(event:MouseEvent):void{
    MovieClip(root).page_mc.pag4.gotoAndPlay(2);
    MovieClip(root).page_mc.pag3.gotoAndPlay(71);
}
b4mc.addEventListener(MouseEvent.ROLL_OVER,b4Over);
b4mc.addEventListener(MouseEvent.ROLL_OUT,b4Out);
b4mc.addEventListener(MouseEvent.CLICK,b4click);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Creating a Flex component using Flash CS3 Flep Flex builder 3 ENG 3 15-12-08 18:14
Creating HTML output with Flash CS3 Flep Tutorials 1 31-07-08 09:32
Photoshop CS3 Creating a navigation menu Flep PhotoShop ENG 1 23-06-08 09:12
Menu Calls sections, runs if/then script triggering an animation???? donteatyourfriends advanced Actionscript 3.0 0 04-04-08 01:22
creating a menu hendrix01 Flash English 0 21-02-08 05:29


All times are GMT. The time now is 12:34.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap