Projects
Example 2 - Multiple MovieClip Instances
Intro : Example 1 : Example 2 : Example 3 : Example 4
Library
- button - Movie Clip
- content - Movie Clip
- invisible - Button
Construction
- Create MovieClip containing:
- invisible button
- dynamic textfield
- background
- actionscript attached to button instance
- Create MovieClip containing content on sequential frames. Place on timeline, giving instance name
- Create as many instances of button movieclip as needed, assigning instance names
- Frame 1, actions layer, assign button movieclip variables: textfield and frame number to jump to
Actionscript
Attached to invisible button on button movieclip timeline
on(release) {
_parent.content.gotoAndStop(frame);
}
Attached to Frame 1 on root timeline
button1.text = "Home";
button1.frame = 1;
Repeat for each button
Advantages
- Easier to customize
- All variable assignments in one place
- Content is placed on its own timeline - easier to change
Disadvantages
- Need to assign instance names to each button (really not that big of a deal)
Recently Played on iTunes
-
“My Sharona”
Frat Rock: The '70s
The Knack
06/04/11 09:27 -
“The KKK Took My Baby Away”
Anthology
The Ramones
06/04/11 09:25 -
“My Sharona”
Frat Rock: The '70s
The Knack
06/04/11 09:24