Groups | Blog | Home
all groups > flash actionscript > june 2006 >

flash actionscript : Movie Clip Control


BobbiJo1
6/13/2006 9:51:02 PM
I would like to give my viewers the option to back up in my movie clip
(thumbnail images) on this page
http://butlerbuildinganddesign.com/bathrooms.html
can I place actionscript on a button. (like the third wooden button) instead
of constant clicking?
Thanks for any clues?
BobbiJo
Webmaster Pete
6/13/2006 10:17:43 PM
I see that your first wooden button is a 'scroll down' button which plays
through
the length of the thumbnails. Do you mean you want to replicate and reverse
this on the third wooden button 'scroll up' ?

I'm just guessing here but I'd say you accually have your thumbnail gallery
scrolling down as a motion tween and your scroll up button just has a 'goto
previous frame' type function on it?

If the previous statement is true then I would suggest two options for you.

1.) You take the scrolling functionality out of a timeline and do it all with
action script. This would be the most effective way of doing it.

2.) Since you probably don't want to make serious edits to that .fla. Here's
another way. You have a boolean called 'is_rev' and a function called
'play_backwards'. These are contained within the same movie clip as your
thumbnail gallery.

<!-- code
var is_rev:Boolean = false;
-->

Your third wooden button has these actions on it.
on(release)
{
this.is_rev = true;
this.prevFrame(); // This is to start the reverse loop;
}

Your first wooden button would have this on it.
on(release)
{
this.is_rev = false;
this.play();
}

Your second wooden button would have this on it.
on(release)
{
this.is_rev = false;
}

The function would be:
function play_backwards()
{
if(this.is_rev)
{
this.preFrame();
}
}

Now on every single frame of your scrolling gallery you need to call
this.play_backwards();

Please note the way I structured the coding assumes every object is on the
same timeline. If your buttons are in a different/parent movie clip relative
to your gallery movie clip, your going to need to make sure 'this' is set
relative to the two objects. (i.e. on your button -> this.prevFrame(); would
probably be this.gallery.prevFrame(); )

A quick design note. If your buttons symbolize scrolling not movement they
should be reversed since as the thumbnail gallery is moving upwards the user is
scrolling downwards.
BobbiJo1
6/13/2006 11:53:48 PM
Thank You Pete! for your reply. First off, your guess is right about my
actionscript (as.).

Now,...
I tried most of what you suggested, but I have to admit I'm still a bit of a
novice, so some of this I didn't get. What do I do to "call" a function. I
basically only know how to put as. on buttons directly.
Also, is the as. you gave me for each button complete as is, or do I add them
to what I have?

If you could maybe tell me more about the boolean, where does that go? Do I
have to add as. to frames too?

I really appreciate your help. Hope I'm not too much of a P.I.A.

Thanks Again?
BobbiJo
AddThis Social Bookmark Button