learningtech
learningtech

Reputation: 33683

AS3 How to import a button

I am new to flash AS3. I inserted a button and gave it the name login_btn.

Now in my action script, i want to do a login_btn.visible = false; However I'm not sure what "class" i need to import into my action script file. Is it import flash.display.button or something?

Upvotes: 0

Views: 2025

Answers (2)

Moorthy
Moorthy

Reputation: 754

It is enough to have the

login_btn.visible = false;

itself. However, for future, you could import it from flash.display packagae.

import flash.display.SimpleButton;

Hint: If you are not sure what to import, just type

var UR_VAR_NAME

then put a semi colon ( : ), flash will automatically import its class. It is feature of the AS Editor.

Upvotes: 1

BadFeelingAboutThis
BadFeelingAboutThis

Reputation: 14406

If you gave the button an instance name of login_btn, then you just access it from it's parent (whatever timeline you put the button on)

If the parent is a timeline and your not using a document class, then just add a keyframe to the timeline and put this code on it:

login_btn.visible = false;

If you gave it the class name of login_btn in the actionscript linkage settings. Then you instantiate it like this:

var btn:login_btn = new login_btn();

In either case, no imports are necessary as they are automatically taken care of.

Upvotes: 1

Related Questions