Macromedia Flash - Push objects away from the cursor
This tutorial will show you how to make a flash file with the effect of pushing the object away from the cursor by using some Action Script fragments in Flash 8. Let's look at the following example file.
Step 1
Create a new flash file, choose Modify > Document ( Ctrl + J ) and set Width to 300px and Height to 250px and Frame rate to 70fps.
Step 2
Create or Import ( Ctrl + R ) any object and convert it into a Movie Clip
Step 3
Double-click the newly created Movie Clip (opject) to enter the edit object
Step 4
Then add a new layer and name it action.
Step 5
Select frame 1 of layer action, open the Action Script Panel (F9) and include the following code:
x00 = _x;
y00 = _y;
MAAI = 400;
Step 6
Select frame 2, press F6 key to open the Action Script Panel (F9) and enter the following code:
x0 = _x
y0 = _y
x = _root._xmouse
y = _root._ymouse
a = x-x0
b = y-y0
r = Math.sqrt (a * a + b * b)
quer_fugir_x = this._x- (a / r) * MAAI / r
quer_fugir_y = this._y- (b / r) * MAAI / r
quer_voltar_x = (x00-x0) / 2
quer_voltar_y = (y00-y0) / 2
this._x = quer_fugir_x + quer_voltar_x
this._y = quer_fugir_y + quer_voltar_y
Step 7
Select frame 3, press F6 key and enter the following script:
gotoAndPlay (2);
Step 8
Select frame 3 of layer 1 and press F5
Step 9
Return to the main scene (Scene 1), multiply the object several times and place it in the corresponding positions as in the example above.
Download the example file.
You should read it
- Use the action buttons on Slide in PowerPoint
- Macromedia Flash - Create great photo slideshows
- 4 ways to measure FPS frame rate (Frame Per Second) in PC game
- Macromedia Flash - Advanced masking with action script
- Action Query in Action 2016
- Macromedia Flash - Create text frames with scroll bars in Flash 8.0
- How to show the alignment frame in Word
- How to use server actions in Next.js
May be interested
- Macromedia Flash - Effect of 'oil spill'through this tutorial you can make an effect for small ads that are quite simple but no less strange ...
- Macromedia Flash - The spotlightjust a few simple steps in flash 8.0 you can create a nice effect: the spotlight effect.
- Macromedia Flash - Product image advertising effectsin this article, we will show you how to create a product advertising effect in flash. you can use this effect when you need to introduce a new product launch or in banner ads. this effect does not need to use any action script code but only created with mask in flash.
- Macromedia Flash - Create menu effectsthis lesson will show you how to create a flash menu with the effect when moving the mouse. to create this post, you will have to use the action script code.
- Macromedia Flash - Vivid photo effectsthrough this tutorial, you will learn how to create a vivid photo effect with some basic flash tips. this article does not need to use action script code.
- Macromedia Flash - Create flash menu with soundin this flash tutorial, we will guide you to create a dynamic flash menu with sound. you can use this menu on any website.
- Macromedia Flash - Create analog clock in Flashthis tutorial will show you how to create a real working clock using flash effects.
- Macromedia Flash - Self-designed animated menuthis tutorial is quite complicated but we will try to explain it in the easiest way. make sure you follow the instructions step by step.
- Macromedia Flash - Text presentation in Flashin this article, we will learn how to create a text presentation in flash using some special flash tips.
- Macromedia Flash - Effects of changing position of textthis tutorial will show you how to create a constantly changing text effect in flash using the action script.