flash - Button Class by instance name, Actionscript-3 -


I am using the timeline code, that it tricks me to identify a button example on the forum How do I get a button class?
Please help.

... Just modify - Button.flow

  Class: 'Button' button is placed on the stage with the name of the example  

button.

  Package {import flash.display.MovieClip; Public class button enhances movie clips (public function buttons) {mc.addEventListener (MouseEvent.MOUSE_DOWN, onClick); Stage.addChild (this); } Public event onClick (Event: MouseEvent): Zero {trace ("Hello World"); }}}  

Error:
1120: Undefined property
error indicates that this is a mouse event, my example name is not MC

You are missing a definition of a curly brace and MC and an import of MouseEvent (the root of your problem above).

  package {import flash.display.movieClip; Import flash.events.MouseEvent; Public Class Button Movieclip {Extends Public Function Buttons (}} {// It is better to use "this" instead of adding another example of the movie clips named "MC". AddEventListener (MouseEvent.MOUSE_DOWN, onClick); } Public event onClick (Event: MouseEvent): Zero {trace ("Hello World"); }}}  

Of course, there are many other better ways to accomplish these results, but it should at least correct your compile problem. Now, to get it on the stage, you have to add it to the thing that exists. An easy way to do this is by this.addEventListener :

  forum.edbild (this) is by putting the following line below;  

If you have other questions to do this work, please let me know I hope you are in the right direction,

- Gmail

EDIT:

This is in response to the comments below. I tried what you were doing. A quick clickable button coded in the IDE and a quick clickable button is coded in a different * .AS file:


Comments