We help IT Professionals succeed at work.

Flash 8

jimseiwert
jimseiwert asked
on
160 Views
Last Modified: 2010-04-03
I am new to flash and need to create a swf file that has an arrow that moves across the canvus and then climbs to the top right. I have never done anything like this before and was wondering if someone could provide some guidance.

Thank you
Comment
Watch Question

Here you go:

go to Insert>New Symbol ... to create a new symbol making sure to first give it the name 'arrow' and then check the box labeled, 'Export for Actionscript'. (If you don't see the checkbox with that label, click the advanced button and then you will see it) Use the drawing tools to make a right facing arrow and then click, 'Scene 1' at the top of the interface to return to the main timeline. Click in the first frame on the timeline and then open the Actions panel (Window>Actions) and type this code exactly:

var hLevel = Stage.height/2;//change to any positive value
var turnAt = Stage.width/2;//change to any value greater than 10
var speed = 5;//change to any positive value
var end = 0;//change to any value less than hLevel
var
rotate = 1;//don't change

var clip = attachMovie('arrow', 'myarrow', getNextHighestDepth());
clip._x = 10;
clip._y = hLevel;
onEnterFrame = function(){
    if(clip._x < turnAt){
        clip._x+=speed;
    }else if(clip._y > end){
        clip._y-=speed;
        if(rotate){
            clip._rotation -= 90;
            rotate = 0;
        }
    }
};

Go to Control>Test Movie to view.

Author

Commented:
Instead of just having the image move is there a way it can look like it is being drawn?
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Sorry for the change in question but your solution is perfect. Thank you very much.

Author

Commented:
Question is there a way to make it go on an angle ?
Glad I could help. There are a couple of ways you can get angles with this effect, but using this code would be inefficient. The best would be to use trigonometry. Also the easiest. I wish I had time to give you some info to get you started but I'm working so ... I will look out for questions from you and try to slip in the information where apporpriate. I should be checking the site later tonight and through the weekend. Have a great day!

K.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.