Home Tutorials Forums Articles Blogs Movies Library Employment Press

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

Reply
 
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
Old 04-28-2006, 03:40 PM   #1
drydo
Member
 
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

Hey,

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?

Cheers

M
__________________
...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
kouri
Senior Member
 
kouri's Avatar
 
Join Date: Jul 2002
Posts: 103
Default

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:

Code:
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;

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

Code:
myButton.onRelease=function(){
   trace("myButton has been clicked")
}
That should solve your problem

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


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 09:07 PM
Button with Movie Clip goto new Scene montex ActionScript 1.0 (and below) 1 12-07-2004 05:40 AM
Movie clip in a Button AngelEyesShadow ActionScript 1.0 (and below) 5 02-11-2004 04:48 AM
Button actionscript to get movie clip to play? d.arkins Simple Stuff (Newbies) 2 10-30-2002 08:56 PM


All times are GMT. The time now is 09:20 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, 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.