Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with proximity changes

Status
Not open for further replies.

dazron

Programmer
Feb 28, 2001
17
GB
i'd really like to set up a movie that has lots of black squares that change alpha level according to how close the mouse is to it, revealing parts of a picture underneath.
I'm sure this can be done - but cannot work it out, or find a tutorial on it - can anyone help with this ?

Thanks

Daz
 
I kinda know what you're trying to do here regarding actionscripting. However, have you considered a much easier alternative which would involve 'dragging' a mask which has full transparency at the center and "0" trasnparency at the edges?

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
ok
so how would one do that ?

i have bg layer with 6 bands of colour

i want a black front layer, that is made up of squares, like pixels (imagine a picture 'mosaic-d' with photoshop) that reveal the bands underneath in accordance to cursor proximity

i have no idea on this !

:)
 
ok, I've done the actionscripting for one button. The button itslef is contained within a movie-clip (and the button in my example doesn't have any actions applied so don't fret if you press it and nothing happens)

good luck with the rest and I look forward to seeing the finished result!


dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
I've got a pz meeting in half an hour so I'll be quick with the explanation, which you may find useful.

Basically I've used pythagoras theorm. This theorem, as you m ay remember from high school, makes it possible to calculate the length of a side of a right-angled trianlge if you have the lengths of the other two (a.sq=b.sq + c.sq).

Theres an action in the main timeline which drags an invisibale movie-clip and locks it to the centre. The rest of the actionscripting determines the x and y positions of the movie-clip from the centre of the button (this gives two sides of the triangle) and subsequently calculates the hypothenuse of the triangle. So the further from the centre of the button you are the greater the hypotenuse (and the setproperty action is used to set the alpha of the mc dependant on the length of the hypotenuse). There's also actions in there to set the alpha of the button to 100 no matter where you are 'on' the button.

dave

----gone for some more gaelic coffees--- davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
but is it absolutely necessary to have it as a button - I dont want the cursor to change - the end user will try to press everything !
 
I don't see no cursor changing on this?
Eventhough it's a button!
Guess what Dave means is that starting with this one button's actions, you'll have to repeat them for the total number of squares you do want!

;-)
 
As old said, where exactly are you seeing a button cursor? And have you even had the courtesy to check the actionscripting for yourself?

Sometimes wonder why I bother.

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
LOL (tainted coffee ;-) ) davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
sorry dave - couldnt get hold of the fla - yes correct my bad - no cursor change

*humble *humble
 
dave - would i t be bad form for me to ask you talk me through this fla ?

and, is this effect only acheivable in flash 5 ?
 
Hi again darren,

give me 15 minutes, I'll write an FAQ on it and post it for everyone. Once I've done that I'll create a version for flash 4.

The difference between the two versions won't be too visible (if at all) to the user, however, as F4 does not come with built-in sin/cos/tan functions you have to program them into the actionscripting independently and re-work the calculation. BUT, you don't have to worry about that side of things cos I'll do it for you.

Was it you who e-mailed me daz?

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
What am I saying (duhhhhh!!!!!) there aren't any sin/cos/tan functions in this. (I'm thinking of my first idea on how to do this which was way over-complicated)

OK the FAQ is available for F5 in the section. I've also cleaned up the fla so you'd be well-advised to download the fresh version. Now creating the F4 version.

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
<<<F5 version

<<<F4 version

Because Flash 4 does not have an inherent Square Root function, you have to do the calculation long-windedly. This is done by re-jigging the main scripting to reference a 'square root calculator' in the frame labelled 'root' which is 'called' to perform the calculation with each loop of the movie. The value returned from the 'calculator' replaces the variable /:zz in the Flash5 version.

FAQ for F5 verison available in FAQ section. The above paragraph shall be added as a note for F4 users.

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
FAQ with Flash 4 note and various other samples available now at:

faq250-587

If you have any other problems with this just give me a shout Darren.

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
you are a bleedin star !

i could kiss you

but I won't

yes it was me who emailed you - could you mail me the fla's ? those links don't work for me - maybe because i'm mac
 
sending e-mails just now...might be over 10 minutes because I'm using hotmail at the minute and my connection is slo
dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top