Link to home
Start Free TrialLog in
Avatar of Ramesh Srinivas
Ramesh SrinivasFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Animate dynamic resize of mask...

Hi all,

Been looking for a way to do this for a while, but nobody can seem to tell me how its done. Anyway...

Let me describe what im attempting to do...

I have an MC which loads an image into it. When the image finishes loading, I want to animate the resize of the mask MC to the size of the image (which is the value of the MC that the image is loaded into).

To get a better idea, have a look at the way this website loads images...

http://www.mayawashington.com/v2/index.htm

Basically, I want the image window (i.e. movieclip) to resize to that of the image. I'd be gratefull if someone could give me some pointers on how to achieve this.

regards,

KS

Avatar of techE_or_not_techE
techE_or_not_techE

I'm not sure exactly what you are looking for, but thsi might get you started.

Scene heirarchy looks like this:
_root
  Button:       loadImg_btn
  Button:       loadImg1_btn
  MovieClip:   loadHere_mc
       Shape:         any colored shape ->  Layer 1
                              -- just so that you can see the mask animation
       Loader:        myLoader_comp    ->  Layer 2
       MovieClip:    loaderMask_mc      ->  Layer 3
                              -- layer set to mask both layer 1 and 2
                              -- shape animation inside of this clip with 'stop();' action at first and last frame.
===================================================
// Button Action
// ----------------------------------------
loadPic = new Object();
loadPic.click = function(obj) {
      trace("CLICK 1: " + obj.target._name);
      switch (obj.target._name) {
      case "loadImg_btn" :
            scaleMask = false;
            break;
      case "loadImg1_btn" :
            scaleMask = true;
            break;
      }
      loadHere_mc.loaderMask_mc.gotoAndStop(1)
      loadHere_mc.myLoader_comp.contentPath = "EE_logo.JPG";
      loadHere_mc.myLoader_comp.load();
};
// MC Animation Triggered After Load
// ----------------------------------------
doneLoading = new Object();
doneLoading.complete = function() {
      trace("SCALE: " + scaleMask);
      if (scaleMask) {
            loadHere_mc.loaderMask_mc._height = loadHere_mc.myLoader_comp.height;
      }
      loadHere_mc.loaderMask_mc.play();
};
// Add Event Listeners
// ----------------------------------------
loadHere_mc.myLoader_comp.addEventListener("complete", doneLoading);
loadImg_btn.addEventListener("click", loadPic);
loadImg1_btn.addEventListener("click", loadPic);
=======================================================================
Avatar of Ramesh Srinivas

ASKER

Okay, thanks for that - i'll try some of that code out when i get a chance.

What I want...

1.  User clicks a button
2.  MC with image begins loading but remains unseen as another MC (call it maskMC) is above it.
3.  loading complete, maskMC scales dynamically (i.e. animates), to the size of MC with image
4.  maskMC then tweens to reveal image underneath

Thats the sort of thing im after. Hope that makes it clearer.

thanks,

KS
ASKER CERTIFIED SOLUTION
Avatar of techE_or_not_techE
techE_or_not_techE

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

The code is clear to me, I only elaborated further because you stated "I'm not sure exactly what you are looking for"

I still haven't had a chance to try out the code yet! I will tho - and let you know the outcome as soon as.

regards,


KS
 
Sure thing, my friend; am here to help.
Sorry, dude, still havent had time to test out your code.

You can have the points, as i'm not sure when i will be able to!

regards,

KS
Just let me know if it doesn't work out.  I'll post an example if it will help you to see it in action.

-- thanks for the points, brah.
Thanks man.

I couldn't get it to work. I'd be grateful if u could post an example - or just let me know if you require en email address to send to.

cheers,

KS
Here is a working example of the previous code -- with a few modifications.

You can find it using the following info:

ADDRESS:    ftp.sorethumbmedia.com
FILE:            Loader_01.zip
USER:          EE
PASS:          password
Hi,

Thanks for that - but I couldn't connect with the details you posted.

Let me know what the problem is or alternatively, you can email to saleem75k@yahoo.co.uk

thanks again,

KS
Actually, forget that idea - I can't remember the password for that account!!
I just tried it and if you just click the above link, you're right, you will get a 'page not found' error.  All that you have to do is right click the link and select "open in new window."  Or, you could just past the address into a new browser window.  Or, even paste it into your file browser address bar.
Hi,

Thanks for getting back to me - I am trying the given login details, but it is not happening.

Can you check that it is working, thanks,

KS
Yes; I checked that it was working before I made my last post a few minutes ago, which stated just that.  It's working.
Keep trying -- I don't think that I can make it any easier for you.
No, its still not letting me in. Maybe its the firewall here I don't know. Will try from home later.

thanks,

KS