all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

Swappiong library members


Swappiong library members cre8ive1974
9/6/2005 7:51:27 PM
flash actionscript:
Tried to post this a second ago but for some reason it did not take, So if
this is rehash, sorry

Need help with the following

First the layout.

On the stage in frame 1 I have three buttons, a red, green and yellow button.
Also on the stage I have a circle outline instance named circleOutline. In my
library I have three more circle instances they are circleRed, circleGreen and
circleYellow. The circle instances are all made from bitmap files and not
Flash drawings and all have the same dimensions and registration as
circleOutline. The movie is 1 frame in length.

The question is...

What I want to do is to be able to click on the red button and somehow swap
out the circleOutline instance with the circleRed instance in the library,
without navigating to another frame in the movie.

I do not want to do this for example

on (release) {
gotoAndStop(5);
}
and have frame 5 have the redCircle instance on it.

If anyone knows Lingo a simple Lingo statement woul be

on mouseup
sprite(1).member = "redCircle"
end

The only thing I can figure is to make seperate .swf files and write a code
that loads circleOutline.swf first and then loads the other color .swf files
into the appropriate layer when needed

example
on (release) {
loadMovieNum("circleRed.swf", 1);
}

My issue is that the final project will have many color option and I'm not
sure if making 40-50 color .swf files is the best way

any ideas?

Thanks!
D



Re: Swappiong library members NSurveyor
9/6/2005 8:09:22 PM
Go to Insert > New Symbol. Type in circle_mc for the name and select MovieClip.
Hit OK. On the first frame put your outline circle, at 0,0 coordinates. Insert
a blank keyframe on Frame 2. Put your red circle in the same place. Frame 3,
put the green circle, and Frame 4 put the yellow circle. Exit the MovieClip
edit mode and go back to the main stage. Drag this movieclip from the library
onto the stage. Open the properties panel, and type in circle_mc for the
<Instance Name>. For your button codes...

If your "buttons" are actual Button Symbols, use:

on(release){
circle_mc.gotoAndStop(2);//for red
}

If your "buttons" are actually MovieClip Symbols, use:

on(release){
_parent.circle_mc.gotoAndStop(2);//for red
}

for green, use gotoAndStop(3) and for yello, use gotoAndStop(4);
Re: Swappiong library members cre8ive1974
9/6/2005 8:30:31 PM
That worked perfect!

Thanks a bunch!

Re: Swappiong library members NSurveyor
9/6/2005 8:59:47 PM
AddThis Social Bookmark Button