-5

I am getting my head around Flash, and to put it simply, I can't figure out where to put the code.

I am used to Visual IDE's where I can drag objects from a toolbox onto a workspace/canvas, and then view a list of this objects event handlers and put code under a particular event handler.

Flash doesn't seem to work like this. There is no Button object in the toolbox, which instead means you need to use the rectangle tool to draw a rectangle, and then use Convert to Symbol convert this to a button. Now I have a button, and I want to change the text of a label to "Hello World".

I drag what I am assuming is a label (the big T) onto my canvas and enumerate through the properties to try and find a name/ID for the label, I can't find this.

So two questions:

  • In Flash CS6, how do I access the click event of a button?
  • In Flash CS6, how do I identify a label (or any other object) in order to access the objects properties?

Thanks

JMK
  • 27,273
  • 52
  • 163
  • 280
  • 1
    I would suggest looking at a flash tutorial. – Alan Shortis Oct 22 '12 at 13:21
  • Sure, where in the properties pane for the object is the identifier for the label? As in, whenever I click on the label in the canvas, I see a list of properties in the properties pane, but I don't see a name/ID for the label. I am used to accessing the properties of an object programatically in other languages via dot notation on the name/ID of the object. – JMK Oct 22 '12 at 13:29
  • @JMK Make it a symbol, check my answer for details. – Austin Henley Oct 22 '12 at 13:30

1 Answers1

1
  • In Flash CS6, how do I access the click event of a button?

Like any of your code, this can be done in the Actions pane or in a text editor. Something like:

yourButton.addEventListener(MouseEvent.CLICK, clicked);

function clicked(e:MouseEvent):void {
//code
}
  • In Flash CS6, how do I identify a label (or any other object) in order to access the objects properties?

The object needs to be saved as symbol and then you can give an instance of that symbol a name. Then just modify it by referencing its name. The reason why you can't find the "properties" for a textbox is because it isn't a symbol. Select the textfield then hit F8 (or go to Modify -> Convert to Symbol) and then you will be able to treat it like a symbol.

I think it would help you a lot to Google around for a tutorial or two until you get the hang of the basics since it is a bit different than say, Visual Studio. Here is one specifically about textfields.

Austin Henley
  • 4,625
  • 13
  • 45
  • 80