Posted on December 21, 2008 - by CDS, 0 Comments

Tips & Tricks: Flash LoadMovie trick

I discovered a little trick to bypass the problem of buttons on flash layers being active through the layers. If you’ve used the loadmovie function in flash to open external flash movies in layers (or not in layers), you’ve no doubt encountered the “click-through” glitch. Well, I can think of times you may want that effect so maybe it’s not a glitch, but I think in most cases you don’t want buttons from layer 0 to be active when layer 1 is viewable. My problem was that I was using layers, but not for every movie loaded. And the movies on the middle layer would change at a specific time of day, and because the same references were being used on layers 0 and 1, standard disable and enable coding would not work. I tried variations of the following:

_parent.button.enabled=0;
_parent.button.enabled=1;

_level0.button.enabled=0;
_level0.button.enabled=1;

and more etc…

Because of my level issues, only the disable function would work completely. And, then there was always the problem of doing this for every button, which would become cumbersome. I could of course used an array to apply to all buttons, but I wanted something even simpler… a graphical solution.

Here is what I did. Buttons in flash work in heirarchy. A button on a higher layer or that is arranged in front of another button will basically block any buttons behind it. So, in the movies that were being loaded on top, I made one button that encompassed the entire stage, set the alpha to 0%, named the button “hidden_btn” and added the following AS to the timeline:

hidden_btn.useHandCursor = false;

It’s essentially a hidden button that does not turn the cursor to hand, so nobody knows it’s even there. Not only did this work perfect, it saved me the trouble of all the additional AS for every button, etc.  I only need to copy and paste one movieclip and one line of AS to the external movies. This may not work in every situation, but it’s an easy and effective method for simple loadmovie functions.

The final result can be viewed at http://www.baxterclare.com

0 Comments

We'd love to hear yours!



Leave a Reply


Here's your chance to speak.

  1. Name (required)

    Mail (required)

    Website

    Message

Request a Design Quote




* Tell us a little about your project needs
CAPTCHA
  
So what's with all the birds, anyway?
Well, they stem from our company name. Jessica Miller, our founder and lead designer, chose the name Corvus as an homage to her favorite types of birds (those of the genus Corvus). Jessica gets a lot of her inspiration from nature, particularly wildlife, and wanted to incorporate her love of nature into her business life. This often shows in her design style, which has been described as "organic" and "ethereal".

View our Web Design Portfolio read more about us

Copyright (c) Corvus Design Studio. All rights reserved.
No unauthorized duplication of imagery, please.
Created with valid XHTML & CSS