A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: OOP - navigation buttons

  1. #1
    Member
    Join Date
    Jul 2009
    Posts
    69

    OOP - navigation buttons

    I have one .fla where a relatively large navigation menu will be presented to the user. This .fla has multiple frames and over 25 buttons all guiding user either to additional menu options (presented in a different frame) or to a URL.

    I am used to doing simple frame-by-frame programming. But am wondering if in this instance, it wouldn't make sense to set up an .as file that has the information for each button's link in the .fla (be it another frame or a URL) - because doing it frame-by-frame is getting VERY messy.

    Can anyone point me toward a tutorial (for the OOP-challenged) that could guide me toward making this happen. Is it even possible to create a master .as file / class to control all the buttons in a .fla file (each with different destination?)

    TIA
    Last edited by Leftyplayer; 12-04-2009 at 11:35 AM.

  2. #2
    Member
    Join Date
    Jul 2009
    Posts
    69
    okay, I have an idea - but would hate to spin my wheels. Tell me if I'm on the right track:

    I could set up one file (fla) that contains all the buttons. Then have each button load an external .swf file. So then I would just make a separate .swf for each "link" that would've otherwise been done in each frame. For the ones that go to a URL, I guess I could just put those on first frame of the master .fla.

    Am I getting hotter here? (not in the sexy sense of the word, but in the 'yes, that's the way to go' sense : )

  3. #3
    AS2 intolerant person
    Join Date
    Jan 2009
    Location
    Swansea
    Posts
    352
    basically you need a master class for a button right?

    ok, so create a .as file and give it this content:

    Code:
    package {
         public class NavButton extends MovieClip {
    
              // public properties
              public var property1;
              public var property2;
              public var property3;
    
              // constructor
              public function NavButton() {
              
              }
              
              // internal function
              private function functionName():void {
              
              }
         }
    }
    so in the library right click the symbol and properties and export for AS, and type the class name.

    now, you can set properties sush as destination/

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Here is something more sophisticated:
    http://flashscript.biz/flblogger/?p=3
    - The right of the People to create Flash movies shall not be infringed. -

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