Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


as3 quetsion

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam
View previous topic :: View next topic  
Author Message
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Fri Mar 01, 2013 11:26 pm    Post subject: as3 quetsion Reply with quote

edit derp fixed it

Rusty as fuck haven't coded in like two years, halp plzzzzzzzzzzzzz
I'm trying to use an event listener for mouse event buttonDown, which is a boolean, and I can't remember for the life of me how to set this up.
I want to have two functions that are executed always (onenterframe) depending on the value of the boolean.

To elaborate, I have a mc instanced "shape" with a short animation in it, I want the animation to play when the user is clicking on it, but when they mouseUp I want it to reverse and play backwards to the start.
I had this code set up but it only plays forwards and doesn't rewind at all, which is why I'm trying to figure out the boolean instead of the two constants:

Code:
import flash.events.MouseEvent;

var rewind:int;

shape.stop();

shape.addEventListener(MouseEvent.MOUSE_DOWN, reportClick);
shape.addEventListener(MouseEvent.MOUSE_UP, reportUnClick);
shape.addEventListener(Event.ENTER_FRAME, checkRewind);

function reportClick(event:MouseEvent):void
{
   rewind = 0;
   shape.play();
}

function reportUnClick(event:MouseEvent):void
{
   rewind = 1;
}

function checkRewind(event:Event){
   if (rewind == 1) {
      prevFrame();
   }
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites