Jump to content

Flash Help


Joe Aston

Recommended Posts

hi im starting a web design unit in my ict course at collage i was wanting to having an image on the home page but i the image to move around in the frame. However the image will be larger than the frame so the part of the image that you see moves around.

What i am wanting to know is the best way to get this affect i was thinking most likely will be flash.

Cheers for any help.

Joe

Edited by Joe Aston
Link to comment
Share on other sites

If you mean having the image animate so it moves around by itself, that's piss easy, it's just a few tweens.

If you mean, having the image move and to control the motion with the mouse position, that's a bit harder. I say a bit, I mean if you've never really used flash or even if you've just not gone into actionscript, avoid this.

Link to comment
Share on other sites

Glad you got it sorted. I'd like to see what you came up with too. You working with AS 2.0 or 3.0?

I would imagine I would have used a mask layer to make a frame over your image/map and scripted an onCLICK or similar so you could move the map inside the mask with the mouse. Post the AS if you would. I am learning about all this stuff now too and I like to see how people attack problems differently.

Cheers!

Edited by Tappets
Link to comment
Share on other sites

stop();

var across:Number =2;
var down:Number = 2;

image_mc.addEventListener(Event.ENTER_FRAME, onEachFrame);

function onEachFrame(e:Event):void {


		//move the image
		e.target.x += across;
		e.target.y += down;

		//dont move picture beyond start/end point
		if(e.target.x > mask_mc.x){
			e.target.x = mask_mc.x;
			across *= -1;
		}else if(e.target.x < mask_mc.x - (e.target.width - mask_mc.width)){
			e.target.x = mask_mc.x - (e.target.width - mask_mc.width);
			across *= -1;
		}

		if(e.target.y > mask_mc.y){
			e.target.y = mask_mc.y;
			down *= -1;
		}else if(e.target.y < mask_mc.y - (e.target.height - mask_mc.height)){
			e.target.y = mask_mc.y - (e.target.height - mask_mc.height);
			down *= -1;
		}

}

I got some help off a web design forum i got given that code and i just need to get round to adapting it to what i need. Im using as3.

Link to comment
Share on other sites

stop();

var across:Number =2;
var down:Number = 2;

image_mc.addEventListener(Event.ENTER_FRAME, onEachFrame);

function onEachFrame(e:Event):void {


		//move the image
		e.target.x += across;
		e.target.y += down;

		//dont move picture beyond start/end point
		if(e.target.x > mask_mc.x){
			e.target.x = mask_mc.x;
			across *= -1;
		}else if(e.target.x < mask_mc.x - (e.target.width - mask_mc.width)){
			e.target.x = mask_mc.x - (e.target.width - mask_mc.width);
			across *= -1;
		}

		if(e.target.y > mask_mc.y){
			e.target.y = mask_mc.y;
			down *= -1;
		}else if(e.target.y < mask_mc.y - (e.target.height - mask_mc.height)){
			e.target.y = mask_mc.y - (e.target.height - mask_mc.height);
			down *= -1;
		}

}

I got some help off a web design forum i got given that code and i just need to get round to adapting it to what i need. Im using as3.

Looks about right, all except for, I don't know AS3, just some AS2.

f**king 3, why is it so different from 2!?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...