Jump to content

Hey guys,

 

I'm currently doing Flash in one of my courses at university, and for one of the projects we have to create an aphorism banner. I wanted to use an effect similar to this on it http://imgur.com/J4YI0QS I've tried to write the code for myself, however it wouldn't work. I'll paste the code below.

 

So basically the X axis moves in relation to the mouses position, all I've gotten so far is that this is a mouseevent but i'm not too sure where to go from there.. What would you guys call this effect and if you don't know how to do it, where's a good place to search? 

 

Any help would be fantastic.

 

Sorry if the code doesn't make any sense, this is just what I got out of it. May be completely incorrect, I'm just having a crack at it.

import flash.events.Event;import flash.events.MouseEvent;// stops the frames from progressing (may remove)stop();//defining variables for mouse movementvar xmouse:Number = 0;var xp:Number = 0;var speed:Number = 1.5;stage.addEventListener(MouseEvent.MOUSE_MOVE, tracer);var stageWidth:Number = 728var stageHeight:Number = 90function tracer (event:MouseEvent):void{	275	if (event.stageX > stage.stageWidth/2) 	{xmouse = - (event.stageX - stage.stageWidth)-stage.stageWidth/2;}	else{		(xmouse = (stage.stageWidth/2) - event.stageX);	}}(xp = Math.round(xmouse.stageWidth) * 100);kitesurfermc.y = 18;var kitesurfermcX = ((xp/100) * 45) + 275;TweenMax.to(kitesurfermc,speed, {x:kitesurfermcX, ease:Expo.easeOut});

 

Link to comment
https://linustechtips.com/topic/342999-adobe-flash-help/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×