Copy link to clipboard
Copied
hello,
I'am new in as3 programming,
I use this code and there is nothing displayed on the screen.
package
{
import flash.display.Sprite;
import flash.display.Graphics;
import flash.events.Event;
import fl.core.UIComponent;
import fl.controls.Button;
public class Main extends Sprite
{
public function Main():void
{
init();
}
private function init ():void
{
var myButton:Button = new Button();
myButton.emphasized = false;
myButton.width = 150;
myButton.move(20, 20);
addChild(myButton);
}
}
}
Help me please.
I just noticed in your code that you disable the border by using:
myButton.emphasized = false;
change that if you want a border around the button.
Copy link to clipboard
Copied
1) The code you show needs to be placed in an Actionscript class file named Main.as.
2) You need to specify "Main" as the document class in the Properties panel of your Flash file so that it uses the Main.as file for its code
3) You need to place a Button component in the library of the Flash file - do this by dragging one from the Components library to the stage, then delete it from the stage - it will be retained in the library after that
Copy link to clipboard
Copied
thank you for your reply, i already did the first ans second request you wrote.
but for the third it doesn't work. I run the programm it works bur it display only a text: Label without any border of button.
PS: iam using flash develo 4.3 and for the fl.control library i downloaded the fl.swc library. i copyed in the lib folder.
Copy link to clipboard
Copied
"Label" is the default label for a Button component. I am not familiar with whatever other component library you might be using so that might be where your problem lies... it might be the button doesn't resemble what you expect?
Try assigning a label title to the button. If the label you describe shows that text then there's your Button displayed on the screen - problem solved...
myButton.label = "Some Text";
Copy link to clipboard
Copied
it works the text is changed but same result no border for the button.
Copy link to clipboard
Copied
Try changing the background where the button is placed - maybe it's the same color. If you still have an issue, show a screen shot.
Also, try assigning some interaction for the button as well.
Copy link to clipboard
Copied
I just noticed in your code that you disable the border by using:
myButton.emphasized = false;
change that if you want a border around the button.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now