-
[RESOLVED] Transformation with mouse click and hold
I have a movie-clip
In itself, it transforms an another shape.
What I want to achieve is, as I press and hold over the movie-clip it will start transforming. When I release the mouse button, it will stop and when I press and hold again, it will continue.
Sounds easy, but I am not familiar with Actionscript 3 that much.
Appreciate if you can help me.
Thank you.
-
Designer, Programmer, Musician
var Frame:int = 1;
yourMovieClipName.addEventListener(MouseEvent.MOUS E_DOWN, down);
function down(e:MouseEvent):void
{
yourMovieClipName.addEventListener(Event.ENTER_FRA ME, run);
}
yourMovieClipName.addEventListener(MouseEvent.MOUS E_UP, up);
function up(e:MouseEvent):void
{
trace("asda");
yourMovieClipName.removeEventListener(Event.ENTER_ FRAME, run);
yourMovieClipName.stop();
}
function run(e:Event):void
{
yourMovieClipName.gotoAndPlay(Frame);
Frame++;
}
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Quite straightforward!
Thanks so much.
Originally Posted by angelhdz
var Frame:int = 1;
yourMovieClipName.addEventListener(MouseEvent.MOUS E_DOWN, down);
function down(e:MouseEvent):void
{
yourMovieClipName.addEventListener(Event.ENTER_FRA ME, run);
}
yourMovieClipName.addEventListener(MouseEvent.MOUS E_UP, up);
function up(e:MouseEvent):void
{
trace("asda");
yourMovieClipName.removeEventListener(Event.ENTER_ FRAME, run);
yourMovieClipName.stop();
}
function run(e:Event):void
{
yourMovieClipName.gotoAndPlay(Frame);
Frame++;
}
-
Designer, Programmer, Musician
If you don't have any other question, and your question is solved, please mark this thread as Resolved.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|