dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Button Events Frame location Problem

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    9

    Question Button Events Frame location Problem

    am developing a multiple choice question answer. I have a movie clip in frame 2 where the radio buttons and question choices are displayed.

    I am trying to define a event for the radio button in the movie clip's first frame. But i show questions in random order. Say for example the first question to show is fifth I move the movieclip to 5th frame. The event is not firing since it is declared in the first frame.

    Should i place the button event code in each and every single frame or is there anyother option for this.

    Help required.

  2. #2
    Junior Member
    Join Date
    Apr 2010
    Location
    Baltimore
    Posts
    18
    hi,

    what you could do is write a function addListeners() in the DocumentClass and call it from each keyframe.

    IE:

    Document class: Main.as
    ...
    ..
    ..
    public function addListeners():void {
    addBTN.addEventListener(MouseEvent.MOUSE_UP, onAdd);
    closeBTN.addEventListener(MouseEvent.MOUSE_UP, onClose);
    ...
    ... etc.
    }


    then in your timeline keyframe I'd do:

    import Main;

    Main(root).addListeners();

    Best,
    Tom
    -----------------------------------------------------------
    My Flash Games are at:
    http://www.tommygameco.com

  3. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    9

    Thumbs up

    thanks tom that worked great

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