Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
Old 04-28-2006, 03:40 PM   #1
Join Date: Mar 2003
Location: With the Carrot Crunchers
Posts: 34
Default Actionscript 2.0, adding an event handle to a button in a movie clip


One of my biggest complaints has been Flash's Actionscripting IDE and since moving from 6.0 to 8.0 I started to look for an Actionscript IDE with intellisense; and found FlashDevelop. To be frank, I've been very impressed with it and have been looking for ways of removing most, if not all, AS scripting from Flash and putting that into FlashDevelop and simply import the appropriate classes / code.

So far so good - however, I've hit a bit of a brick wall with something. Basically, I've created a MovieClip in Flash, set the appropriate AS Class 2.0 identifier through the library properities and then created the class defintion in FlashDevelop - this is working fine and some trace statements in the initialiser prove its linking OK. Within the movie I've got a button at Frame 10 whose event I want to wire/capture in my class and then perform the appropriate actions, I've tried adding an event handler and it doesn't work and I feel my AS jargon hasn't been good enough to get/location a solution from Google.

So, within my AS 2.0 class that is linked to a movieclip I want to capture the 'click' event of a button through code and run some code. Can anyone point me in the right direction?


...and he said "Four Oranges".

Well, you had to be there.
drydo is offline   Reply With Quote
Old 04-28-2006, 05:18 PM   #2
Senior Member
kouri's Avatar
Join Date: Jul 2002
Posts: 103

Hi drydo,

Assets contained in a Movie clip linked to a class (a movie clip subclass ) are not automatically accessible and must be explicitly declared in the class. For a button named 'myButton_mc' on scene, add in your class properties:

var myButton_mc:MovieClip //..or Button but personnally I no more use button);
you can also declare a reference in one of the method that is fired at class instanciation;

var myButton=this.myButton_mc; //could be a long path here
then use your event handler as usual;

   trace("myButton has been clicked")
That should solve your problem

- Hé tu m’aides pas là ? - Non pas là. (Les Bronzés font du ski)
kouri is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an event handler to a dynamically created Movie Clip jamessmb ActionScript 1.0 (and below) 4 04-22-2010 01:08 PM
Flash 4 creating an array on screen with duplicate movieclip Eend ActionScript 1.0 (and below) 8 02-18-2005 10:07 PM
Button with Movie Clip goto new Scene montex ActionScript 1.0 (and below) 1 12-07-2004 06:40 AM
Movie clip in a Button AngelEyesShadow ActionScript 1.0 (and below) 5 02-11-2004 05:48 AM
Button actionscript to get movie clip to play? d.arkins Simple Stuff (Newbies) 2 10-30-2002 09:56 PM

All times are GMT. The time now is 12:08 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.