Old 05-11-2008   #1 (permalink)
Just unleashed!
 
unleash's Avatar
 
Join Date: Jul 2005
Location: Inbetween
Posts: 2,140
Blog Entries: 9

Orb - flash version

This thread is a response to the question asked by freak4lf. In this topic : orb - BioRUST.com :: User Gallery

The question was to make the whole more interactive. Now Im still not completely sure what should be doing what. But this is what I made out of it(see attachement).

The tutorial:
Step 1 to 5 have images (they are attached to this post)

Step 1.
First thing to do is set the Background. Just make a layer, call it BG (background) and paste you BG image into that one. Than lock the layer so that it can't be changed.

Step 2.
Than you need to paste the image that should be cloaked, so that it can only be seen when the mouse is on it. This image should be pasted into a new layer, lets call it "masked". Do not lock this layer yet.

Step 3.
Make a layer on top of the "masked" layer, and call it mask. On this layer paste the mask. The circle that should be the window to the other image. Than right click on this layer ( in the timeline) and press mask.

Step 4.
Now you need to press the mask object and press "F8", or right click and press "make symbol". In the pop up menu, select Movie Clip and press "ok". Then select the mask in you scene, and change the instance name to "mask".

Step 5.
Make a new layer on top of the others, and call it something nice. Paste the image of the magnifying glass in this layer, and make it a symbol > movieclip. Change its instance name to "vf"(or something else, but than you have to use that name in the AS).

Step 6.
Now this is the more vital step. Make a new layer and cal it AS(ActionsScript). This will be the layer containing the code. Open up the actionscript window, and type in this code

Code:
this.onEnterFrame = function() {
	startDrag("mask", true);
	Mouse.hide();
	locate();
};

function locate() {
	mask_x = mask._x;
	mask_y = mask._y;
	vg_x = (mask_x+85.5);
	vg_y = (mask_y+89.5);
	vg._x = vg_x;
	vg._y = vg_y;
}
Now to explain the code:

Code:
this.onEnterFrame = function() {
	startDrag("mask", true);
	Mouse.hide();
	locate();
};
The "this.onEnterFrame" part determines that this function will start up everytime flash enters this frame. As flash repeats, this function will loop!

The "startDrag("mask", true)" is the part that states that something will follow the mouse. It is used to replace the mousepointer but also functions in this case. It is made up of 2 elemetents. The "mask" part and the "true" part. Part one tells flash that "mask" will follow the mouse. We called our masking object "mask" and therefor that object will follow. The second element, "true", makes flash to hide the original mouse pointer.

To be sure that the mouse pointer remains hidden, I also called the "Mouse.hide():".

Than the "locate();" part. what it does is pretty simple. It cals for a function called locate. And executes it, if that function does not excist than that will be an error, and your movie won't run smoothly.

Code:
function locate() {
	mask_x = mask._x;
	mask_y = mask._y;
	vg_x = (mask_x+85.5);
	vg_y = (mask_y+89.5);
	vg._x = vg_x;
	vg._y = vg_y;
}
This part of code is pretty simple. This is the locate function, and will be called when the frame is entered. What this function does is making sure that the magnifying glass is where it should be(at the mousepoint). But because the glass has a stick, and therefore isn't sqauer, it must be placed a bit different than the mask, so that the circle fits around the mask.

To do this I simply, took the place of the mask (first two rows) and put them into variables. The variables "mask_x, mask_y" can then be used in the code. Then I declared 2 more variables "vg_y, vg_x" these two will function as storage, as the place where the glass shoud be are stored in them. I just looked at the original placing, and took the difference between the x and y values of the mask and the glass to see what numbers I should use.

Than finnally I put the correct number in the x and y slots of the glass.

This is how I made the attached movie I had to zip the movie, because it doesn't work otherwise, so I also took the librty of uploading it to biorust. It can be found here:
http://forums.biorust.com/photopost/...hp?photo=13944
Attached Thumbnails
orb-flash-version-step1.jpg  orb-flash-version-step2-3.jpg  orb-flash-version-step5.jpg  
Attached Files
File Type: zip Kopie van Mask.zip (4.46 MB, 27 views)
__________________
"I haven't failed, I've just found out
10.000 ways that don't work."

~Thomas Edison~

Last edited by unleash; 05-11-2008 at 11:44 AM.
unleash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-11-2008   #2 (permalink)
Just unleashed!
 
unleash's Avatar
 
Join Date: Jul 2005
Location: Inbetween
Posts: 2,140
Blog Entries: 9

O a small addition to my former posted thread... These are really handy tutorials. they are pretty easy and are very helpful for beginners. (I find them helpful )

kirupa.com - Follow Mouse Command

kirupa.com - Scriptable Masks

and yeah they are both from kirupa...but that's one of the better (best) community's for flash if you ask me!!
__________________
"I haven't failed, I've just found out
10.000 ways that don't work."

~Thomas Edison~
unleash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash 8 - Education Version - Anyone wanna buy it? jvratar86 The Marketplace 2 03-26-2007 10:31 PM
[FLASH] Simple Flash Preloader Jacorre Tutorial Submission 3 01-22-2007 09:07 PM
What version... DannyG Adobe Photoshop 3 12-14-2006 06:45 AM
Subound version 3 Calipso Showrooms & Works In Progress 10 07-25-2005 06:24 AM
TheCubed.com version 6 is here! thecubed Showrooms & Works In Progress 8 05-31-2005 09:32 PM


All times are GMT +1. The time now is 08:37 AM.
Content Relevant URLs by vBSEO 3.2.0 RC7

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT