Skip navigation
Currently Being Moderated

Creating a button within a movie clip for ipad

Aug 11, 2012 3:20 PM

I'm trying to create a button within a movie clip for an ipad app. (a next button for a slideshow, the slideshow page is a movie clip.
This is the code I tried. Button=nextbutton, movie clip= artworkmovie. I just want the button to advance the movie clip one frame.

 

 

nextbutton.addEventListener(MouseEvent.CLICK, nextClickHandler);

 

 

                    function nextClickHandler(event:MouseEvent):void

                    {

                              artworkmovie.nextFrame();

}

 

This works fine from the stage, but if I have the button "next" within the movie "artworkmovie" I get the error "Line19 1120 Access of undefined property nextbutton". (Line19 is "nextbutton.addEventListener(MouseEvent.CLICK, nextClickHandler);") How can I create a path to the button? I tried artworkmovie.nextbutton and that didn't work.

 

Sorry for such a basic question and thanks for your help.

 
Replies
  • Currently Being Moderated
    Aug 11, 2012 7:01 PM   in reply to mrIchybob

    artworkmovie.nextbutton should work.  Make sure you have the button name assigned in every keyframe within the movieclip.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 11, 2012 7:03 PM   in reply to mrIchybob

    I should add that you need to be sure the button exists when that code executes.  If it is in some other frame, it does not yet exist as far as the code sees it.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2012 4:41 AM   in reply to mrIchybob

    You're welcome.  If you don't want a button to be interactable/visible, but it needs to be present, then taking its alpha down to 0 won't help because it can still be interacted with.  What is usually done is that the button's visible property is set to false/true as needed or the button is kept offstage until it is needed.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points