all groups > flash (macromedia) > december 2006 >
You're in the

flash (macromedia)

group:

Lighting?


Re: Lighting? Chris Georgenes
12/15/2006 1:45:52 PM
flash (macromedia): exactly - place both images in a movie clip on frames 1 and 2. Add stop actions to thos frames also.
give MC an instance name ("lights").
On button:

on (release) {
light.gotoAndStop(2);
}

etc...


~~~~~~~~~~~~~~~~
--> Adobe Certified Expert
--> www.mudbubble.com
--> www.keyframer.com
~~~~~~~~~~~~~~~~




[quoted text, click to view]
Re: Lighting? David Stiller
12/15/2006 1:50:55 PM
charles.crepin,

[quoted text, click to view]

Of course! And yet, if someone doesn't know how to make that switch, or
how to program a button, it's not so easy, right? Generally speaking, a
button (or movie clip) can be programmed like this.

1) Select the button on the Stage by clicking it.
2) Look at the Property inspector.
3) Give the button an instance name.

Now that it has an instance name, it can be "spoken to" by ActionScript
and told what to do. In a keyframe, enter the following ActionScript:

myButton.onRelease = function():Void {
// code here
}

Replace "myButton" with the instance name you just gave the button.
You're assigning a function to the Button.onRelease event (or
MovieClip.onRelease event, if it's a movie clip) of the button in question.

Now all you have to do is replace that "code here" area with what you
really want it to do.

I would set up both images -- the one with lights on, and the one with
lights off -- over top of each other. Make the top one, at least, a movie
clip, so that you may also give it an instance name. Notice that the
MovieClip class features a MovieClip._visible property (see the class entry
in the ActionScript 2.0 Language Reference for all available properties
[characteristics], methods [things it can do], and events [things it can
react to, such as onRelease].)

Assuming the "lights off" image (now a movie clip) is on top, or on a
layer above the "lights off" image, you may reference its instance name and
turn its visibility off like this ...

myButton.onRelease = function():Void {
lightsOff._visible = false;
}

.... again, assuming the instance name of the button is "myButton" (otherwise
change the code) and the instance name of the "lights off" movie clip is
lightsOff.


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."

Re: Lighting? David Stiller
12/15/2006 1:53:03 PM
[quoted text, click to view]

Perfect! In Flash, there's always a number of ways to handle the same
thing. Chris's version makes just as much sense. Put each lights image in
the same movie clip on two different frames, then invoke the
MovieClip.gotoAndStop() method, as he describes.

Chris has shown the on() function, which must be directly attached to a
button or movie clip; my version takes a different approach -- but the end
result is the same. The "trick" here is to manipulate another movie clip by
telling it what frame to show or turning it on/off.


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."

Lighting? rtreitner
12/15/2006 6:15:29 PM
I am putting together a new website and the main image is portrayed like a
museum painting with to light fixtures on either side. I would like to have
lights so you can turn them on and off with a button to highlight the image.
Anybody know a good tutorial or anything that explains how I can do this,
Thanks.
Re: Lighting? charles.crepin
12/15/2006 6:41:59 PM
Re: Lighting? charles.crepin
12/15/2006 7:22:36 PM
Yes, and moreover with Chris' approach you can animate the transitions, like
instead of doing gotoAndStop(2); you could use gotoAndPlay(2) and then animate
your symbol (the 2 images) from transparency 0 to 100% or play with its tint
until a number of frames later where you do stop();
Re: Lighting? rtreitner
12/15/2006 7:39:10 PM
AddThis Social Bookmark Button