First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Dan Ludwig | Website: http://www.danludwig.com

These actions are extensively commented in the source file. Since Flash 5 ActionScript is an object-oriented language using dot syntax, it is written differently than Flash 4 code. For example the second line of code is telling the MC instance logic, which lives inside of the scroll_shape MC instance, that it will contain a variable called target. Keep in mind that target is NOT a MC instance, it is a variable. That variable is equated to var_mc, which is another variable that was set in line 1 of the code. Line one sets var_mc equal to "_root.button_list," which is the absolute target path of the MC we want to scroll. Whenever the logic MC loop sees the variable target, it equates that variable with var_mc. Then, since "var_mc" was defined as button_list, target will be equated with the button_list MC when the logic loop is triggered. This way, if we wanted to change the MC that gets scrolled, all we need to do is place an instance of it on the stage (underneath the mask of course), give it a unique name, remove button_list, and change just one line of code so that:

var_mc = _root.unique_instance_name;

This takes away the painful task of having to rewrite all of your code every time you want to scroll a different MC. If the content to the right of the "=" sign in the rest of the code looks confusing, think of it as a simpler Flash 5 way of using the "getProperty" action. For example "var_mc._y" (line 6 of the code) is like as saying "getProperty(var_mc, _y)." Note the last line of code in particular, which establishes the value for the variable clip_height: By subtracting bar_length (see line 3 of the code) from var_mc._height, we are fooling Flash into thinking var_mc._Height is less than it actually is. This gets rid of the dead space below the target MC that would be displayed because of the window mask's dimensions. Here the mask's dimensions are a little bigger than scroll_bar's dimensions, and the extra 10 was subtracted as a tweaking measure because of this difference. Go ahead and change line 7 to the following, if you'd like to see what I'm talking about:

scroll_shape.logic.clip_height = var_mc._Height - 0

Now let's take a look at the drag actions attached to the invisibut instance on the button layer of scroll_shape(_obj), so we can begin to see how these variables will be accessed when the logic loop is triggered into action.

» Level Intermediate

Added: 2000-12-08
Rating: 8 Votes: 94
(10 being the highest)
» Author
Me Like Flash 5. Flash 4 good. Flash 5 better.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.